maruku 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/docs/markdown_syntax.md +9 -21
  5. data/lib/maruku/defaults.rb +1 -1
  6. data/lib/maruku/element.rb +18 -3
  7. data/lib/maruku/ext/fenced_code.rb +1 -1
  8. data/lib/maruku/ext/math/mathml_engines/blahtex.rb +1 -1
  9. data/lib/maruku/ext/math/to_html.rb +2 -9
  10. data/lib/maruku/html.rb +5 -8
  11. data/lib/maruku/input/html_helper.rb +94 -81
  12. data/lib/maruku/input/mdline.rb +6 -4
  13. data/lib/maruku/input/parse_block.rb +145 -37
  14. data/lib/maruku/input/parse_span.rb +7 -8
  15. data/lib/maruku/input/rubypants.rb +22 -9
  16. data/lib/maruku/maruku.rb +5 -0
  17. data/lib/maruku/output/to_html.rb +15 -6
  18. data/lib/maruku/output/to_latex.rb +9 -3
  19. data/lib/maruku/output/to_s.rb +0 -1
  20. data/lib/maruku/string_utils.rb +2 -2
  21. data/lib/maruku/version.rb +1 -1
  22. data/spec/block_docs/abbrev.md +18 -18
  23. data/spec/block_docs/attribute_sanitize.md +22 -0
  24. data/spec/block_docs/auto_cdata.md +48 -0
  25. data/spec/block_docs/bug_table.md +4 -4
  26. data/spec/block_docs/code4.md +79 -0
  27. data/spec/block_docs/div_without_newline.md +16 -0
  28. data/spec/block_docs/empty_cells.md +3 -9
  29. data/spec/block_docs/entities.md +6 -12
  30. data/spec/block_docs/extra_table1.md +6 -6
  31. data/spec/block_docs/fenced_code_blocks.md +12 -20
  32. data/spec/block_docs/fenced_code_blocks_highlighted.md +1 -2
  33. data/spec/block_docs/footnotes2.md +4 -1
  34. data/spec/block_docs/ignore_bad_header.md +9 -0
  35. data/spec/block_docs/issue106.md +78 -0
  36. data/spec/block_docs/issue115.md +20 -0
  37. data/spec/block_docs/issue117.md +13 -0
  38. data/spec/block_docs/issue120.md +48 -0
  39. data/spec/block_docs/issue123.md +11 -0
  40. data/spec/block_docs/issue124.md +16 -0
  41. data/spec/block_docs/issue40.md +24 -12
  42. data/spec/block_docs/issue89.md +1 -1
  43. data/spec/block_docs/lists_nested_blankline.md +14 -8
  44. data/spec/block_docs/lists_ol.md +5 -5
  45. data/spec/block_docs/lists_paraindent.md +6 -11
  46. data/spec/block_docs/math-blahtex/equations.md +12 -13
  47. data/spec/block_docs/math-blahtex/math2.md +9 -2
  48. data/spec/block_docs/math/embedded_invalid_svg.md +31 -2
  49. data/spec/block_docs/math/embedded_svg.md +41 -2
  50. data/spec/block_docs/math/equations.md +7 -2
  51. data/spec/block_docs/math/inline.md +2 -2
  52. data/spec/block_docs/math/math2.md +9 -1
  53. data/spec/block_docs/math/spaces_after_inline_math.md +17 -0
  54. data/spec/block_docs/math/table.md +2 -2
  55. data/spec/block_docs/math/table2.md +6 -6
  56. data/spec/block_docs/table_attributes.md +4 -6
  57. data/spec/block_docs/table_colspan.md +41 -0
  58. data/spec/block_docs/tables.md +10 -21
  59. data/spec/block_docs/tables2.md +74 -0
  60. data/spec/block_docs/xml_comments.md +32 -0
  61. data/spec/span_spec.rb +1 -1
  62. data/spec/spec_helper.rb +1 -0
  63. metadata +42 -28
  64. metadata.gz.sig +3 -3
  65. data/spec/block_docs/xml2.md +0 -19
