From 7b4f077652c774d8c366c9ac2aa3e6ca7ad708f2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 7 Jun 2015 11:29:47 -0700 Subject: DokuWiki writer: Use proper `` tags for code blocks. Closes #2213. --- src/Text/Pandoc/Writers/DokuWiki.hs | 8 +++--- tests/writer.dokuwiki | 52 ++++++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index 94f3a02cc..7164c6e86 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -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 ("" else " class=\"" ++ unwords classes ++ "\">", "") - else ("", "") - return $ beg ++ str ++ end + return $ " ">\n" + (x:_) -> " " ++ x ++ ">\n") ++ str ++ "\n" blockToDokuWiki opts (BlockQuote blocks) = do contents <- blockListToDokuWiki opts blocks diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki index 2c3c9b1b5..e984d391e 100644 --- a/tests/writer.dokuwiki +++ b/tests/writer.dokuwiki @@ -51,9 +51,11 @@ E-mail style:
Code in a block quote: -sub status { + +sub status { print "working"; -} +} + A list: - item one @@ -76,18 +78,22 @@ And a following paragraph. Code: ----- (should be four hyphens) + +---- (should be four hyphens) sub status { print "working"; } -this code block is indented by one tab +this code block is indented by one tab + And: - this code block is indented by two tabs + + this code block is indented by two tabs -These should not be escaped: \$ \\ \> \[ \{ +These should not be escaped: \$ \\ \> \[ \{ + ---- @@ -268,7 +274,9 @@ Multiple blocks with italics:

contains seeds, crisp, pleasant to taste

//orange//

orange fruit

-{ orange code block } + +{ orange code block } + >

orange block quote

@@ -330,12 +338,16 @@ foo This should be a code block, though: -
+ +
foo -
+
+
As should this: -
foo
+ +
foo
+
Now, nested: foo @@ -360,7 +372,9 @@ Blah Code block: - + + + Just plain comment, with trailing spaces on the line: @@ -368,7 +382,9 @@ Just plain comment, with trailing spaces on the line: Code: -
+ +
+
Hr’s: @@ -556,7 +572,9 @@ Indented [[url|thrice]]. This should [not][] be a link. -[not]: /url + +[not]: /url + Foo [[url/|bar]]. Foo [[url/|biz]]. @@ -585,7 +603,9 @@ An e-mail address: Auto-links should not occur here: ''%%%%'' -or here: + +or here: + ---- @@ -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). - { } + + { } + 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]. )) -- cgit v1.2.3