git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: escape only </code> inside code tag

Additional <verbatim> is not needed as <code> is verbatim already.

commitdf3a80cc97e99a8f4fdb8bf80b5ca85a216111b2 authorAlexander Krotov <ilabdsf@gmail.com> dateTue 21 Nov 2017, 17:41 (9 years ago) parentcf87ffe
4 files changed+10−12
src/Text/Pandoc/Writers/Muse.hs+1−1 test/Tests/Readers/Muse.hs+2 test/Tests/Writers/Muse.hs+1−2 test/writer.muse+6−9
src/Text/Pandoc/Writers/Muse.hs+1−1
@@ -328,7 +328,7 @@ inlineToMuse (Quoted DoubleQuote lst) = do
328328-- so just fallback to expanding inlines.
329329inlineToMuse (Cite _ lst) = inlineListToMuse lst
330330inlineToMuse (Code _ str) = return $
331− "<code>" <> text (conditionalEscapeString str) <> "</code>"
331+ "<code>" <> text (substitute "</code>" "<</code><code>/code>" str) <> "</code>"
332332inlineToMuse (Math InlineMath str) =
333333 lift (texMathToInlines InlineMath str) >>= inlineListToMuse
334334inlineToMuse (Math DisplayMath str) = do
test/Tests/Readers/Muse.hs+2
@@ -123,6 +123,8 @@ tests =
123123
124124 , "Verbatim tag" =: "*<verbatim>*</verbatim>*" =?> para (emph "*")
125125
126+ , "Verbatim inside code" =: "<code><verbatim>foo</verbatim></code>" =?> para (code "<verbatim>foo</verbatim>")
127+
126128 , testGroup "Links"
127129 [ "Link without description" =:
128130 "[[https://amusewiki.org/]]" =?>
test/Tests/Writers/Muse.hs+1−2
@@ -296,8 +296,7 @@ tests = [ testGroup "block elements"
296296 -- Cite is trivial
297297 , testGroup "code"
298298 [ "simple" =: code "foo" =?> "<code>foo</code>"
299− , "escape lightweight markup" =: code "foo = bar" =?> "<code><verbatim>foo = bar</verbatim></code>"
300− , "escape tag" =: code "<code>foo = bar</code> baz" =?> "<code><verbatim><code>foo = bar</code> baz</verbatim></code>"
299+ , "escape tag" =: code "<code>foo = bar</code> baz" =?> "<code><code>foo = bar<</code><code>/code> baz</code>"
301300 ]
302301 , testGroup "spaces"
303302 [ "space" =: text "a" <> space <> text "b" =?> "a b"
test/writer.muse+6−9
@@ -478,8 +478,8 @@ So is <strong><em>this</em></strong> word.
478478
479479So is <strong><em>this</em></strong> word.
480480
481−This is code: <code><verbatim>></verbatim></code>, <code>$</code>,
482−<code>\</code>, <code>\$</code>, <code><verbatim><html></verbatim></code>.
481+This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>,
482+<code><html></code>.
483483
484484<del>This is <em>strikeout</em>.</del>
485485
@@ -529,8 +529,7 @@ Ellipses…and…and….
529529
530530These shouldn’t be math:
531531
532− - To get the famous equation, write
533− <code><verbatim>$e = mc^2$</verbatim></code>.
532+ - To get the famous equation, write <code>$e = mc^2$</code>.
534533 - $22,000 is a <em>lot</em> of money. So is $34,000. (It worked if "lot" is
535534 emphasized.)
536535 - Shoes ($20) and socks ($5).
@@ -673,8 +672,7 @@ An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
673672Blockquoted: [[http://example.com/]]
674673</quote>
675674
676−Auto-links should not occur here:
677−<code><verbatim><http://example.com/></verbatim></code>
675+Auto-links should not occur here: <code><http://example.com/></code>
678676
679677<example>
680678or here: <http://example.com/>
@@ -722,9 +720,8 @@ This paragraph should not be part of the note, as it is not indented.
722720 indent the first line of each block.
723721
724722[3] This is <em>easier</em> to type. Inline notes may contain
725− [[http://google.com][links]] and <code><verbatim>]</verbatim></code>
726− verbatim characters, as well as <verbatim>[bracketed</verbatim>
727− <verbatim>text].</verbatim>
723+ [[http://google.com][links]] and <code>]</code> verbatim characters, as
724+ well as <verbatim>[bracketed</verbatim> <verbatim>text].</verbatim>
728725
729726[4] In quote.
730727