DokuWiki writer: Use proper <code> tags for code blocks.

Closes #2213.
This commit is contained in:
John MacFarlane
2015-06-07 11:29:47 -07:00
parent cb7dd4469d
commit 7b4f077652
2 changed files with 41 additions and 19 deletions
+4 -4
View File
@@ -172,10 +172,10 @@ blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do
"python", "qbasic", "rails", "reg", "robots", "ruby", "sas", "scheme", "sdlbasic",
"smalltalk", "smarty", "sql", "tcl", "", "thinbasic", "tsql", "vb", "vbnet", "vhdl",
"visualfoxpro", "winbatch", "xml", "xpp", "z80"]
let (beg, end) = if null at
then ("<code" ++ if null classes then ">" else " class=\"" ++ unwords classes ++ "\">", "</code>")
else ("<source lang=\"" ++ head at ++ "\">", "</source>")
return $ beg ++ str ++ end
return $ "<code" ++
(case at of
[] -> ">\n"
(x:_) -> " " ++ x ++ ">\n") ++ str ++ "\n</code>"
blockToDokuWiki opts (BlockQuote blocks) = do
contents <- blockListToDokuWiki opts blocks
+37 -15
View File
@@ -51,9 +51,11 @@ E-mail style:
<HTML><blockquote>
Code in a block quote:
<code>sub status {
<code>
sub status {
print "working";
}</code>
}
</code>
A list:
- item one
@@ -76,18 +78,22 @@ And a following paragraph.
Code:
<code>---- (should be four hyphens)
<code>
---- (should be four hyphens)
sub status {
print "working";
}
this code block is indented by one tab</code>
this code block is indented by one tab
</code>
And:
<code> this code block is indented by two tabs
<code>
this code block is indented by two tabs
These should not be escaped: \$ \\ \> \[ \{</code>
These should not be escaped: \$ \\ \> \[ \{
</code>
----
@@ -268,7 +274,9 @@ Multiple blocks with italics:
<HTML><p></HTML>contains seeds, crisp, pleasant to taste<HTML></p></HTML><HTML></dd></HTML>
<HTML><dt></HTML>//orange//<HTML></dt></HTML>
<HTML><dd></HTML><HTML><p></HTML>orange fruit<HTML></p></HTML>
<code>{ orange code block }</code>
<code>
{ orange code block }
</code>
> <HTML><p></HTML>orange block quote<HTML></p></HTML>
<HTML></dd></HTML><HTML></dl></HTML>
@@ -330,12 +338,16 @@ foo
This should be a code block, though:
<code><div>
<code>
<div>
foo
</div></code>
</div>
</code>
As should this:
<code><div>foo</div></code>
<code>
<div>foo</div>
</code>
Now, nested:
foo
@@ -360,7 +372,9 @@ Blah
</HTML>
Code block:
<code><!-- Comment --></code>
<code>
<!-- Comment -->
</code>
Just plain comment, with trailing spaces on the line:
<HTML>
@@ -368,7 +382,9 @@ Just plain comment, with trailing spaces on the line:
</HTML>
Code:
<code><hr /></code>
<code>
<hr />
</code>
Hr’s:
<HTML>
@@ -556,7 +572,9 @@ Indented [[url|thrice]].
This should [not][] be a link.
<code>[not]: /url</code>
<code>
[not]: /url
</code>
Foo [[url/|bar]].
Foo [[url/|biz]].
@@ -585,7 +603,9 @@ An e-mail address: <nobody@nowhere.net>
Auto-links should not occur here: ''%%<http://example.com/>%%''
<code>or here: <http://example.com/></code>
<code>
or here: <http://example.com/>
</code>
----
@@ -607,7 +627,9 @@ Here is a footnote reference,((Here is the footnote. It can go anywhere after th
Subsequent blocks are indented to show that they belong to the footnote (as with list items).
<code> { <code> }</code>
<code>
{ <code> }
</code>
If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
)) 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 ''%%]%%'' verbatim characters, as well as [bracketed text].
))