@@ -61,7 +61,10 @@ md_el(:document,[
61
61
  </ol>
62
62
  <a href="#fnref:3" rev="footnote">↩</a></li><li id="fn:4">
63
63
  <p>Like this:</p>
64
- <div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>x</mi><mo>=</mo><mi>r</mi><mi>cos</mi><mi>θ</mi></math><span class="maruku-eq-tex"><code style="display: none">x = r\cos\theta</code></span></div><a href="#fnref:4" rev="footnote">↩</a></li></ol></div>
64
+ <div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><semantics><mrow><mi>x</mi><mo>=</mo><mi>r</mi><mi>cos</mi><mi>θ</mi></mrow><annotation encoding="application/x-tex">
65
+ x = r\cos\theta
66
+
67
+ </annotation></semantics></math></div><a href="#fnref:4" rev="footnote">↩</a></li></ol></div>
65
68
  *** Output of to_latex ***
66
69
  Ruby on Rails is a web-framework\footnote{a reusable set of libraries} . It uses the MVC\footnote{Model View Controller} architecture pattern. It has its good points\footnote{Here are its good points
67
70
 
@@ -0,0 +1,9 @@
1
+ Pass weird messed up header through to output without blowing up. Secondary issue noticed via https://github.com/bhollis/maruku/issues/124
2
+ *** Parameters: ***
3
+ {:on_error => :raise}
4
+ *** Markdown input: ***
5
+ = Markdown, with some ruby =
6
+ *** Output of inspect ***
7
+ md_el(:document, md_par(["= Markdown, with some ruby ="]))
8
+ *** Output of to_html ***
9
+ <p>= Markdown, with some ruby =</p>
@@ -0,0 +1,78 @@
1
+ Code with list-delimiters in it - https://github.com/bhollis/maruku/issues/106
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+
6
+ This is code (4 spaces):
7
+
8
+ * Code
9
+ * Code (again)
10
+
11
+ This is also code
12
+
13
+ * Code
14
+ * Code (again)
15
+
16
+ This is code (1 tab):
17
+
18
+ * Code
19
+ * Code (again)
20
+
21
+
22
+ *** Output of inspect ***
23
+ md_el(:document,[
24
+ md_par(["This is code (4 spaces):"]),
25
+ md_el(:code,[],{:raw_code=>"* Code
26
+ * Code (again)", :lang=>nil},[]),
27
+ md_par(["This is also code"]),
28
+ md_el(:code,[],{:raw_code=>"* Code
29
+ * Code (again)", :lang=>nil},[]),
30
+ md_par(["This is code (1 tab):"]),
31
+ md_el(:code,[],{:raw_code=>"* Code
32
+ * Code (again)", :lang=>nil},[])
33
+ ],{},[])
34
+ *** Output of to_html ***
35
+ <p>This is code (4 spaces):</p>
36
+
37
+ <pre><code>* Code
38
+ * Code (again)</code></pre>
39
+
40
+ <p>This is also code</p>
41
+
42
+ <pre><code>* Code
43
+ * Code (again)</code></pre>
44
+
45
+ <p>This is code (1 tab):</p>
46
+
47
+ <pre><code>* Code
48
+ * Code (again)</code></pre>
49
+ *** Output of to_latex ***
50
+ This is code (4 spaces):
51
+
52
+ \begin{verbatim}* Code
53
+ * Code (again)\end{verbatim}
54
+ This is also code
55
+
56
+ \begin{verbatim}* Code
57
+ * Code (again)\end{verbatim}
58
+ This is code (1 tab):
59
+
60
+ \begin{verbatim}* Code
61
+ * Code (again)\end{verbatim}
62
+ *** Output of to_md ***
63
+ This is code (4 spaces):
64
+
65
+ * Code
66
+ * Code (again)
67
+
68
+ This is also code
69
+
70
+ * Code
71
+ * Code (again)
72
+
73
+ This is code (1 tab):
74
+
75
+ * Code
76
+ * Code (again)
77
+ *** Output of to_s ***
78
+ This is code (4 spaces):This is also codeThis is code (1 tab):
@@ -0,0 +1,20 @@
1
+ Markdown in comments should not be parsed. https://github.com/bhollis/maruku/issues/115
2
+ Note that output is kind of weird because we modify the comment in order to let REXML parse it due to https://bugs.ruby-lang.org/issues/9277.
3
+ *** Parameters: ***
4
+ {}
5
+ *** Markdown input: ***
6
+ <!--
7
+ Header
8
+ ------
9
+ -->
10
+
11
+ <!-- -- -->
12
+ *** Output of inspect ***
13
+ md_el(:document,[md_html("<!--\nHeader\n- - - - - - \n-->"), md_html("<!-- - - -->")])
14
+ *** Output of to_html ***
15
+ <!--
16
+ Header
17
+ - - - - - -
18
+ -->
19
+
20
+ <!-- - - -->
@@ -0,0 +1,13 @@
1
+ Section tags should not get <p> put around them. https://github.com/bhollis/maruku/issues/117
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ <section markdown="1">
6
+ ## Header
7
+ </section>
8
+ *** Output of inspect ***
9
+
10
+ *** Output of to_html ***
11
+ <section>
12
+ <h2>Header</h2>
13
+ </section>
@@ -0,0 +1,48 @@
1
+ Style tags should be OK with unescaped angle brackets and ampersands. https://github.com/bhollis/maruku/issues/120
2
+ NOTE: Commented CDATA is output because we use XHTML - for HTML mode it should be omitted.
3
+ *** Parameters: ***
4
+ {}
5
+ *** Markdown input: ***
6
+ <style type="text/css">
7
+ p > .highlight {
8
+ color: red;
9
+ background-image: url('/foo?bar&baz');
10
+ }
11
+ </style>
12
+
13
+ <style type="text/css">/*<![CDATA[*/
14
+ p > .highlight {
15
+ color: red;
16
+ background-image: url('/foo?bar&baz');
17
+ }
18
+ /*]]>*/</style>
19
+
20
+ <style type="text/css">
21
+ /*<![CDATA[*/
22
+ p > .highlight {
23
+ color: red;
24
+ background-image: url('/foo?bar&baz');
25
+ }
26
+ /*]]>*/
27
+ </style>
28
+ *** Output of inspect ***
29
+
30
+ *** Output of to_html ***
31
+ <style type='text/css'>/*<![CDATA[*/
32
+ p > .highlight {
33
+ color: red;
34
+ background-image: url('/foo?bar&baz');
35
+ }
36
+ /*]]>*/</style><style type='text/css'>/*<![CDATA[*/
37
+ p > .highlight {
38
+ color: red;
39
+ background-image: url('/foo?bar&baz');
40
+ }
41
+ /*]]>*/</style><style type='text/css'>
42
+ /*<![CDATA[*/
43
+ p > .highlight {
44
+ color: red;
45
+ background-image: url('/foo?bar&baz');
46
+ }
47
+ /*]]>*/
48
+ </style>
@@ -0,0 +1,11 @@
1
+ Handle script tag without a newline. https://github.com/bhollis/maruku/issues/123
2
+ *** Parameters: ***
3
+ { }
4
+ *** Markdown input: ***
5
+ Lets add Jade to our dependencies:
6
+ <script src="https://gist.github.com/7360992.js"> </script>
7
+ *** Output of inspect ***
8
+
9
+ *** Output of to_html ***
10
+ <p>Lets add Jade to our dependencies:</p>
11
+ <script src='https://gist.github.com/7360992.js'> </script>
@@ -0,0 +1,16 @@
1
+ Handle blocks of inline HTML without a newline without complaining. https://github.com/bhollis/maruku/issues/124
2
+ *** Parameters: ***
3
+ {:on_error => :raise}
4
+ *** Markdown input: ***
5
+ What follows uses ruby
6
+ <ruby>
7
+ <rb>東</rb><rp>(</rp><rt>トウ</rt><rp>)</rp>
8
+ <rb>京</rb><rp>(</rp><rt>キョウ</rt><rp>)</rp>
9
+ </ruby>.
10
+ *** Output of inspect ***
11
+
12
+ *** Output of to_html ***
13
+ <p>What follows uses ruby <ruby>
14
+ <rb>東</rb><rp>(</rp><rt>トウ</rt><rp>)</rp>
15
+ <rb>京</rb><rp>(</rp><rt>キョウ</rt><rp>)</rp>
16
+ </ruby>.</p>
@@ -20,21 +20,33 @@ NOTE: CDATA is output because we use XHTML - for HTML mode it should be omitted.
20
20
  var x = true && true;
21
21
  ]]>
22
22
  </script>
23
- *** Output of inspect ***
24
23
 
25
- *** Output of to_html ***
26
- <script><![CDATA[
24
+ <script>//<![CDATA[
27
25
  var x = true && true;
28
- ]]></script>
29
-
30
- <script><![CDATA[foo && bar]]></script>
26
+ //]]></script>
31
27
 
32
- <script><![CDATA[
28
+ <script>
29
+ //<![CDATA[
33
30
  var x = true && true;
34
- ]]></script>
35
-
36
- <script><![CDATA[foo && bar]]></script>
31
+ //]]>
32
+ </script>
33
+ *** Output of inspect ***
37
34
 
38
- <script><![CDATA[
35
+ *** Output of to_html ***
36
+ <script>//<![CDATA[
39
37
  var x = true && true;
40
- ]]></script>
38
+ //]]></script><script>//<![CDATA[
39
+ foo && bar
40
+ //]]></script><script><![CDATA[
41
+ var x = true && true;
42
+ ]]></script><script><![CDATA[foo && bar]]></script><script>
43
+ <![CDATA[
44
+ var x = true && true;
45
+ ]]>
46
+ </script><script>//<![CDATA[
47
+ var x = true && true;
48
+ //]]></script><script>
49
+ //<![CDATA[
50
+ var x = true && true;
51
+ //]]>
52
+ </script>
@@ -6,7 +6,7 @@ https://github.com/bhollis/maruku/issues/89 - Markdown extra .class ALD parsing
6
6
  [![Alt text](/Understanding-Big-Data-Cover-201x300.jpg){.alignright}](http://testsite.com/big-data)
7
7
 
8
8
  *** Output of inspect ***
9
- md_el(:document,
9
+ md_el(:document,
10
10
  md_par(md_im_link(md_im_image("Alt text", "/Understanding-Big-Data-Cover-201x300.jpg", nil, [[:class, "alignright"]]), "http://testsite.com/big-data", nil)))
11
11
  *** Output of to_html ***
12
12
  <p><a href="http://testsite.com/big-data"><img class="alignright" src="/Understanding-Big-Data-Cover-201x300.jpg" alt="Alt text" /></a></p>
@@ -1,4 +1,4 @@
1
- PENDING - Nesting lists should handle newlines inbetween list items.
1
+ Nesting lists should handle newlines inbetween list items.
2
2
  *** Parameters: ***
3
3
  {} # params
4
4
  *** Markdown input: ***
@@ -9,20 +9,26 @@ PENDING - Nesting lists should handle newlines inbetween list items.
9
9
  *** Output of inspect ***
10
10
  md_el(:document, md_el(:ul, [
11
11
  md_li([
12
- "Bar",
12
+ md_par("Bar"),
13
13
  md_el(:ul, [
14
- md_li(md_par("Bax"), false),
15
- md_li(md_par("Bar"), false)
14
+ md_li(md_par("Bax"), true),
15
+ md_li(md_par("boo"), false)
16
16
  ], {}, [])
17
- ],{},[])
17
+ ],true)
18
18
  ],{},[]))
19
19
  *** Output of to_html ***
20
20
  <ul>
21
- <li>Bar
21
+ <li>
22
+ <p>Bar</p>
22
23
 
23
24
  <ul>
24
- <li><p>Bax</p></li>
25
- <li><p>boo</p></li>
25
+ <li>
26
+ <p>Bax</p>
27
+ </li>
28
+
29
+ <li>
30
+ <p>boo</p>
31
+ </li>
26
32
  </ul>
27
33
  </li>
28
34
  </ul>
@@ -145,7 +145,7 @@ md_el(:document,[
145
145
  <li>
146
146
  <p>This is a list item with two paragraphs.</p>
147
147
 
148
- <p>This is the second paragraph in the list item. You&#8217;re only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
148
+ <p>This is the second paragraph in the list item. Youre only required to indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
149
149
  </li>
150
150
 
151
151
  <li>
@@ -225,7 +225,7 @@ This is the second paragraph in the list item. You're only required to indent th
225
225
 
226
226
  Ancora
227
227
 
228
- 1.
228
+ 1.
229
229
  This is a list item with two
230
230
  paragraphs. Lorem ipsum dolor sit amet,
231
231
  consectetuer adipiscing elit. Aliquam
@@ -233,18 +233,18 @@ Ancora
233
233
  ATTENZIONE!
234
234
  - Uno
235
235
  - Due
236
-
236
+
237
237
  1. tre
238
238
  2. tre
239
239
  3. tre
240
240
  - Due
241
- 2.
241
+ 2.
242
242
  Suspendisse id sem consectetuer libero
243
243
  luctus adipiscing.
244
244
 
245
245
  Ancora
246
246
 
247
- -
247
+ -
248
248
  This is a list item with two
249
249
  paragraphs.
250
250
  This is the second paragraph in the
@@ -1,4 +1,4 @@
1
- PENDING - Indentation is weird...
1
+ Indentation is weird...
2
2
  *** Parameters: ***
3
3
  {} # params
4
4
  *** Markdown input: ***
@@ -17,27 +17,22 @@ md_el(:document, md_el(:ul, [
17
17
  md_li([
18
18
  "Bar",
19
19
  md_el(:ul, [
20
- md_el(:li_span, "Bax", {:want_my_paragraph=>false}),
21
- md_el(:li_span, "Bap", {:want_my_paragraph=>false})
20
+ md_li("Bax Bap", false)
22
21
  ])
23
- ], true)
22
+ ], false)
24
23
  ])
25
- ], true),
26
- md_li(md_par("Another list item"), false)
24
+ ], false),
25
+ md_li("Another list item", false)
27
26
  ]))
