maruku 0.2.13 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/bin/maruku +23 -15
  2. data/bin/maruku0.3 +37 -0
  3. data/bin/marutest +277 -0
  4. data/docs/changelog-0.3.html +99 -0
  5. data/docs/changelog-0.3.md +84 -0
  6. data/docs/faq.html +46 -0
  7. data/docs/faq.md +32 -0
  8. data/docs/index.html +629 -64
  9. data/docs/markdown_extra2.html +67 -14
  10. data/docs/markdown_syntax.html +631 -94
  11. data/docs/markdown_syntax_2.html +152 -0
  12. data/docs/maruku.html +629 -64
  13. data/docs/maruku.md +108 -105
  14. data/docs/proposal.html +362 -55
  15. data/docs/proposal.md +133 -169
  16. data/docs/todo.html +30 -0
  17. data/lib/maruku.rb +13 -3
  18. data/lib/maruku/errors_management.rb +75 -0
  19. data/lib/maruku/helpers.rb +164 -0
  20. data/lib/maruku/html_helper.rb +33 -13
  21. data/lib/maruku/parse_block.rb +89 -92
  22. data/lib/maruku/parse_doc.rb +43 -18
  23. data/lib/maruku/parse_span.rb +17 -46
  24. data/lib/maruku/parse_span_better.rb +681 -0
  25. data/lib/maruku/string_utils.rb +17 -10
  26. data/lib/maruku/structures.rb +62 -35
  27. data/lib/maruku/structures_iterators.rb +39 -0
  28. data/lib/maruku/tests/benchmark.rb +12 -4
  29. data/lib/maruku/tests/new_parser.rb +318 -0
  30. data/lib/maruku/to_html.rb +113 -44
  31. data/lib/maruku/to_latex.rb +32 -14
  32. data/lib/maruku/to_markdown.rb +110 -0
  33. data/lib/maruku/toc.rb +35 -1
  34. data/lib/maruku/version.rb +10 -1
  35. data/lib/test.rb +29 -0
  36. data/tests/others/escaping.md +6 -4
  37. data/tests/others/links.md +1 -1
  38. data/tests/others/lists_after_paragraph.md +44 -0
  39. data/tests/unittest/abbreviations.md +71 -0
  40. data/tests/unittest/blank.md +43 -0
  41. data/tests/unittest/blanks_in_code.md +131 -0
  42. data/tests/unittest/code.md +64 -0
  43. data/tests/unittest/code2.md +59 -0
  44. data/tests/unittest/code3.md +121 -0
  45. data/tests/unittest/easy.md +36 -0
  46. data/tests/unittest/email.md +39 -0
  47. data/tests/unittest/encoding/iso-8859-1.md +9 -0
  48. data/tests/unittest/encoding/utf-8.md +38 -0
  49. data/tests/unittest/entities.md +174 -0
  50. data/tests/unittest/escaping.md +97 -0
  51. data/tests/unittest/extra_dl.md +81 -0
  52. data/tests/unittest/extra_header_id.md +96 -0
  53. data/tests/unittest/extra_table1.md +78 -0
  54. data/tests/unittest/footnotes.md +120 -0
  55. data/tests/unittest/headers.md +64 -0
  56. data/tests/unittest/hrule.md +77 -0
  57. data/tests/unittest/images.md +114 -0
  58. data/tests/unittest/inline_html.md +185 -0
  59. data/tests/unittest/links.md +162 -0
  60. data/tests/unittest/list1.md +80 -0
  61. data/tests/unittest/list2.md +75 -0
  62. data/tests/unittest/list3.md +111 -0
  63. data/tests/unittest/list4.md +43 -0
  64. data/tests/unittest/lists.md +262 -0
  65. data/tests/unittest/lists_after_paragraph.md +280 -0
  66. data/tests/unittest/lists_ol.md +323 -0
  67. data/tests/unittest/misc_sw.md +751 -0
  68. data/tests/unittest/notyet/escape.md +46 -0
  69. data/tests/unittest/notyet/header_after_par.md +85 -0
  70. data/tests/unittest/notyet/ticks.md +67 -0
  71. data/tests/unittest/notyet/triggering.md +210 -0
  72. data/tests/unittest/one.md +33 -0
  73. data/tests/unittest/paragraph.md +34 -0
  74. data/tests/unittest/paragraph_rules/dont_merge_ref.md +60 -0
  75. data/tests/unittest/paragraph_rules/tab_is_blank.md +43 -0
  76. data/tests/unittest/paragraphs.md +84 -0
  77. data/tests/unittest/recover/recover_links.md +32 -0
  78. data/tests/unittest/references/long_example.md +87 -0
  79. data/tests/unittest/references/spaces_and_numbers.md +27 -0
  80. data/tests/unittest/syntax_hl.md +99 -0
  81. data/tests/unittest/test.md +36 -0
  82. data/tests/unittest/wrapping.md +88 -0
  83. data/tests/utf8-files/simple.md +1 -0
  84. metadata +139 -86
  85. data/lib/maruku/maruku.rb +0 -50
  86. data/tests/a.md +0 -10
