git.iko.soy/typeable/pandoc
on master help sign in
Implement <code> blocks in dokuwiki writer (#386)
573bd1bclaremacrae
src/Text/Pandoc/Writers/DokuWiki.hs+1−2
@@ -32,7 +32,6 @@ DokuWiki: <https://www.dokuwiki.org/dokuwiki>
32
32
33{-
33{-
34 [ ] Don't generate <blockquote>...
34 [ ] Don't generate <blockquote>...
35− [ ] Don't generate <pre>...
36 [ ] Implement definition lists
35 [ ] Implement definition lists
37 [ ] Don't generate lists using <ol> and <ul>
36 [ ] Don't generate lists using <ol> and <ul>
38 [ ] Don't generate <div>
37 [ ] Don't generate <div>
@@ -142,7 +141,7 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
142 "smalltalk", "smarty", "sql", "tcl", "", "thinbasic", "tsql", "vb", "vbnet", "vhdl",
141 "smalltalk", "smarty", "sql", "tcl", "", "thinbasic", "tsql", "vb", "vbnet", "vhdl",
143 "visualfoxpro", "winbatch", "xml", "xpp", "z80"]
142 "visualfoxpro", "winbatch", "xml", "xpp", "z80"]
144 let (beg, end) = if null at
143 let (beg, end) = if null at
145− then ("<pre" ++ if null classes then ">" else " class=\"" ++ unwords classes ++ "\">", "</pre>")
144+ then ("<code" ++ if null classes then ">" else " class=\"" ++ unwords classes ++ "\">", "</code>")
146 else ("<source lang=\"" ++ head at ++ "\">", "</source>")
145 else ("<source lang=\"" ++ head at ++ "\">", "</source>")
147 return $ beg ++ escapeString str ++ end
146 return $ beg ++ escapeString str ++ end
148
147
tests/writer.dokuwiki+15−15
@@ -50,9 +50,9 @@ E-mail style:
50</blockquote>
50</blockquote>
51<blockquote>Code in a block quote:
51<blockquote>Code in a block quote:
52
52
53−<pre>sub status {
53+<code>sub status {
54 print &quot;working&quot;;
54 print &quot;working&quot;;
55−}</pre>
55+}</code>
56A list:
56A list:
57
57
58 - item one
58 - item one
@@ -75,18 +75,18 @@ And a following paragraph.
75
75
76Code:
76Code:
77
77
78−<pre>---- (should be four hyphens)
78+<code>---- (should be four hyphens)
79
79
80sub status {
80sub status {
81 print &quot;working&quot;;
81 print &quot;working&quot;;
82}
82}
83
83
84−this code block is indented by one tab</pre>
84+this code block is indented by one tab</code>
85And:
85And:
86
86
87−<pre> this code block is indented by two tabs
87+<code> this code block is indented by two tabs
88
88
89−These should not be escaped: \$ \\ \&gt; \[ \{</pre>
89+These should not be escaped: \$ \\ \&gt; \[ \{</code>
90
90
91----
91----
92
92
@@ -276,7 +276,7 @@ Multiple blocks with italics:
276<p>contains seeds, crisp, pleasant to taste</p></dd>
276<p>contains seeds, crisp, pleasant to taste</p></dd>
277<dt>//orange//</dt>
277<dt>//orange//</dt>
278<dd><p>orange fruit</p>
278<dd><p>orange fruit</p>
279−<pre>{ orange code block }</pre>
279+<code>{ orange code block }</code>
280<blockquote><p>orange block quote</p></blockquote></dd></dl>
280<blockquote><p>orange block quote</p></blockquote></dd></dl>
281
281
282Multiple definitions, tight:
282Multiple definitions, tight:
@@ -352,12 +352,12 @@ foo
352
352
353This should be a code block, though:
353This should be a code block, though:
354
354
355−<pre>&lt;div&gt;
355+<code>&lt;div&gt;
356 foo
356 foo
357−&lt;/div&gt;</pre>
357+&lt;/div&gt;</code>
358As should this:
358As should this:
359
359
360−<pre>&lt;div&gt;foo&lt;/div&gt;</pre>
360+<code>&lt;div&gt;foo&lt;/div&gt;</code>
361Now, nested:
361Now, nested:
362
362
363<div>
363<div>
@@ -386,14 +386,14 @@ Blah
386
386
387Code block:
387Code block:
388
388
389−<pre>&lt;!-- Comment --&gt;</pre>
389+<code>&lt;!-- Comment --&gt;</code>
390Just plain comment, with trailing spaces on the line:
390Just plain comment, with trailing spaces on the line:
391
391
392<!-- foo -->
392<!-- foo -->
393
393
394Code:
394Code:
395
395
396−<pre>&lt;hr /&gt;</pre>
396+<code>&lt;hr /&gt;</code>
397Hr’s:
397Hr’s:
398
398
399<hr>
399<hr>
@@ -588,7 +588,7 @@ Indented [[url|thrice]].
588
588
589This should [not][] be a link.
589This should [not][] be a link.
590
590
591−<pre>[not]: /url</pre>
591+<code>[not]: /url</code>
592Foo [[url/|bar]].
592Foo [[url/|bar]].
593
593
594Foo [[url/|biz]].
594Foo [[url/|biz]].
@@ -617,7 +617,7 @@ An e-mail address: [[mailto:nobody@nowhere.net|nobody@nowhere.net]]
617</blockquote>
617</blockquote>
618Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code>
618Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code>
619
619
620−<pre>or here: &lt;http://example.com/&gt;</pre>
620+<code>or here: &lt;http://example.com/&gt;</code>
621
621
622----
622----
623
623
@@ -639,7 +639,7 @@ Here is a footnote reference,((Here is the footnote. It can go anywhere after th
639
639
640Subsequent blocks are indented to show that they belong to the footnote (as with list items).
640Subsequent blocks are indented to show that they belong to the footnote (as with list items).
641
641
642−<pre> { &lt;code&gt; }</pre>
642+<code> { &lt;code&gt; }</code>
643If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
643If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
644)) This should //not// be a footnote reference, because it contains a space.[^my note] Here is an inline note.((This is //easier// to type. Inline notes may contain [[http://google.com|links]] and <code>]</code> verbatim characters, as well as [bracketed text].
644)) This should //not// be a footnote reference, because it contains a space.[^my note] Here is an inline note.((This is //easier// to type. Inline notes may contain [[http://google.com|links]] and <code>]</code> verbatim characters, as well as [bracketed text].
645))
645))