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,59 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ > Code
6
+ >
7
+ > Ciao
8
+ *** Output of inspect ***
9
+ md_el(:document,[
10
+ md_el(:quote,[md_par(["Code"]), md_el(:code,[] , {:raw_code=>"Ciao"})] )
11
+ ] )
12
+ *** Output of to_html ***
13
+
14
+ <blockquote>
15
+ <p>Code</p>
16
+
17
+ <pre><code>Ciao</code></pre>
18
+ </blockquote>
19
+
20
+ *** Output of to_latex ***
21
+ \begin{quote}%
22
+ Code
23
+
24
+ \begin{verbatim}Ciao\end{verbatim}
25
+
26
+ \end{quote}
27
+
28
+ *** Output of to_s ***
29
+ Code
30
+ *** Output of to_s ***
31
+ Code
32
+ *** EOF ***
33
+
34
+
35
+
36
+ OK!
37
+
38
+
39
+
40
+ *** Output of Markdown.pl ***
41
+ <blockquote>
42
+ <p>Code</p>
43
+
44
+ <pre><code>Ciao
45
+ </code></pre>
46
+ </blockquote>
47
+
48
+ *** Output of Markdown.pl (parsed) ***
49
+ <blockquote>
50
+ <p>Code</p
51
+ >
52
+
53
+ <pre
54
+ ><code>Ciao
55
+ </code
56
+ ></pre
57
+ >
58
+ </blockquote
59
+ >
@@ -0,0 +1,121 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+
6
+ This is code (4 spaces):
7
+
8
+ Code
9
+ This is not code
10
+
11
+ Code
12
+
13
+ This is code (1 tab):
14
+
15
+ Code
16
+ This is not code
17
+
18
+ Code
19
+
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
+ md_par(["This is not code"]),
27
+ md_el(:code,[] , {:raw_code=>"Code\n"}),
28
+ md_par(["This is code (1 tab):"]),
29
+ md_el(:code,[] , {:raw_code=>"Code"}),
30
+ md_par(["This is not code"]),
31
+ md_el(:code,[] , {:raw_code=>"Code"})
32
+ ] )
33
+ *** Output of to_html ***
34
+
35
+ <p>This is code (4 spaces):</p>
36
+
37
+ <pre><code>Code</code></pre>
38
+
39
+ <p>This is not code</p>
40
+
41
+ <pre><code>Code
42
+ </code></pre>
43
+
44
+ <p>This is code (1 tab):</p>
45
+
46
+ <pre><code>Code</code></pre>
47
+
48
+ <p>This is not code</p>
49
+
50
+ <pre><code>Code</code></pre>
51
+
52
+ *** Output of to_latex ***
53
+ This is code (4 spaces):
54
+
55
+ \begin{verbatim}Code\end{verbatim}
56
+ This is not code
57
+
58
+ \begin{verbatim}Code
59
+ \end{verbatim}
60
+ This is code (1 tab):
61
+
62
+ \begin{verbatim}Code\end{verbatim}
63
+ This is not code
64
+
65
+ \begin{verbatim}Code\end{verbatim}
66
+
67
+ *** Output of to_s ***
68
+ This is code (4 spaces):This is not codeThis is code (1 tab):This is not code
69
+ *** Output of to_s ***
70
+ This is code (4 spaces):This is not codeThis is code (1 tab):This is not code
71
+ *** EOF ***
72
+
73
+
74
+
75
+ OK!
76
+
77
+
78
+
79
+ *** Output of Markdown.pl ***
80
+ <p>This is code (4 spaces):</p>
81
+
82
+ <pre><code>Code
83
+ </code></pre>
84
+
85
+ <p>This is not code</p>
86
+
87
+ <pre><code>Code
88
+ </code></pre>
89
+
90
+ <p>This is code (1 tab):</p>
91
+
92
+ <pre><code>Code
93
+ </code></pre>
94
+
95
+ <p>This is not code</p>
96
+
97
+ <pre><code>Code
98
+ </code></pre>
99
+
100
+ *** Output of Markdown.pl (parsed) ***
101
+ <p>This is code (4 spaces):</p
102
+ ><pre
103
+ ><code>Code
104
+ </code
105
+ ></pre
106
+ ><p>This is not code</p
107
+ ><pre
108
+ ><code>Code
109
+ </code
110
+ ></pre
111
+ ><p>This is code (1 tab):</p
112
+ ><pre
113
+ ><code>Code
114
+ </code
115
+ ></pre
116
+ ><p>This is not code</p
117
+ ><pre
118
+ ><code>Code
119
+ </code
120
+ ></pre
121
+ >
@@ -0,0 +1,36 @@
1
+ Simple test for emphasis.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ *Hello!* how are **you**?
6
+ *** Output of inspect ***
7
+ md_el(:document,[md_par([md_em(["Hello!"]), " how are ", md_strong(["you"]), "?"])] )
8
+ *** Output of to_html ***
9
+
10
+ <p><em>Hello!</em> how are <strong>you</strong>?</p>
11
+
12
+ *** Output of to_latex ***
13
+ {\em Hello!} how are {\bf you}?
14
+
15
+
16
+ *** Output of to_s ***
17
+ Hello! how are you?
18
+ *** Output of to_s ***
19
+ Hello! how are you?
20
+ *** EOF ***
21
+
22
+
23
+
24
+ OK!
25
+
26
+
27
+
28
+ *** Output of Markdown.pl ***
29
+ <p><em>Hello!</em> how are <strong>you</strong>?</p>
30
+
31
+ *** Output of Markdown.pl (parsed) ***
32
+ <p
33
+ ><em>Hello!</em
34
+ > how are <strong>you</strong
35
+ >?</p
36
+ >
@@ -0,0 +1,39 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+
6
+
7
+ This is an email address: <andrea@invalid.it>
8
+
9
+ *** Output of inspect ***
10
+ md_el(:document,[
11
+ md_par(["This is an email address: ", md_email("andrea@invalid.it")])
12
+ ] )
13
+ *** Output of to_html ***
14
+
15
+ <p>This is an email address: <a href='mailto:andrea@invalid.it'>&#097;&#110;&#100;&#114;&#101;&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
16
+
17
+ *** Output of to_latex ***
18
+ This is an email address: \href{mailto:andrea@invalid.it}{\char97\char110\char100\char114\char101\char97\char64\char105\char110\char118\char97\char108\char105\char100\char46\char105\char116}
19
+
20
+
21
+ *** Output of to_s ***
22
+ This is an email address:
23
+ *** Output of to_s ***
24
+ This is an email address:
25
+ *** EOF ***
26
+
27
+
28
+
29
+ OK!
30
+
31
+
32
+
33
+ *** Output of Markdown.pl ***
34
+ <p>This is an email address: <a href="m&#x61;i&#x6C;&#x74;&#111;:&#97;&#x6E;&#100;&#x72;&#101;&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#108;i&#100;.&#x69;&#x74;">&#97;&#x6E;&#100;&#x72;&#101;&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#108;i&#100;.&#x69;&#x74;</a></p>
35
+
36
+ *** Output of Markdown.pl (parsed) ***
37
+ <p>This is an email address: <a href='m&amp;#x61;i&amp;#x6C;&amp;#x74;&amp;#111;:&amp;#97;&amp;#x6E;&amp;#100;&amp;#x72;&amp;#101;&amp;#x61;&amp;#64;&amp;#105;&amp;#x6E;&amp;#118;&amp;#x61;&amp;#108;i&amp;#100;.&amp;#x69;&amp;#x74;'>&#97;&#x6E;&#100;&#x72;&#101;&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#108;i&#100;.&#x69;&#x74;</a
38
+ ></p
39
+ >
@@ -0,0 +1,9 @@
1
+ Encoding: iso-8859-1
2
+
3
+ ***Markdown input:***
4
+
5
+ ***Markdown input:***
6
+ Encoding: iso-8859-1
7
+
8
+ This is iso-8859-1: àèìàù.
9
+ ***Output of inspect***
@@ -0,0 +1,38 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {:italian=>"\303\240\303\250\303\254\303\262\303\271."}
4
+ *** Markdown input: ***
5
+ Italian: àèìòù.
6
+
7
+ Japanese: マルク
8
+
9
+ *** Output of inspect ***
10
+ md_el(:document,[md_par(["Japanese: \343\203\236\343\203\253\343\202\257"])] , {:italian=>"\303\240\303\250\303\254\303\262\303\271."})
11
+ *** Output of to_html ***
12
+ <p>Japanese: マルク</p
13
+ >
14
+ *** Output of to_latex ***
15
+ Japanese: マルク
16
+
17
+
18
+ *** Output of to_s ***
19
+ Japanese: マルク
20
+ *** Output of to_md ***
21
+ Japanese: マルク
22
+ *** EOF ***
23
+
24
+
25
+
26
+ OK!
27
+
28
+
29
+
30
+ *** Output of Markdown.pl ***
31
+ <p>Italian: àèìòù.</p>
32
+
33
+ <p>Japanese: マルク</p>
34
+
35
+ *** Output of Markdown.pl (parsed) ***
36
+ <p>Italian: àèìòù.</p
37
+ ><p>Japanese: マルク</p
38
+ >
@@ -0,0 +1,174 @@
1
+ Write a comment abouth the test here.
2
+ *** Parameters: ***
3
+ {}
4
+ *** Markdown input: ***
5
+ Maruku translates HTML entities to the equivalent in LaTeX:
6
+
7
+ Entity | Result
8
+ ------------|----------
9
+ `&copy;` | &copy;
10
+ `&pound;` | &pound;
11
+ `a&nbsp;b` | a&nbsp;b
12
+ `&lambda;` | &lambda;
13
+ `&mdash;` | &mdash;
14
+
15
+
16
+ Entity-substitution does not happen in code blocks or inline code.
17
+
18
+ The following should not be translated:
19
+
20
+ &copy;
21
+
22
+ It should read just like this: `&copy;`.
23
+
24
+
25
+ *** Output of inspect ***
26
+ md_el(:document,[
27
+ md_par(["Maruku translates HTML entities to the equivalent in LaTeX:"]),
28
+ md_el(:table,[
29
+ md_el(:head_cell,["Entity"] ),
30
+ md_el(:head_cell,["Result"] ),
31
+ md_el(:cell,[md_code("&copy;")] ),
32
+ md_el(:cell,[md_entity("copy")] ),
33
+ md_el(:cell,[md_code("&pound;")] ),
34
+ md_el(:cell,[md_entity("pound")] ),
35
+ md_el(:cell,[md_code("a&nbsp;b")] ),
36
+ md_el(:cell,["a", md_entity("nbsp"), "b"] ),
37
+ md_el(:cell,[md_code("&lambda;")] ),
38
+ md_el(:cell,[md_entity("lambda")] ),
39
+ md_el(:cell,[md_code("&mdash;")] ),
40
+ md_el(:cell,[md_entity("mdash")] )
41
+ ] , {:align=>[:left, :left]}),
42
+ md_par([
43
+ "Entity-substitution does not happen in code blocks or inline code."
44
+ ]),
45
+ md_par(["The following should not be translated:"]),
46
+ md_el(:code,[] , {:raw_code=>"&copy;\n"}),
47
+ md_par(["It should read just like this: ", md_code("&copy;"), "."])
48
+ ] )
49
+ *** Output of to_html ***
50
+
51
+ <p>Maruku translates HTML entities to the equivalent in LaTeX:</p>
52
+
53
+ <table>
54
+ <thead>
55
+ <tr><th>Entity</th><th>Result</th></tr>
56
+ </thead>
57
+ <tbody>
58
+ <tr>
59
+ <td style='text-align: left;'><code>&amp;copy;</code></td>
60
+
61
+ <td style='text-align: left;'>&copy;</td>
62
+ </tr>
63
+
64
+ <tr>
65
+ <td style='text-align: left;'><code>&amp;pound;</code></td>
66
+
67
+ <td style='text-align: left;'>&pound;</td>
68
+ </tr>
69
+
70
+ <tr>
71
+ <td style='text-align: left;'><code>a&amp;nbsp;b</code></td>
72
+
73
+ <td style='text-align: left;'>a&nbsp;b</td>
74
+ </tr>
75
+
76
+ <tr>
77
+ <td style='text-align: left;'><code>&amp;lambda;</code></td>
78
+
79
+ <td style='text-align: left;'>&lambda;</td>
80
+ </tr>
81
+
82
+ <tr>
83
+ <td style='text-align: left;'><code>&amp;mdash;</code></td>
84
+
85
+ <td style='text-align: left;'>&mdash;</td>
86
+ </tr>
87
+ </tbody></table>
88
+
89
+ <p>Entity-substitution does not happen in code blocks or inline code.</p>
90
+
91
+ <p>The following should not be translated:</p>
92
+
93
+ <pre><code>&amp;copy;
94
+ </code></pre>
95
+
96
+ <p>It should read just like this: <code>&amp;copy;</code>.</p>
97
+
98
+ *** Output of to_latex ***
99
+ Maruku translates HTML entities to the equivalent in \LaTeX\xspace :
100
+
101
+ \begin{tabular}{l|l}
102
+ Entity&Result\\
103
+ \hline
104
+ \colorbox[rgb]{0.94,0.94,0.88}{\tt \char38\char99\char111\char112\char121\char59}&\copyright\\
105
+ \colorbox[rgb]{0.94,0.94,0.88}{\tt \char38\char112\char111\char117\char110\char100\char59}&\pounds\\
106
+ \colorbox[rgb]{0.94,0.94,0.88}{\tt \char97\char38\char110\char98\char115\char112\char59\char98}&a~b\\
107
+ \colorbox[rgb]{0.94,0.94,0.88}{\tt \char38\char108\char97\char109\char98\char100\char97\char59}&$\lambda$\\
108
+ \colorbox[rgb]{0.94,0.94,0.88}{\tt \char38\char109\char100\char97\char115\char104\char59}&---\\
109
+ \end{tabular}
110
+
111
+ Entity-substitution does not happen in code blocks or inline code.
112
+
113
+ The following should not be translated:
114
+
115
+ \begin{verbatim}&copy;
116
+ \end{verbatim}
117
+ It should read just like this: \colorbox[rgb]{0.94,0.94,0.88}{\tt \char38\char99\char111\char112\char121\char59}.
118
+
119
+
120
+ *** Output of to_s ***
121
+ Maruku translates HTML entities to the equivalent in LaTeX:EntityResultabEntity-substitution does not happen in code blocks or inline code.The following should not be translated:It should read just like this: .
122
+ *** Output of to_s ***
123
+ Maruku translates HTML entities to the equivalent in LaTeX:EntityResultabEntity-substitution does not happen in code blocks or inline code.The following should not be translated:It should read just like this: .
124
+ *** EOF ***
125
+
126
+
127
+
128
+ OK!
129
+
130
+
131
+
132
+ *** Output of Markdown.pl ***
133
+ <p>Maruku translates HTML entities to the equivalent in LaTeX:</p>
134
+
135
+ <p>Entity | Result
136
+ ------------|----------
137
+ <code>&amp;copy;</code> | &copy;
138
+ <code>&amp;pound;</code> | &pound;
139
+ <code>a&amp;nbsp;b</code> | a&nbsp;b
140
+ <code>&amp;lambda;</code> | &lambda;
141
+ <code>&amp;mdash;</code> | &mdash;</p>
142
+
143
+ <p>Entity-substitution does not happen in code blocks or inline code.</p>
144
+
145
+ <p>The following should not be translated:</p>
146
+
147
+ <pre><code>&amp;copy;
148
+ </code></pre>
149
+
150
+ <p>It should read just like this: <code>&amp;copy;</code>.</p>
151
+
152
+ *** Output of Markdown.pl (parsed) ***
153
+ <p>Maruku translates HTML entities to the equivalent in LaTeX:</p
154
+ ><p>Entity | Result
155
+ ------------|----------
156
+ <code>&amp;copy;</code
157
+ > | &copy;
158
+ <code>&amp;pound;</code
159
+ > | &pound;
160
+ <code>a&amp;nbsp;b</code
161
+ > | a&nbsp;b
162
+ <code>&amp;lambda;</code
163
+ > | &lambda;
164
+ <code>&amp;mdash;</code
165
+ > | &mdash;</p
166
+ ><p>Entity-substitution does not happen in code blocks or inline code.</p
167
+ ><p>The following should not be translated:</p
168
+ ><pre
169
+ ><code>&amp;copy;
170
+ </code
171
+ ></pre
172
+ ><p>It should read just like this: <code>&amp;copy;</code
173
+ >.</p
174
+ >