aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-08-30 17:10:46 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-09-02 03:29:27 +0300
commit6ea6011ca66c3127ff42cd5d0d39b3bd40e56e76 (patch)
treeab49bc0a8d0571323302fd10d86ccaa1ad9b1f84 /test
parent746c30971ebbf9c1b02a3d7b7c5d94e67f8ee9ed (diff)
downloadpandoc-6ea6011ca66c3127ff42cd5d0d39b3bd40e56e76.tar.gz
Muse writer: use lightweight markup when possible
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Writers/Muse.hs50
-rw-r--r--test/writer.muse75
2 files changed, 75 insertions, 50 deletions
diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs
index 50c0e78eb..f44097f9e 100644
--- a/test/Tests/Writers/Muse.hs
+++ b/test/Tests/Writers/Muse.hs
@@ -354,23 +354,51 @@ tests = [ testGroup "block elements"
, "do not escape ; inside paragraph" =: text "foo ; bar" =?> "foo ; bar"
]
, testGroup "emphasis"
- [ "emph" =: emph (text "foo") =?> "<em>foo</em>"
- , "strong" =: strong (text "foo") =?> "<strong>foo</strong>"
+ [ "emphasis" =: emph (text "foo") =?> "*foo*"
+ , "emphasis inside word" =: text "foo" <> emph (text "bar") <> text "baz" =?> "foo<em>bar</em>baz"
+ , "emphasis before comma" =: emph (text "foo") <> text ", bar" =?> "*foo*, bar"
+ , "emphasis before period" =: emph (text "foobar") <> text "." =?> "*foobar*."
+ , "empty emphasis" =: emph mempty =?> "<em></em>"
+ , "empty strong" =: strong mempty =?> "<strong></strong>"
+ , "empty strong emphasis" =: strong (emph mempty) =?> "**<em></em>**"
+ , "empty emphasized strong" =: emph (strong mempty) =?> "*<strong></strong>*"
+ , "strong" =: strong (text "foo") =?> "**foo**"
+ , "strong inside word" =: text "foo" <> strong (text "bar") <> text "baz" =?> "foo<strong>bar</strong>baz"
+ , "strong emphasis" =: strong (emph (text "foo")) =?> "***foo***"
+ , "strong after emphasis" =: emph (text "foo") <> strong (text "bar") =?> "*foo*<strong>bar</strong>"
+ , "strong emphasis after emphasis" =: emph (text "foo") <> strong (emph (text "bar")) =?> "*foo*<strong>*bar*</strong>"
+ , "strong in the end of emphasis" =: emph (text "foo" <> strong (text "bar")) =?> "*foo<strong>bar</strong>*"
, "strikeout" =: strikeout (text "foo") =?> "<del>foo</del>"
+ , "space at the beginning of emphasis" =: emph (text " foo") =?> "<em> foo</em>"
+ , "space at the end of emphasis" =: emph (text "foo ") =?> "<em>foo </em>"
+ , "space at the beginning of strong" =: strong (text " foo") =?> "<strong> foo</strong>"
+ , "space at the end of strong" =: strong (text "foo ") =?> "<strong>foo </strong>"
+ , "space at the beginning of strong emphasis" =: strong (emph (text " foo")) =?> "**<em> foo</em>**"
+ , "space at the end of strong emphasis" =: strong (emph (text "foo ")) =?> "**<em>foo </em>**"
+ , "space at the beginning of emphasiszed strong" =: emph (strong (text " foo")) =?> "*<strong> foo</strong>*"
+ , "space at the end of emphasized strong" =: emph (strong (text "foo ")) =?> "*<strong>foo </strong>*"
]
, "superscript" =: superscript (text "foo") =?> "<sup>foo</sup>"
, "subscript" =: subscript (text "foo") =?> "<sub>foo</sub>"
- , "smallcaps" =: smallcaps (text "foo") =?> "<em>foo</em>"
- , "smallcaps near emphasis" =: emph (str "foo") <> smallcaps (str "bar") =?> "<em>foobar</em>"
+ , "smallcaps" =: smallcaps (text "foo") =?> "*foo*"
+ , "smallcaps near emphasis" =: emph (str "foo") <> smallcaps (str "bar") =?> "*foobar*"
, "single quoted" =: singleQuoted (text "foo") =?> "‘foo’"
, "double quoted" =: doubleQuoted (text "foo") =?> "“foo”"
-- Cite is trivial
, testGroup "code"
- [ "simple" =: code "foo" =?> "<code>foo</code>"
+ [ "simple" =: code "foo" =?> "=foo="
+ , "empty" =: code "" =?> "<code></code>"
+ , "space" =: code " " =?> "<code> </code>"
+ , "space at the beginning" =: code " foo" =?> "<code> foo</code>"
+ , "space at the end" =: code "foo " =?> "<code>foo </code>"
+ , "use tags for =" =: code "foo = bar" =?> "<code>foo = bar</code>"
, "escape tag" =: code "<code>foo = bar</code> baz" =?> "<code><code>foo = bar<</code><code>/code> baz</code>"
- , "normalization with attributes" =: codeWith ("",["haskell"],[]) "foo" <> code "bar" =?> "<code>foobar</code>"
- , "normalization" =: code "</co" <> code "de>" =?> "<code><</code><code>/code></code>"
- , "normalization with empty string" =: code "</co" <> str "" <> code "de>" =?> "<code><</code><code>/code></code>"
+ , "normalization with attributes" =: codeWith ("",["haskell"],[]) "foo" <> code "bar" =?> "=foobar="
+ , "code tag" =: code "<code>foo</code>" =?> "=<code>foo</code>="
+ , "normalization" =: code "</co" <> code "de>" <> code "=" =?> "<code><</code><code>/code>=</code>"
+ , "normalization with empty string" =: code "</co" <> str "" <> code "de>" <> code "=" =?> "<code><</code><code>/code>=</code>"
+ , "emphasized code" =: emph (code "foo") =?> "*=foo=*"
+ , "strong code" =: strong (code "foo") =?> "**=foo=**"
]
, testGroup "spaces"
[ "space" =: text "a" <> space <> text "b" =?> "a b"
@@ -385,7 +413,7 @@ tests = [ testGroup "block elements"
, testGroup "math"
[ "inline math" =: math "2^3" =?> "2<sup>3</sup>"
, "display math" =: displayMath "2^3" =?> "2<sup>3</sup>"
- , "multiple letters in inline math" =: math "abc" =?> "<em>abc</em>"
+ , "multiple letters in inline math" =: math "abc" =?> "*abc*"
, "expand math before normalization" =: math "[" <> str "2]" =?> "<verbatim>[2]</verbatim>"
, "multiple math expressions inside one inline list" =: math "5_4" <> text ", " <> displayMath "3^2" =?> "5<sub>4</sub>, 3<sup>2</sup>"
]
@@ -461,7 +489,7 @@ tests = [ testGroup "block elements"
"<em>foo</em>bar"
, "emph quoted" =:
para (doubleQuoted (emph (text "foo"))) =?>
- "“<em>foo</em>”"
+ "“*foo*”"
, "strong word before" =:
para (text "foo" <> strong (text "bar")) =?>
"foo<strong>bar</strong>"
@@ -470,7 +498,7 @@ tests = [ testGroup "block elements"
"<strong>foo</strong>bar"
, "strong quoted" =:
para (singleQuoted (strong (text "foo"))) =?>
- "‘<strong>foo</strong>’"
+ "‘**foo**’"
]
]
]
diff --git a/test/writer.muse b/test/writer.muse
index 5993ec357..35d43a751 100644
--- a/test/writer.muse
+++ b/test/writer.muse
@@ -11,7 +11,7 @@ markdown test suite.
** Level 2 with an [[/url][embedded link]]
-*** Level 3 with <em>emphasis</em>
+*** Level 3 with *emphasis*
**** Level 4
@@ -19,7 +19,7 @@ markdown test suite.
* Level 1
-** Level 2 with <em>emphasis</em>
+** Level 2 with *emphasis*
*** Level 3
@@ -271,18 +271,18 @@ Loose:
Multiple blocks with italics:
- <em>apple</em> :: red fruit
+ *apple* :: red fruit
- contains seeds, crisp, pleasant to taste
- <em>orange</em> :: orange fruit
+ contains seeds, crisp, pleasant to taste
+ *orange* :: orange fruit
- <example>
- { orange code block }
- </example>
+ <example>
+ { orange code block }
+ </example>
- <quote>
- orange block quote
- </quote>
+ <quote>
+ orange block quote
+ </quote>
Multiple definitions, tight:
@@ -331,7 +331,7 @@ Interpreted markdown in a table:
<td>
</literal>
-This is <em>emphasized</em>
+This is *emphasized*
<literal style="html">
</td>
@@ -341,7 +341,7 @@ This is <em>emphasized</em>
<td>
</literal>
-And this is <strong>strong</strong>
+And this is **strong**
<literal style="html">
</td>
@@ -461,27 +461,25 @@ Hr’s:
* Inline Markup
-This is <em>emphasized</em>, and so <em>is this</em>.
+This is *emphasized*, and so *is this*.
-This is <strong>strong</strong>, and so <strong>is this</strong>.
+This is **strong**, and so **is this**.
-An <em>[[/url][emphasized link]]</em>.
+An *[[/url][emphasized link]]*.
-<strong><em>This is strong and em.</em></strong>
+***This is strong and em.***
-So is <strong><em>this</em></strong> word.
+So is ***this*** word.
-<strong><em>This is strong and em.</em></strong>
+***This is strong and em.***
-So is <strong><em>this</em></strong> word.
+So is ***this*** word.
-This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>,
-<code><html></code>.
+This is code: =>=, =$=, =\=, =\$=, =<html>=.
-<del>This is <em>strikeout</em>.</del>
+<del>This is *strikeout*.</del>
-Superscripts: a<sup>bc</sup>d a<sup><em>hello</em></sup>
-a<sup>hello there</sup>.
+Superscripts: a<sup>bc</sup>d a<sup>*hello*</sup> a<sup>hello there</sup>.
Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.
@@ -500,8 +498,8 @@ spaces: a^b c^d, a~b c~d.
‘He said, “I want to go.”’ Were you alive in the 70’s?
-Here is some quoted ‘<code>code</code>’ and a
-“[[http://example.com/?foo=1&bar=2][quoted link]]”.
+Here is some quoted ‘=code=’ and a “[[http://example.com/?foo=1&bar=2][quoted
+link]]”.
Some dashes: one—two — three—four — five.
@@ -515,22 +513,21 @@ Ellipses…and…and….
- <literal style="tex">\cite[22-23]{smith.1899}</literal>
- <verbatim>2 + 2 = 4</verbatim>
- - <em>x</em> ∈ <em>y</em>
- - <em>α</em> ∧ <em>ω</em>
+ - *x* ∈ *y*
+ - *α* ∧ *ω*
- 223
- - <em>p</em>-Tree
+ - *p*-Tree
- Here’s some display math:
<verbatim>$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$</verbatim>
- - Here’s one that has a line break in it:
- <em>α</em> + <em>ω</em> × <em>x</em><sup>2</sup>.
+ - Here’s one that has a line break in it: *α* + *ω* × *x*<sup>2</sup>.
These shouldn’t be math:
- 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
+ - $22,000 is a *lot* of money. So is $34,000. (It worked if “lot” is
emphasized.)
- Shoes ($20) and socks ($5).
- - Escaped <code>$</code>: $73 <em>this should be emphasized</em> 23$.
+ - Escaped =$=: $73 *this should be emphasized* 23$.
Here’s a LaTeX table:
@@ -669,7 +666,7 @@ An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
Blockquoted: [[http://example.com/]]
</quote>
-Auto-links should not occur here: <code><http://example.com/></code>
+Auto-links should not occur here: =<http://example.com/>=
<example>
or here: <http://example.com/>
@@ -689,7 +686,7 @@ Here is a movie [[movie.jpg][movie]] icon.
* Footnotes
-Here is a footnote reference,[1] and another.[2] This should <em>not</em> be a
+Here is a footnote reference,[1] and another.[2] This should *not* be a
footnote reference, because it contains a space.[^my note] Here is an inline
note.[3]
@@ -716,9 +713,9 @@ This paragraph should not be part of the note, as it is not indented.
If you want, you can indent every line, but you can also be lazy and just
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>]</code> verbatim characters, as
- well as [bracketed text].
+[3] This is *easier* to type. Inline notes may contain
+ [[http://google.com][links]] and =]= verbatim characters, as well as
+ [bracketed text].
[4] In quote.