28
27
  *** Output of to_html ***
29
28
  <ul>
30
29
  <li>A list item
31
-
32
30
  <ul>
33
31
  <li>Foo</li>
34
32
 
35
33
  <li>Bar
36
-
37
34
  <ul>
38
- <li>Bax</li>
39
-
40
- <li>Bap</li>
35
+ <li>Bax Bap</li>
41
36
  </ul>
42
37
  </li>
43
38
  </ul>
@@ -5,26 +5,25 @@ require 'maruku/ext/math';{:html_math_engine => 'blahtex'}
5
5
 
6
6
  $$ x = y $$
7
7
 
8
- $$ x
8
+ $$ x
9
9
  = y $$
10
10
 
11
- $$
11
+ $$
12
12
  x = y $$
13
13
 
14
- $$ x = y
14
+ $$ x = y
15
15
  $$
16
16
 
17
17
  *** Output of inspect ***
18
18
 
19
19
  *** Output of to_html ***
20
- <div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml">
21
- <mrow><mi>x</mi><mo lspace="0.278em" rspace="0.278em">=</mo><mi>y</mi></mrow>
22
- </math><span class="maruku-eq-tex"><code style="display: none">x = y</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml">
23
- <mrow><mi>x</mi><mo lspace="0.278em" rspace="0.278em">=</mo><mi>y</mi></mrow>
24
- </math><span class="maruku-eq-tex"><code style="display: none">x
25
- = y</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml">
26
- <mrow><mi>x</mi><mo lspace="0.278em" rspace="0.278em">=</mo><mi>y</mi></mrow>
27
- </math><span class="maruku-eq-tex"><code style="display: none">x = y</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml">
28
- <mrow><mi>x</mi><mo lspace="0.278em" rspace="0.278em">=</mo><mi>y</mi></mrow>
29
- </math><span class="maruku-eq-tex"><code style="display: none">x = y</code></span></div>
20
+ <div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
21
+ <mrow><mi>x</mi><mo lspace='0.278em' rspace='0.278em'>=</mo><mi>y</mi></mrow>
22
+ </math></div><div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
23
+ <mrow><mi>x</mi><mo lspace='0.278em' rspace='0.278em'>=</mo><mi>y</mi></mrow>
24
+ </math></div><div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
25
+ <mrow><mi>x</mi><mo lspace='0.278em' rspace='0.278em'>=</mo><mi>y</mi></mrow>
26
+ </math></div><div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
27
+ <mrow><mi>x</mi><mo lspace='0.278em' rspace='0.278em'>=</mo><mi>y</mi></mrow>
28
+ </math></div>
30
29
  *** Output of to_latex ***
