diff options
-rw-r--r-- | src/Text/Pandoc/Writers/DokuWiki.hs | 11 | ||||
-rw-r--r-- | tests/dokuwiki-writer.dokuwiki | 2 | ||||
-rw-r--r-- | tests/writer.dokuwiki | 12 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index 9ac35ebd6..a38a54953 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -412,7 +412,16 @@ inlineToDokuWiki opts (Quoted DoubleQuote lst) = do inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst inlineToDokuWiki _ (Code _ str) = - return $ "''" ++ ( escapeString str ) ++ "''" + -- In dokuwiki, text surrounded by '' is really just a font statement, i.e. <tt>, + -- and so other formatting can be present inside. + -- However, in pandoc, and markdown, inlined code doesn't contain formatting. + -- So I have opted for using %% to disable all formatting inside inline code blocks. + -- This gives the best results when converting from other formats to dokuwiki, even if + -- the resultand code is a little ugly, for short strings that don't contain formatting + -- characters. + -- It does mean that if pandoc could ever read dokuwiki, and so round-trip the format, + -- any formatting inside inlined code blocks would be lost, or presented incorrectly. + return $ "''%%" ++ str ++ "%%''" inlineToDokuWiki _ (Str str) = return $ str diff --git a/tests/dokuwiki-writer.dokuwiki b/tests/dokuwiki-writer.dokuwiki index dbffb7a0e..44f06f777 100644 --- a/tests/dokuwiki-writer.dokuwiki +++ b/tests/dokuwiki-writer.dokuwiki @@ -1,3 +1,3 @@ hello // world ** from __ me -''hello %%//%% world ** from __ me'' +''%%hello // world ** from __ me%%'' diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki index 8aeb52bd6..9855f30dd 100644 --- a/tests/writer.dokuwiki +++ b/tests/writer.dokuwiki @@ -433,7 +433,7 @@ So is **//this//** word. So is **//this//** word. -This is code: ''>'', ''$'', ''\'', ''\$'', ''<html>''. +This is code: ''%%>%%'', ''%%$%%'', ''%%\%%'', ''%%\$%%'', ''%%<html>%%''. <del>This is //strikeout//.</del> @@ -456,7 +456,7 @@ These should not be superscripts or subscripts, because of the unescaped spaces: ‘He said, “I want to go.”’ Were you alive in the 70’s? -Here is some quoted ‘''code''’ and a “[[http://example.com/?foo=1&bar=2|quoted link]]”. +Here is some quoted ‘''%%code%%''’ and a “[[http://example.com/?foo=1&bar=2|quoted link]]”. Some dashes: one—two — three—four — five. @@ -480,10 +480,10 @@ Ellipses…and…and…. These shouldn’t be math: - * To get the famous equation, write ''$e = mc^2$''. + * To get the famous equation, write ''%%$e = mc^2$%%''. * $22,000 is a //lot// of money. So is $34,000. (It worked if “lot” is emphasized.) * Shoes ($20) and socks ($5). - * Escaped ''$'': $73 //this should be emphasized// 23$. + * Escaped ''%%$%%'': $73 //this should be emphasized// 23$. Here’s a LaTeX table: @@ -615,7 +615,7 @@ An e-mail address: [[mailto:nobody@nowhere.net|nobody@nowhere.net]] <blockquote>Blockquoted: http://example.com/ </blockquote> -Auto-links should not occur here: ''<http://example.com/>'' +Auto-links should not occur here: ''%%<http://example.com/>%%'' <code>or here: <http://example.com/></code> @@ -641,7 +641,7 @@ Subsequent blocks are indented to show that they belong to the footnote (as with <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]. +)) 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]. )) <blockquote>Notes can go in quotes.((In quote. |