git.iko.soy/typeable/pandoc
on master help sign in
Fixed inlined code in dokuwiki writer (#386)
0961d49claremacrae
src/Text/Pandoc/Writers/DokuWiki.hs+1−6
@@ -48,7 +48,6 @@ import Text.Pandoc.Options
48import Text.Pandoc.Shared
48import Text.Pandoc.Shared
49import Text.Pandoc.Writers.Shared
49import Text.Pandoc.Writers.Shared
50import Text.Pandoc.Templates (renderTemplate')
50import Text.Pandoc.Templates (renderTemplate')
51−import Text.Pandoc.XML ( escapeStringForXML ) -- TODO Remove this line
52import Data.List ( intersect, intercalate )
51import Data.List ( intersect, intercalate )
53import Network.URI ( isURI )
52import Network.URI ( isURI )
54import Control.Monad.State
53import Control.Monad.State
@@ -86,10 +85,6 @@ pandocToDokuWiki opts (Pandoc meta blocks) = do
86 then return $ renderTemplate' (writerTemplate opts) context
85 then return $ renderTemplate' (writerTemplate opts) context
87 else return main
86 else return main
88
87
89−-- | Escape special characters for DokuWiki.
90−escapeString :: String -> String -- TODO Remove this
91−escapeString = escapeStringForXML
92−
93-- | Convert Pandoc block element to DokuWiki.
88-- | Convert Pandoc block element to DokuWiki.
94blockToDokuWiki :: WriterOptions -- ^ Options
89blockToDokuWiki :: WriterOptions -- ^ Options
95 -> Block -- ^ Block element
90 -> Block -- ^ Block element
@@ -412,7 +407,7 @@ inlineToDokuWiki opts (Quoted DoubleQuote lst) = do
412inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst
407inlineToDokuWiki opts (Cite _ lst) = inlineListToDokuWiki opts lst
413
408
414inlineToDokuWiki _ (Code _ str) =
409inlineToDokuWiki _ (Code _ str) =
415− return $ "<code>" ++ (escapeString str) ++ "</code>"
410+ return $ "''" ++ str++ "''"
416
411
417inlineToDokuWiki _ (Str str) = return $ str
412inlineToDokuWiki _ (Str str) = return $ str
418
413
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: <code>&gt;</code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html&gt;</code>.
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>code</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 <code>$e = mc^2$</code>.
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 <code>$</code>: $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: <code>&lt;http://example.com/&gt;</code>
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 <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 '']'' 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.