@@ -25,7 +25,15 @@ md_el(:document,[
25
25
  md_el(:equation,[],{:label=>nil,:math=>" \\gamma ",:num=>nil},[])
26
26
  ],{},[])
27
27
  *** Output of to_html ***
28
- <div class="maruku-equation" id="eq:eq1"><span class="maruku-eq-number">(1)</span><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>α</mi></math><span class="maruku-eq-tex"><code style="display: none">\alpha</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>α</mi></math><span class="maruku-eq-tex"><code style="display: none">\alpha</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>β</mi></math><span class="maruku-eq-tex"><code style="display: none">\beta</code></span></div><div class="maruku-equation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="maruku-mathml"><mi>γ</mi></math><span class="maruku-eq-tex"><code style="display: none">\gamma</code></span></div>
28
+ <div class="maruku-equation" id="eq:eq1"><span class="maruku-eq-number">(1)</span><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
29
+ <mi>&#x3b1;</mi>
30
+ </math></div><div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
31
+ <mi>&#x3b1;</mi>
32
+ </math></div><div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
33
+ <mi>&#x3b2;</mi>
34
+ </math></div><div class="maruku-equation"><math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
35
+ <mi>&#x3b3;</mi>
36
+ </math></div>
29
37
  *** Output of to_latex ***
30
38
  \begin{equation}
31
39
  \alpha
@@ -42,4 +50,3 @@ md_el(:document,[
42
50
  *** Output of to_md ***
43
51
 
44
52
  *** Output of to_s ***
45
-