maruku 0.2.13 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,60 @@
1
+ Paragraphs eats everything, but not link definitions.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ Paragraph
6
+ [google1]: #
7
+
8
+ Paragraph
9
+ [google2]: #
10
+
11
+ Paragraph
12
+ [google3]: #
13
+
14
+ *** Output of inspect ***
15
+ md_el(:document,[
16
+ md_par(["Paragraph"]),
17
+ md_ref_def("google1", "#" ,{:title=>nil}),
18
+ md_par(["Paragraph"]),
19
+ md_ref_def("google2", "#" ,{:title=>nil}),
20
+ md_par(["Paragraph"]),
21
+ md_ref_def("google3", "#" ,{:title=>nil})
22
+ ] )
23
+ *** Output of to_html ***
24
+
25
+ <p>Paragraph</p>
26
+
27
+ <p>Paragraph</p>
28
+
29
+ <p>Paragraph</p>
30
+
31
+ *** Output of to_latex ***
32
+ Paragraph
33
+
34
+ Paragraph
35
+
36
+ Paragraph
37
+
38
+
39
+ *** Output of to_s ***
40
+ ParagraphParagraphParagraph
41
+ *** Output of to_s ***
42
+ ParagraphParagraphParagraph
43
+ *** EOF ***
44
+
45
+
46
+
47
+ OK!
48
+
49
+
50
+
51
+ *** Output of Markdown.pl ***
52
+ <p>Paragraph
53
+ Paragraph
54
+ Paragraph</p>
55
+
56
+ *** Output of Markdown.pl (parsed) ***
57
+ <p>Paragraph
58
+ Paragraph
59
+ Paragraph</p
60
+ >
@@ -0,0 +1,43 @@
1
+ Paragraphs eat blank lines.
2
+ The following are two paragraphs:
3
+ *** Parameters: ***
4
+ {}
5
+ *** Markdown input: ***
6
+ Paragraph1
7
+
8
+ Paragraph2
9
+ *** Output of inspect ***
10
+ md_el(:document,[md_par(["Paragraph1"]), md_par(["Paragraph2"])] )
11
+ *** Output of to_html ***
12
+
13
+ <p>Paragraph1</p>
14
+
15
+ <p>Paragraph2</p>
16
+
17
+ *** Output of to_latex ***
18
+ Paragraph1
19
+
20
+ Paragraph2
21
+
22
+
23
+ *** Output of to_s ***
24
+ Paragraph1Paragraph2
25
+ *** Output of to_s ***
26
+ Paragraph1Paragraph2
27
+ *** EOF ***
28
+
29
+
30
+
31
+ OK!
32
+
33
+
34
+
35
+ *** Output of Markdown.pl ***
36
+ <p>Paragraph1</p>
37
+
38
+ <p>Paragraph2</p>
39
+
40
+ *** Output of Markdown.pl (parsed) ***
41
+ <p>Paragraph1</p
42
+ ><p>Paragraph2</p
43
+ >
@@ -0,0 +1,84 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ Paragraph 1
6
+
7
+ Paragraph 2
8
+
9
+
10
+ Paragraph 3
11
+ Paragraph 4
12
+ Paragraph Br->
13
+ Paragraph 5
14
+
15
+
16
+
17
+ Escaping: & { } [ ] !
18
+
19
+ *** Output of inspect ***
20
+ md_el(:document,[
21
+ md_par(["Paragraph 1"]),
22
+ md_par(["Paragraph 2"]),
23
+ md_par([
24
+ "Paragraph 3 Paragraph 4 Paragraph Br->",
25
+ md_el(:linebreak,[] ),
26
+ "Paragraph 5"
27
+ ]),
28
+ md_par(["Escaping: & { } ! "])
29
+ ] )
30
+ *** Output of to_html ***
31
+
32
+ <p>Paragraph 1</p>
33
+
34
+ <p>Paragraph 2</p>
35
+
36
+ <p>Paragraph 3 Paragraph 4 Paragraph Br-&gt;<br />
37
+ Paragraph 5</p>
38
+
39
+ <p>Escaping: &amp; { } ! </p>
40
+
41
+ *** Output of to_latex ***
42
+ Paragraph 1
43
+
44
+ Paragraph 2
45
+
46
+ Paragraph 3 Paragraph 4 Paragraph Br-{\tt \char62}\linebreak Paragraph 5
47
+
48
+ Escaping: \& \{ \} !
49
+
50
+
51
+ *** Output of to_s ***
52
+ Paragraph 1Paragraph 2Paragraph 3 Paragraph 4 Paragraph Br->Paragraph 5Escaping: & { } !
53
+ *** Output of to_s ***
54
+ Paragraph 1Paragraph 2Paragraph 3 Paragraph 4 Paragraph Br->Paragraph 5Escaping: & { } !
55
+ *** EOF ***
56
+
57
+
58
+
59
+ OK!
60
+
61
+
62
+
63
+ *** Output of Markdown.pl ***
64
+ <p>Paragraph 1</p>
65
+
66
+ <p>Paragraph 2</p>
67
+
68
+ <p>Paragraph 3
69
+ Paragraph 4
70
+ Paragraph Br-> <br />
71
+ Paragraph 5</p>
72
+
73
+ <p>Escaping: &amp; { } [ ] ! </p>
74
+
75
+ *** Output of Markdown.pl (parsed) ***
76
+ <p>Paragraph 1</p
77
+ ><p>Paragraph 2</p
78
+ ><p>Paragraph 3
79
+ Paragraph 4
80
+ Paragraph Br-> <br/
81
+ >
82
+ Paragraph 5</p
83
+ ><p>Escaping: &amp; { } [ ] ! </p
84
+ >
@@ -0,0 +1,32 @@
1
+ This shows how Maruku recovers from parsing errors
2
+ *** Parameters: ***
3
+ {:on_error=>:warning}
4
+ *** Markdown input: ***
5
+ Search on [Google images][ GoOgle search ]
6
+ *** Output of inspect ***
7
+ md_el(:document,[md_par(["Search on Google imagesGoOgle search ]"])] , {:on_error=>:warning})
8
+ *** Output of to_html ***
9
+ <p>Search on Google imagesGoOgle search ]</p
10
+ >
11
+ *** Output of to_latex ***
12
+ Search on Google imagesGoOgle search ]
13
+
14
+
15
+ *** Output of to_s ***
16
+ Search on Google imagesGoOgle search ]
17
+ *** Output of to_md ***
18
+ Search on Google imagesGoOgle search ]
19
+ *** EOF ***
20
+
21
+
22
+
23
+ OK!
24
+
25
+
26
+
27
+ *** Output of Markdown.pl ***
28
+ <p>Search on [Google images][ GoOgle search ]</p>
29
+
30
+ *** Output of Markdown.pl (parsed) ***
31
+ <p>Search on [Google images][ GoOgle search ]</p
32
+ >
@@ -0,0 +1,87 @@
1
+ Taken from the syntax document
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+
6
+ filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
7
+ [Grutatext] [5], and [EtText] [6] -- the single biggest source of
8
+ inspiration for Markdown's syntax is the format of plain text email.
9
+
10
+ [1]: http://docutils.sourceforge.net/mirror/setext.html
11
+ [2]: http://www.aaronsw.com/2002/atx/
12
+ [3]: http://textism.com/tools/textile/
13
+ [4]: http://docutils.sourceforge.net/rst.html
14
+ [5]: http://www.triptico.com/software/grutatxt.html
15
+ [6]: http://ettext.taint.org/doc/
16
+
17
+ To this end, Markdown's syntax is comprised entirely of punctuation
18
+ *** Output of inspect ***
19
+ md_el(:document,[
20
+ md_par([
21
+ "filters -- including ",
22
+ md_link(["Setext"],"1"),
23
+ ", ",
24
+ md_link(["atx"],"2"),
25
+ ", ",
26
+ md_link(["Textile"],"3"),
27
+ ", ",
28
+ md_link(["reStructuredText"],"4"),
29
+ ", ",
30
+ md_link(["Grutatext"],"5"),
31
+ ", and ",
32
+ md_link(["EtText"],"6"),
33
+ " -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email."
34
+ ]),
35
+ md_ref_def("1", "http://docutils.sourceforge.net/mirror/setext.html" ,{:title=>nil}),
36
+ md_ref_def("2", "http://www.aaronsw.com/2002/atx/" ,{:title=>nil}),
37
+ md_ref_def("3", "http://textism.com/tools/textile/" ,{:title=>nil}),
38
+ md_ref_def("4", "http://docutils.sourceforge.net/rst.html" ,{:title=>nil}),
39
+ md_ref_def("5", "http://www.triptico.com/software/grutatxt.html" ,{:title=>nil}),
40
+ md_ref_def("6", "http://ettext.taint.org/doc/" ,{:title=>nil}),
41
+ md_par([
42
+ "To this end, Markdown's syntax is comprised entirely of punctuation"
43
+ ])
44
+ ] )
45
+ *** Output of to_html ***
46
+
47
+ <p>filters -- including <a href='http://docutils.sourceforge.net/mirror/setext.html'>Setext</a>, <a href='http://www.aaronsw.com/2002/atx/'>atx</a>, <a href='http://textism.com/tools/textile/'>Textile</a>, <a href='http://docutils.sourceforge.net/rst.html'>reStructuredText</a>, <a href='http://www.triptico.com/software/grutatxt.html'>Grutatext</a>, and <a href='http://ettext.taint.org/doc/'>EtText</a> -- the single biggest source of inspiration for Markdown&apos;s syntax is the format of plain text email.</p>
48
+
49
+ <p>To this end, Markdown&apos;s syntax is comprised entirely of punctuation</p>
50
+
51
+ *** Output of to_latex ***
52
+ filters -- including \href{http://docutils.sourceforge.net/mirror/setext.html}{Setext}, \href{http://www.aaronsw.com/2002/atx/}{atx}, \href{http://textism.com/tools/textile/}{Textile}, \href{http://docutils.sourceforge.net/rst.html}{reStructuredText}, \href{http://www.triptico.com/software/grutatxt.html}{Grutatext}, and \href{http://ettext.taint.org/doc/}{EtText} -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email.
53
+
54
+ To this end, Markdown's syntax is comprised entirely of punctuation
55
+
56
+
57
+ *** Output of to_s ***
58
+ filters -- including Setext, atx, Textile, reStructuredText, Grutatext, and EtText -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email.To this end, Markdown's syntax is comprised entirely of punctuation
59
+ *** Output of to_s ***
60
+ filters -- including Setext, atx, Textile, reStructuredText, Grutatext, and EtText -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email.To this end, Markdown's syntax is comprised entirely of punctuation
61
+ *** EOF ***
62
+
63
+
64
+
65
+ OK!
66
+
67
+
68
+
69
+ *** Output of Markdown.pl ***
70
+ <p>filters -- including <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a>, <a href="http://www.aaronsw.com/2002/atx/">atx</a>, <a href="http://textism.com/tools/textile/">Textile</a>, <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>,
71
+ <a href="http://www.triptico.com/software/grutatxt.html">Grutatext</a>, and <a href="http://ettext.taint.org/doc/">EtText</a> -- the single biggest source of
72
+ inspiration for Markdown's syntax is the format of plain text email.</p>
73
+
74
+ <p>To this end, Markdown's syntax is comprised entirely of punctuation</p>
75
+
76
+ *** Output of Markdown.pl (parsed) ***
77
+ <p>filters -- including <a href='http://docutils.sourceforge.net/mirror/setext.html'>Setext</a
78
+ >, <a href='http://www.aaronsw.com/2002/atx/'>atx</a
79
+ >, <a href='http://textism.com/tools/textile/'>Textile</a
80
+ >, <a href='http://docutils.sourceforge.net/rst.html'>reStructuredText</a
81
+ >,
82
+ <a href='http://www.triptico.com/software/grutatxt.html'>Grutatext</a
83
+ >, and <a href='http://ettext.taint.org/doc/'>EtText</a
84
+ > -- the single biggest source of
85
+ inspiration for Markdown's syntax is the format of plain text email.</p
86
+ ><p>To this end, Markdown's syntax is comprised entirely of punctuation</p
87
+ >
@@ -0,0 +1,27 @@
1
+ Spaces can be put before. ID can be a number
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ [6]: http://ettext.taint.org/doc/
6
+ *** Output of inspect ***
7
+ md_el(:document,[md_ref_def("6", "http://ettext.taint.org/doc/" ,{:title=>nil})] )
8
+ *** Output of to_html ***
9
+
10
+ *** Output of to_latex ***
11
+
12
+ *** Output of to_s ***
13
+
14
+ *** Output of to_s ***
15
+
16
+ *** EOF ***
17
+
18
+
19
+
20
+ OK!
21
+
22
+
23
+
24
+ *** Output of Markdown.pl ***
25
+
26
+
27
+ *** Output of Markdown.pl (parsed) ***
@@ -0,0 +1,99 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ This is ruby code:
6
+
7
+ require 'maruku'
8
+
9
+ puts Maruku.new($stdin).to_html
10
+
11
+ This is ruby code:
12
+
13
+ @ lang: ruby; html_use_syntax
14
+
15
+ require 'maruku'
16
+
17
+ puts Maruku.new($stdin).to_html
18
+ *** Output of inspect ***
19
+ md_el(:document,[
20
+ md_par(["This is ruby code:"]),
21
+ md_el(:code,[] , {:raw_code=>"require 'maruku'\n\nputs Maruku.new($stdin).to_html\n"}),
22
+ md_par(["This is ruby code:"]),
23
+ md_el(:code,[] , {:raw_code=>"require 'maruku'\n\nputs Maruku.new($stdin).to_html", :lang=>"ruby", :html_use_syntax=>true})
24
+ ] )
25
+ *** Output of to_html ***
26
+
27
+ <p>This is ruby code:</p>
28
+
29
+ <pre><code>require &apos;maruku&apos;
30
+
31
+ puts Maruku.new($stdin).to_html
32
+ </code></pre>
33
+
34
+ <p>This is ruby code:</p>
35
+
36
+ <pre class='ruby'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
37
+
38
+ <span class='ident'>puts</span> <span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='global'>$stdin</span><span class='punct'>).</span><span class='ident'>to_html</span></pre>
39
+
40
+ *** Output of to_latex ***
41
+ This is ruby code:
42
+
43
+ \begin{verbatim}require 'maruku'
44
+
45
+ puts Maruku.new($stdin).to_html
46
+ \end{verbatim}
47
+ This is ruby code:
48
+
49
+ \begin{verbatim}require 'maruku'
50
+
51
+ puts Maruku.new($stdin).to_html\end{verbatim}
52
+
53
+ *** Output of to_s ***
54
+ This is ruby code:This is ruby code:
55
+ *** Output of to_s ***
56
+ This is ruby code:This is ruby code:
57
+ *** EOF ***
58
+
59
+
60
+
61
+ OK!
62
+
63
+
64
+
65
+ *** Output of Markdown.pl ***
66
+ <p>This is ruby code:</p>
67
+
68
+ <pre><code>require 'maruku'
69
+
70
+ puts Maruku.new($stdin).to_html
71
+ </code></pre>
72
+
73
+ <p>This is ruby code:</p>
74
+
75
+ <p>@ lang: ruby; html<em>use</em>syntax</p>
76
+
77
+ <pre><code>require 'maruku'
78
+
79
+ puts Maruku.new($stdin).to_html
80
+ </code></pre>
81
+
82
+ *** Output of Markdown.pl (parsed) ***
83
+ <p>This is ruby code:</p
84
+ ><pre
85
+ ><code>require 'maruku'
86
+
87
+ puts Maruku.new($stdin).to_html
88
+ </code
89
+ ></pre
90
+ ><p>This is ruby code:</p
91
+ ><p>@ lang: ruby; html<em>use</em
92
+ >syntax</p
93
+ ><pre
94
+ ><code>require 'maruku'
95
+
96
+ puts Maruku.new($stdin).to_html
97
+ </code
98
+ ></pre
99
+ >
@@ -0,0 +1,36 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+
6
+ $ python
7
+
8
+
9
+
10
+ *** Output of inspect ***
11
+ md_el(:document,[md_el(:code,[] , {:raw_code=>" $ python "})] )
12
+ *** Output of to_html ***
13
+
14
+ <pre><code> $ python </code></pre>
15
+
16
+ *** Output of to_latex ***
17
+ \begin{verbatim} $ python \end{verbatim}
18
+
19
+ *** Output of to_s ***
20
+
21
+ *** Output of to_s ***
22
+
23
+ *** EOF ***
24
+
25
+
26
+
27
+ OK!
28
+
29
+
30
+
31
+ *** Output of Markdown.pl ***
32
+ <p>$ python </p>
33
+
34
+ *** Output of Markdown.pl (parsed) ***
35
+ <p>$ python </p
36
+ >