Muse writer: escape only </code> inside code tag

Additional <verbatim> is not needed as <code> is verbatim already.
This commit is contained in:
Alexander Krotov
2017-11-22 01:22:43 +03:00
parent cf87ffe9ee
commit df3a80cc97
4 changed files with 10 additions and 12 deletions
+1 -1
View File
@@ -328,7 +328,7 @@ inlineToMuse (Quoted DoubleQuote lst) = do
-- so just fallback to expanding inlines.
inlineToMuse (Cite _ lst) = inlineListToMuse lst
inlineToMuse (Code _ str) = return $
"<code>" <> text (conditionalEscapeString str) <> "</code>"
"<code>" <> text (substitute "</code>" "<</code><code>/code>" str) <> "</code>"
inlineToMuse (Math InlineMath str) =
lift (texMathToInlines InlineMath str) >>= inlineListToMuse
inlineToMuse (Math DisplayMath str) = do
+2
View File
@@ -123,6 +123,8 @@ tests =
, "Verbatim tag" =: "*<verbatim>*</verbatim>*" =?> para (emph "*")
, "Verbatim inside code" =: "<code><verbatim>foo</verbatim></code>" =?> para (code "<verbatim>foo</verbatim>")
, testGroup "Links"
[ "Link without description" =:
"[[https://amusewiki.org/]]" =?>
+1 -2
View File
@@ -296,8 +296,7 @@ tests = [ testGroup "block elements"
-- Cite is trivial
, testGroup "code"
[ "simple" =: code "foo" =?> "<code>foo</code>"
, "escape lightweight markup" =: code "foo = bar" =?> "<code><verbatim>foo = bar</verbatim></code>"
, "escape tag" =: code "<code>foo = bar</code> baz" =?> "<code><verbatim><code>foo = bar</code> baz</verbatim></code>"
, "escape tag" =: code "<code>foo = bar</code> baz" =?> "<code><code>foo = bar<</code><code>/code> baz</code>"
]
, testGroup "spaces"
[ "space" =: text "a" <> space <> text "b" =?> "a b"
+6 -9
View File
@@ -478,8 +478,8 @@ So is <strong><em>this</em></strong> word.
So is <strong><em>this</em></strong> word.
This is code: <code><verbatim>></verbatim></code>, <code>$</code>,
<code>\</code>, <code>\$</code>, <code><verbatim><html></verbatim></code>.
This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>,
<code><html></code>.
<del>This is <em>strikeout</em>.</del>
@@ -529,8 +529,7 @@ Ellipses…and…and….
These shouldnt be math:
- To get the famous equation, write
<code><verbatim>$e = mc^2$</verbatim></code>.
- To get the famous equation, write <code>$e = mc^2$</code>.
- $22,000 is a <em>lot</em> of money. So is $34,000. (It worked if "lot" is
emphasized.)
- Shoes ($20) and socks ($5).
@@ -673,8 +672,7 @@ An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
Blockquoted: [[http://example.com/]]
</quote>
Auto-links should not occur here:
<code><verbatim><http://example.com/></verbatim></code>
Auto-links should not occur here: <code><http://example.com/></code>
<example>
or here: <http://example.com/>
@@ -722,9 +720,8 @@ This paragraph should not be part of the note, as it is not indented.
indent the first line of each block.
[3] This is <em>easier</em> to type. Inline notes may contain
[[http://google.com][links]] and <code><verbatim>]</verbatim></code>
verbatim characters, as well as <verbatim>[bracketed</verbatim>
<verbatim>text].</verbatim>
[[http://google.com][links]] and <code>]</code> verbatim characters, as
well as <verbatim>[bracketed</verbatim> <verbatim>text].</verbatim>
[4] In quote.