git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: don't wrap displayMath into <verse>

<verse> is a block tag and displayMath is an inline element. Writing <verse> around displayMath could result in nested <verse> tags.

commit9ff8bc64f9c873e2bcae6a1a46f71af9287d6753 authorAlexander Krotov <ilabdsf@gmail.com> dateMon 29 Jan 2018, 23:27 (9 years ago) parentb7d8930
3 files changed+4−7
src/Text/Pandoc/Writers/Muse.hs+2−5 test/Tests/Writers/Muse.hs+1−1 test/writer.muse+1−1
src/Text/Pandoc/Writers/Muse.hs+2−5
@@ -363,11 +363,8 @@ inlineToMuse (Quoted DoubleQuote lst) = do
363363inlineToMuse (Cite _ lst) = inlineListToMuse lst
364364inlineToMuse (Code _ str) = return $
365365 "<code>" <> text (substitute "</code>" "<</code><code>/code>" str) <> "</code>"
366−inlineToMuse (Math InlineMath str) =
367− lift (texMathToInlines InlineMath str) >>= inlineListToMuse
368−inlineToMuse (Math DisplayMath str) = do
369− contents <- lift (texMathToInlines DisplayMath str) >>= inlineListToMuse
370− return $ "<verse>" <> contents <> "</verse>" <> blankline
366+inlineToMuse (Math t str) =
367+ lift (texMathToInlines t str) >>= inlineListToMuse
371368inlineToMuse (RawInline (Format f) str) =
372369 return $ "<literal style=\"" <> text f <> "\">" <> text str <> "</literal>"
373370inlineToMuse LineBreak = return $ "<br>" <> cr
test/Tests/Writers/Muse.hs+1−1
@@ -330,7 +330,7 @@ tests = [ testGroup "block elements"
330330 ]
331331 , testGroup "math"
332332 [ "inline math" =: math "2^3" =?> "2<sup>3</sup>"
333− , "display math" =: displayMath "2^3" =?> "<verse>2<sup>3</sup></verse>"
333+ , "display math" =: displayMath "2^3" =?> "2<sup>3</sup>"
334334 , "multiple letters in inline math" =: math "abc" =?> "<em>abc</em>"
335335 ]
336336 , "raw inline"
test/writer.muse+1−1
@@ -520,7 +520,7 @@ Ellipses…and…and….
520520 - 223
521521 - <em>p</em>-Tree
522522 - Here’s some display math:
523− <verse><verbatim>$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$</verbatim></verse>
523+ <verbatim>$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$</verbatim>
524524 - Here’s one that has a line break in it:
525525 <em>α</em> + <em>ω</em> × <em>x</em><sup>2</sup>.
526526