git.iko.soy/typeable/pandoc
on master help sign in
Treat inline code blocks like <code> instead of <tt> in dokuwiki writer (#386)
6d484bcclaremacrae
src/Text/Pandoc/Writers/DokuWiki.hs+10−1
@@ -412,7 +412,16 @@ inlineToDokuWiki opts (Quoted DoubleQuote lst) = do
412inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst
412inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst
413
413
414inlineToDokuWiki _ (Code _ str) =
414inlineToDokuWiki _ (Code _ str) =
415+ -- In dokuwiki, text surrounded by '' is really just a font statement, i.e. <tt>,
416+ -- and so other formatting can be present inside.
417+ -- However, in pandoc, and markdown, inlined code doesn't contain formatting.
418+ -- So I have opted for using %% to disable all formatting inside inline code blocks.
419+ -- This gives the best results when converting from other formats to dokuwiki, even if
420+ -- the resultand code is a little ugly, for short strings that don't contain formatting
421+ -- characters.
422+ -- It does mean that if pandoc could ever read dokuwiki, and so round-trip the format,
423+ -- any formatting inside inlined code blocks would be lost, or presented incorrectly.
415− return $ "''" ++ ( escapeString str ) ++ "''"
424+ return $ "''%%" ++ str ++ "%%''"
416
425
417inlineToDokuWiki _ (Str str) = return $ str
426inlineToDokuWiki _ (Str str) = return $ str
418
427
tests/dokuwiki-writer.dokuwiki+1−1
@@ -1,3 +1,3 @@
1hello // world ** from __ me
1hello // world ** from __ me
2
2
3−''hello %%//%% world ** from __ me''
3+''%%hello // world ** from __ me%%''
tests/writer.dokuwiki+6−6
@@ -433,7 +433,7 @@ So is **//this//** word.
433
433
434So is **//this//** word.
434So is **//this//** word.
435
435
436−This is code: ''>'', ''$'', ''\'', ''\$'', ''<html>''.
436+This is code: ''%%>%%'', ''%%$%%'', ''%%\%%'', ''%%\$%%'', ''%%<html>%%''.
437
437
438<del>This is //strikeout//.</del>
438<del>This is //strikeout//.</del>
439
439
@@ -456,7 +456,7 @@ These should not be superscripts or subscripts, because of the unescaped spaces:
456
456
457‘He said, “I want to go.”’ Were you alive in the 70’s?
457‘He said, “I want to go.”’ Were you alive in the 70’s?
458
458
459−Here is some quoted ‘''code''’ and a “[[http://example.com/?foo=1&bar=2|quoted link]]”.
459+Here is some quoted ‘''%%code%%''’ and a “[[http://example.com/?foo=1&bar=2|quoted link]]”.
460
460
461Some dashes: one—two — three—four — five.
461Some dashes: one—two — three—four — five.
462
462
@@ -480,10 +480,10 @@ Ellipses…and…and….
480
480
481These shouldn’t be math:
481These shouldn’t be math:
482
482
483− * To get the famous equation, write ''$e = mc^2$''.
483+ * To get the famous equation, write ''%%$e = mc^2$%%''.
484 * $22,000 is a //lot// of money. So is $34,000. (It worked if “lot” is emphasized.)
484 * $22,000 is a //lot// of money. So is $34,000. (It worked if “lot” is emphasized.)
485 * Shoes ($20) and socks ($5).
485 * Shoes ($20) and socks ($5).
486− * Escaped ''$'': $73 //this should be emphasized// 23$.
486+ * Escaped ''%%$%%'': $73 //this should be emphasized// 23$.
487
487
488Here’s a LaTeX table:
488Here’s a LaTeX table:
489
489
@@ -615,7 +615,7 @@ An e-mail address: [[mailto:nobody@nowhere.net|nobody@nowhere.net]]
615
615
616<blockquote>Blockquoted: http://example.com/
616<blockquote>Blockquoted: http://example.com/
617</blockquote>
617</blockquote>
618−Auto-links should not occur here: ''<http://example.com/>''
618+Auto-links should not occur here: ''%%<http://example.com/>%%''
619
619
620<code>or here: <http://example.com/></code>
620<code>or here: <http://example.com/></code>
621
621
@@ -641,7 +641,7 @@ Subsequent blocks are indented to show that they belong to the footnote (as with
641
641
642<code> { <code> }</code>
642<code> { <code> }</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 '']'' 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 ''%%]%%'' verbatim characters, as well as [bracketed text].
645))
645))
646
646
647<blockquote>Notes can go in quotes.((In quote.
647<blockquote>Notes can go in quotes.((In quote.