@@ -0,0 +1,97 @@
1
+ This should threat the last as a literal asterisk.
2
+ *** Parameters: ***
3
+ {:on_error=>:warning}
4
+ *** Markdown input: ***
5
+ Hello: ! \! \` \{ \} \[ \] \( \) \# \. \! * \* *
6
+
7
+
8
+ Ora, *emphasis*, **bold**, * <- due asterischi-> * , un underscore-> _ , _emphasis_,
9
+ incre*dible*e!
10
+
11
+ This is ``Code with a special: -> ` <- ``(after)
12
+
13
+ `Start ` of paragraph
14
+
15
+ End of `paragraph `
16
+ *** Output of inspect ***
17
+ md_el(:document,[
18
+ md_par([" Hello: ! ! ` { } [ ] ( ) # . ! * * *"]),
19
+ md_par([
20
+ "Ora, ",
21
+ md_em(["emphasis"]),
22
+ ", ",
23
+ md_strong(["bold"]),
24
+ ", * <- due asterischi-> * , un underscore-> _ , ",
25
+ md_em(["emphasis"]),
26
+ ", incre",
27
+ md_em(["dible"]),
28
+ "e!"
29
+ ]),
30
+ md_par(["This is ", md_code("Code with a special: -> ` <-"), "(after)"]),
31
+ md_par([md_code("Start "), " of paragraph"]),
32
+ md_par(["End of ", md_code("paragraph ")])
33
+ ] , {:on_error=>:warning})
34
+ *** Output of to_html ***
35
+
36
+ <p> Hello: ! ! ` { } [ ] ( ) # . ! * * *</p>
37
+
38
+ <p>Ora, <em>emphasis</em>, <strong>bold</strong>, * &lt;- due asterischi-&gt; * , un underscore-&gt; _ , <em>emphasis</em>, incre<em>dible</em>e!</p>
39
+
40
+ <p>This is <code>Code with a special: -&gt; ` &lt;-</code>(after)</p>
41
+
42
+ <p><code>Start </code> of paragraph</p>
43
+
44
+ <p>End of <code>paragraph </code></p>
45
+
46
+ *** Output of to_latex ***
47
+ Hello: ! ! ` \{ \} [ ] ( ) \# . ! * * *
48
+
49
+ Ora, {\em emphasis}, {\bf bold}, * {\tt \char60}- due asterischi-{\tt \char62} * , un underscore-{\tt \char62} \_ , {\em emphasis}, incre{\em dible}e!
50
+
51
+ This is \colorbox[rgb]{0.94,0.94,0.88}{\tt \char67\char111\char100\char101\char32\char119\char105\char116\char104\char32\char97\char32\char115\char112\char101\char99\char105\char97\char108\char58\char32\char45\char62\char32\char96\char32\char60\char45}(after)
52
+
53
+ \colorbox[rgb]{0.94,0.94,0.88}{\tt \char83\char116\char97\char114\char116\char32} of paragraph
54
+
55
+ End of \colorbox[rgb]{0.94,0.94,0.88}{\tt \char112\char97\char114\char97\char103\char114\char97\char112\char104\char32}
56
+
57
+
58
+ *** Output of to_s ***
59
+ Hello: ! ! ` { } [ ] ( ) # . ! * * *Ora, emphasis, bold, * <- due asterischi-> * , un underscore-> _ , emphasis, incrediblee!This is (after) of paragraphEnd of
60
+ *** Output of to_s ***
61
+ Hello: ! ! ` { } [ ] ( ) # . ! * * *Ora, emphasis, bold, * <- due asterischi-> * , un underscore-> _ , emphasis, incrediblee!This is (after) of paragraphEnd of
62
+ *** EOF ***
63
+
64
+
65
+
66
+ OK!
67
+
68
+
69
+
70
+ *** Output of Markdown.pl ***
71
+ <p>Hello: ! ! ` { } [ ] ( ) # . ! * * *</p>
72
+
73
+ <p>Ora, <em>emphasis</em>, <strong>bold</strong>, * &lt;- due asterischi-> * , un underscore-> _ , <em>emphasis</em>,
74
+ incre<em>dible</em>e!</p>
75
+
76
+ <p>This is <code>Code with a special: -&gt; ` &lt;-</code>(after)</p>
77
+
78
+ <p><code>Start</code> of paragraph</p>
79
+
80
+ <p>End of <code>paragraph</code></p>
81
+
82
+ *** Output of Markdown.pl (parsed) ***
83
+ <p>Hello: ! ! ` { } [ ] ( ) # . ! * * *</p
84
+ ><p>Ora, <em>emphasis</em
85
+ >, <strong>bold</strong
86
+ >, * &lt;- due asterischi-> * , un underscore-> _ , <em>emphasis</em
87
+ >,
88
+ incre<em>dible</em
89
+ >e!</p
90
+ ><p>This is <code>Code with a special: -&gt; ` &lt;-</code
91
+ >(after)</p
92
+ ><p
93
+ ><code>Start</code
94
+ > of paragraph</p
95
+ ><p>End of <code>paragraph</code
96
+ ></p
97
+ >
@@ -0,0 +1,81 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {:css=>"style.css"}
4
+ *** Markdown input: ***
5
+ CSS: style.css
6
+
7
+
8
+ Apple
9
+ : Pomaceous fruit of plants of the genus Malus in
10
+ the family Rosaceae.
11
+
12
+ Orange
13
+ : The fruit of an evergreen tree of the genus Citrus.
14
+
15
+ *** Output of inspect ***
16
+ md_el(:document,[
17
+ md_el(:definition_list,[
18
+ md_el(:definition,[
19
+ md_el(:definition_term,["Apple"] ),
20
+ md_el(:definition_data,[
21
+ "Pomaceous fruit of plants of the genus Malus in the family Rosaceae."
22
+ ] )
23
+ ] , {:definitions=>[md_el(:definition_data,[
24
+ "Pomaceous fruit of plants of the genus Malus in the family Rosaceae."
25
+ ] )], :want_my_paragraph=>false, :terms=>[md_el(:definition_term,["Apple"] )]}),
26
+ md_el(:definition,[
27
+ md_el(:definition_term,["Orange"] ),
28
+ md_el(:definition_data,["The fruit of an evergreen tree of the genus Citrus."] )
29
+ ] , {:definitions=>[md_el(:definition_data,["The fruit of an evergreen tree of the genus Citrus."] )], :want_my_paragraph=>false, :terms=>[md_el(:definition_term,["Orange"] )]})
30
+ ] )
31
+ ] , {:css=>"style.css"})
32
+ *** Output of to_html ***
33
+
34
+ <dl>
35
+ <dt>Apple</dt>
36
+
37
+ <dd>Pomaceous fruit of plants of the genus Malus in the family Rosaceae.</dd>
38
+
39
+ <dt>Orange</dt>
40
+
41
+ <dd>The fruit of an evergreen tree of the genus Citrus.</dd>
42
+ </dl>
43
+
44
+ *** Output of to_latex ***
45
+ \begin{description}
46
+
47
+ \item[Apple] Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
48
+
49
+ \item[Orange] The fruit of an evergreen tree of the genus Citrus.
50
+ \end{description}
51
+
52
+ *** Output of to_s ***
53
+ ApplePomaceous fruit of plants of the genus Malus in the family Rosaceae.OrangeThe fruit of an evergreen tree of the genus Citrus.
54
+ *** Output of to_s ***
55
+ ApplePomaceous fruit of plants of the genus Malus in the family Rosaceae.OrangeThe fruit of an evergreen tree of the genus Citrus.
56
+ *** EOF ***
57
+
58
+
59
+
60
+ OK!
61
+
62
+
63
+
64
+ *** Output of Markdown.pl ***
65
+ <p>CSS: style.css</p>
66
+
67
+ <p>Apple
68
+ : Pomaceous fruit of plants of the genus Malus in
69
+ the family Rosaceae.</p>
70
+
71
+ <p>Orange
72
+ : The fruit of an evergreen tree of the genus Citrus.</p>
73
+
74
+ *** Output of Markdown.pl (parsed) ***
75
+ <p>CSS: style.css</p
76
+ ><p>Apple
77
+ : Pomaceous fruit of plants of the genus Malus in
78
+ the family Rosaceae.</p
79
+ ><p>Orange
80
+ : The fruit of an evergreen tree of the genus Citrus.</p
81
+ >
@@ -0,0 +1,96 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {:title=>"Header 1"}
4
+ *** Markdown input: ***
5
+ Header 1 {#header1}
6
+ ========
7
+
8
+ Header 2 {#header2}
9
+ --------
10
+
11
+ ### Header 3 ### {#header3}
12
+
13
+ Then you can create links to different parts of the same document like this:
14
+
15
+ [Link back to header 1](#header1),
16
+ [Link back to header 2](#header2),
17
+ [Link back to header 3](#header3)
18
+
19
+ *** Output of inspect ***
20
+ md_el(:document,[
21
+ md_el(:header,["Header 1"] , {:id=>"header1", :level=>1}),
22
+ md_el(:header,["Header 2"] , {:id=>"header2", :level=>2}),
23
+ md_el(:header,["Header 3"] , {:id=>"header3", :level=>3}),
24
+ md_par([
25
+ "Then you can create links to different parts of the same document like this:"
26
+ ]),
27
+ md_par([
28
+ md_im_link(["Link back to header 1"], "#header1" ),
29
+ ", ",
30
+ md_im_link(["Link back to header 2"], "#header2" ),
31
+ ", ",
32
+ md_im_link(["Link back to header 3"], "#header3" )
33
+ ])
34
+ ] , {:title=>"Header 1"})
35
+ *** Output of to_html ***
36
+
37
+ <h1 id='header1'>Header 1</h1>
38
+
39
+ <h2 id='header2'>Header 2</h2>
40
+
41
+ <h3 id='header3'>Header 3</h3>
42
+
43
+ <p>Then you can create links to different parts of the same document like this:</p>
44
+
45
+ <p><a href='#header1'>Link back to header 1</a>, <a href='#header2'>Link back to header 2</a>, <a href='#header3'>Link back to header 3</a></p>
46
+
47
+ *** Output of to_latex ***
48
+ \hypertarget{header1}{}\section*{{Header 1}}\label{header1}
49
+
50
+ \hypertarget{header2}{}\subsection*{{Header 2}}\label{header2}
51
+
52
+ \hypertarget{header3}{}\subsubsection*{{Header 3}}\label{header3}
53
+
54
+ Then you can create links to different parts of the same document like this:
55
+
56
+ \hyperlink{header1}{Link back to header 1}, \hyperlink{header2}{Link back to header 2}, \hyperlink{header3}{Link back to header 3}
57
+
58
+
59
+ *** Output of to_s ***
60
+ Header 1Header 2Header 3Then you can create links to different parts of the same document like this:Link back to header 1, Link back to header 2, Link back to header 3
61
+ *** Output of to_s ***
62
+ Header 1Header 2Header 3Then you can create links to different parts of the same document like this:Link back to header 1, Link back to header 2, Link back to header 3
63
+ *** EOF ***
64
+
65
+
66
+
67
+ OK!
68
+
69
+
70
+
71
+ *** Output of Markdown.pl ***
72
+ <h1>Header 1 {#header1}</h1>
73
+
74
+ <h2>Header 2 {#header2}</h2>
75
+
76
+ <h3>Header 3 ### {#header3}</h3>
77
+
78
+ <p>Then you can create links to different parts of the same document like this:</p>
79
+
80
+ <p><a href="#header1">Link back to header 1</a>,
81
+ <a href="#header2">Link back to header 2</a>,
82
+ <a href="#header3">Link back to header 3</a></p>
83
+
84
+ *** Output of Markdown.pl (parsed) ***
85
+ <h1>Header 1 {#header1}</h1
86
+ ><h2>Header 2 {#header2}</h2
87
+ ><h3>Header 3 ### {#header3}</h3
88
+ ><p>Then you can create links to different parts of the same document like this:</p
89
+ ><p
90
+ ><a href='#header1'>Link back to header 1</a
91
+ >,
92
+ <a href='#header2'>Link back to header 2</a
93
+ >,
94
+ <a href='#header3'>Link back to header 3</a
95
+ ></p
96
+ >
@@ -0,0 +1,78 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {:css=>"style.css"}
4
+ *** Markdown input: ***
5
+ CSS: style.css
6
+
7
+ First Header | Second Header
8
+ ------------- | -------------
9
+ Content Cell | Content Cell
10
+ Content Cell | Content Cell
11
+
12
+ *** Output of inspect ***
13
+ md_el(:document,[
14
+ md_el(:table,[
15
+ md_el(:head_cell,["First Header"] ),
16
+ md_el(:head_cell,["Second Header"] ),
17
+ md_el(:cell,["Content Cell"] ),
18
+ md_el(:cell,["Content Cell"] ),
19
+ md_el(:cell,["Content Cell"] ),
20
+ md_el(:cell,["Content Cell"] )
21
+ ] , {:align=>[:left, :left]})
22
+ ] , {:css=>"style.css"})
23
+ *** Output of to_html ***
24
+
25
+ <table>
26
+ <thead>
27
+ <tr><th>First Header</th><th>Second Header</th></tr>
28
+ </thead>
29
+ <tbody>
30
+ <tr>
31
+ <td style='text-align: left;'>Content Cell</td>
32
+
33
+ <td style='text-align: left;'>Content Cell</td>
34
+ </tr>
35
+
36
+ <tr>
37
+ <td style='text-align: left;'>Content Cell</td>
38
+
39
+ <td style='text-align: left;'>Content Cell</td>
40
+ </tr>
41
+ </tbody></table>
42
+
43
+ *** Output of to_latex ***
44
+ \begin{tabular}{l|l}
45
+ First Header&Second Header\\
46
+ \hline
47
+ Content Cell&Content Cell\\
48
+ Content Cell&Content Cell\\
49
+ \end{tabular}
50
+
51
+
52
+ *** Output of to_s ***
53
+ First HeaderSecond HeaderContent CellContent CellContent CellContent Cell
54
+ *** Output of to_s ***
55
+ First HeaderSecond HeaderContent CellContent CellContent CellContent Cell
56
+ *** EOF ***
57
+
58
+
59
+
60
+ OK!
61
+
62
+
63
+
64
+ *** Output of Markdown.pl ***
65
+ <p>CSS: style.css</p>
66
+
67
+ <p>First Header | Second Header
68
+ ------------- | -------------
69
+ Content Cell | Content Cell
70
+ Content Cell | Content Cell</p>
71
+
72
+ *** Output of Markdown.pl (parsed) ***
73
+ <p>CSS: style.css</p
74
+ ><p>First Header | Second Header
75
+ ------------- | -------------
76
+ Content Cell | Content Cell
77
+ Content Cell | Content Cell</p
78
+ >
@@ -0,0 +1,120 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {:footnotes_used=>["^b", "^c", "^a"]}
4
+ *** Markdown input: ***
5
+ That's some text with a footnote [^b] and another [^c] and another [^a].
6
+
7
+ [^a]: And that's the footnote.
8
+
9
+ That's the second paragraph of the footnote.
10
+
11
+
12
+ [^b]: And that's the footnote.
13
+ This is second sentence (same paragraph).
14
+
15
+ [^c]:
16
+ This is the very long one.
17
+
18
+ That's the second paragraph.
19
+
20
+
21
+ This is not a footnote.
22
+ *** Output of inspect ***
23
+ md_el(:document,[
24
+ md_par([
25
+ "That's some text with a footnote ",
26
+ md_foot_ref("^b"),
27
+ " and another ",
28
+ md_foot_ref("^c"),
29
+ " and another ",
30
+ md_foot_ref("^a"),
31
+ "."
32
+ ]),
33
+ md_par(["This is not a footnote."])
34
+ ] )
35
+ *** Output of to_html ***
36
+
37
+ <p>That&apos;s some text with a footnote <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup> and another <sup id='fnref:2'><a href='#fn:2' rel='footnote'>2</a></sup> and another <sup id='fnref:3'><a href='#fn:3' rel='footnote'>3</a></sup>.</p>
38
+
39
+ <p>This is not a footnote.</p>
40
+
41
+ <div class='footnotes'>
42
+ <hr />
43
+
44
+ <ol>
45
+ <li id='fn:1'>
46
+ <p>And that&apos;s the footnote. This is second sentence (same paragraph)<a href='#fnref:1' rev='footnote'>&#8617;</a></p>
47
+ </li>
48
+
49
+ <li id='fn:2'>
50
+ <p>This is the very long one.</p>
51
+
52
+ <p>That&apos;s the second paragraph.<a href='#fnref:2' rev='footnote'>&#8617;</a></p>
53
+ </li>
54
+
55
+ <li id='fn:3'>
56
+ <p>And that&apos;s the footnote.</p>
57
+
58
+ <p>That&apos;s the second paragraph of the footnote.<a href='#fnref:3' rev='footnote'>&#8617;</a></p>
59
+ </li>
60
+ </ol>
61
+ </div>
62
+
63
+ *** Output of to_latex ***
64
+ That's some text with a footnote \footnote{And that's the footnote. This is second sentence (same paragraph)} and another \footnote{This is the very long one.
65
+
66
+ That's the second paragraph.} and another \footnote{And that's the footnote.
67
+
68
+ That's the second paragraph of the footnote.} .
69
+
70
+ This is not a footnote.
71
+
72
+
73
+ *** Output of to_s ***
74
+ That's some text with a footnote and another and another .This is not a footnote.
75
+ *** Output of to_s ***
76
+ That's some text with a footnote and another and another .This is not a footnote.
77
+ *** EOF ***
78
+
79
+
80
+
81
+ OK!
82
+
83
+
84
+
85
+ *** Output of Markdown.pl ***
86
+ <p>That's some text with a footnote [^b] and another [^c] and another [^a].</p>
87
+
88
+ <p>[^a]: And that's the footnote.</p>
89
+
90
+ <pre><code>That's the second paragraph of the footnote.
91
+ </code></pre>
92
+
93
+ <p>[^b]: And that's the footnote.
94
+ This is second sentence (same paragraph).</p>
95
+
96
+ <p>[^c]:
97
+ This is the very long one.</p>
98
+
99
+ <pre><code>That's the second paragraph.
100
+ </code></pre>
101
+
102
+ <p>This is not a footnote.</p>
103
+
104
+ *** Output of Markdown.pl (parsed) ***
105
+ <p>That's some text with a footnote [^b] and another [^c] and another [^a].</p
106
+ ><p>[^a]: And that's the footnote.</p
107
+ ><pre
108
+ ><code>That's the second paragraph of the footnote.
109
+ </code
110
+ ></pre
111
+ ><p>[^b]: And that's the footnote.
112
+ This is second sentence (same paragraph).</p
113
+ ><p>[^c]:
114
+ This is the very long one.</p
115
+ ><pre
116
+ ><code>That's the second paragraph.
117
+ </code
118
+ ></pre
119
+ ><p>This is not a footnote.</p
120
+ >