maruku 0.5.9 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/bin/maruku +6 -1
  2. data/bin/marutest +25 -18
  3. data/lib/maruku.rb +3 -0
  4. data/lib/maruku/ext/div.rb +39 -6
  5. data/lib/maruku/ext/math/latex_fix.rb +1 -0
  6. data/lib/maruku/ext/math/mathml_engines/blahtex.rb +9 -8
  7. data/lib/maruku/ext/math/parsing.rb +15 -1
  8. data/lib/maruku/ext/math/to_html.rb +34 -17
  9. data/lib/maruku/ext/math/to_latex.rb +4 -0
  10. data/lib/maruku/helpers.rb +3 -3
  11. data/lib/maruku/input/charsource.rb +1 -1
  12. data/lib/maruku/input/parse_block.rb +1 -0
  13. data/lib/maruku/input/parse_doc.rb +12 -5
  14. data/lib/maruku/input/parse_span_better.rb +24 -10
  15. data/lib/maruku/output/s5/to_s5.rb +14 -1
  16. data/lib/maruku/output/to_html.rb +20 -1
  17. data/lib/maruku/output/to_latex.rb +27 -0
  18. data/lib/maruku/output/to_latex_entities.rb +2 -2
  19. data/lib/maruku/output/to_s.rb +5 -2
  20. data/lib/maruku/string_utils.rb +2 -2
  21. data/lib/maruku/structures.rb +2 -0
  22. data/lib/maruku/tests/new_parser.rb +5 -2
  23. data/lib/maruku/version.rb +1 -1
  24. data/tests/bugs/code_in_links.md +85 -0
  25. data/tests/bugs/complex_escaping.md +34 -0
  26. data/tests/unittest/abbreviations.md +2 -10
  27. data/tests/unittest/alt.md +2 -3
  28. data/tests/unittest/attributes/att2.md +2 -4
  29. data/tests/unittest/attributes/att3.md +2 -7
  30. data/tests/unittest/attributes/attributes.md +2 -15
  31. data/tests/unittest/attributes/circular.md +2 -7
  32. data/tests/unittest/attributes/default.md +2 -6
  33. data/tests/unittest/blank.md +2 -5
  34. data/tests/unittest/blanks_in_code.md +2 -21
  35. data/tests/unittest/bug_def.md +2 -3
  36. data/tests/unittest/bug_table.md +2 -11
  37. data/tests/unittest/code.md +2 -9
  38. data/tests/unittest/code2.md +2 -8
  39. data/tests/unittest/code3.md +2 -21
  40. data/tests/unittest/data_loss.md +2 -7
  41. data/tests/unittest/divs/div1.md +32 -57
  42. data/tests/unittest/divs/div2.md +6 -7
  43. data/tests/unittest/divs/div3_nest.md +8 -13
  44. data/tests/unittest/easy.md +2 -3
  45. data/tests/unittest/email.md +2 -3
  46. data/tests/unittest/encoding/iso-8859-1.md +2 -5
  47. data/tests/unittest/encoding/utf-8.md +2 -5
  48. data/tests/unittest/entities.md +2 -20
  49. data/tests/unittest/escaping.md +2 -12
  50. data/tests/unittest/extra_dl.md +2 -10
  51. data/tests/unittest/extra_header_id.md +2 -13
  52. data/tests/unittest/extra_table1.md +2 -8
  53. data/tests/unittest/footnotes.md +2 -19
  54. data/tests/{bugs/html.md → unittest/hang.md} +9 -9
  55. data/tests/unittest/headers.md +2 -7
  56. data/tests/unittest/hex_entities.md +2 -3
  57. data/tests/unittest/hrule.md +2 -11
  58. data/tests/unittest/html2.md +2 -6
  59. data/tests/unittest/html3.md +2 -6
  60. data/tests/unittest/html4.md +2 -7
  61. data/tests/unittest/html5.md +2 -5
  62. data/tests/unittest/ie.md +2 -23
  63. data/tests/unittest/images.md +2 -14
  64. data/tests/unittest/images2.md +2 -5
  65. data/tests/unittest/inline_html.md +6 -102
  66. data/tests/unittest/inline_html2.md +2 -5
  67. data/tests/unittest/links.md +17 -50
  68. data/tests/unittest/links2.md +2 -3
  69. data/tests/unittest/list1.md +2 -10
  70. data/tests/unittest/list12.md +2 -5
  71. data/tests/unittest/list2.md +2 -10
  72. data/tests/unittest/list3.md +2 -14
  73. data/tests/unittest/list4.md +2 -17
  74. data/tests/unittest/lists.md +2 -39
  75. data/tests/unittest/lists10.md +2 -7
  76. data/tests/unittest/lists11.md +2 -5
  77. data/tests/unittest/lists6.md +2 -3
  78. data/tests/unittest/lists9.md +2 -11
  79. data/tests/unittest/lists_after_paragraph.md +3 -51
  80. data/tests/unittest/lists_ol.md +2 -52
  81. data/tests/unittest/loss.md +2 -3
  82. data/tests/unittest/math/equations.md +54 -37
  83. data/tests/unittest/math/inline.md +4 -12
  84. data/tests/unittest/math/math2.md +4 -57
  85. data/tests/unittest/math/notmath.md +2 -5
  86. data/tests/unittest/math/table.md +5 -11
  87. data/tests/unittest/math/table2.md +2 -8
  88. data/tests/unittest/misc_sw.md +2 -80
  89. data/tests/unittest/notyet/escape.md +2 -5
  90. data/tests/unittest/notyet/header_after_par.md +2 -13
  91. data/tests/unittest/notyet/ticks.md +2 -3
  92. data/tests/unittest/notyet/triggering.md +2 -39
  93. data/tests/unittest/olist.md +2 -9
  94. data/tests/unittest/one.md +2 -3
  95. data/tests/unittest/paragraph.md +2 -3
  96. data/tests/unittest/paragraph_rules/dont_merge_ref.md +2 -5
  97. data/tests/unittest/paragraph_rules/tab_is_blank.md +2 -5
  98. data/tests/unittest/paragraphs.md +2 -10
  99. data/tests/unittest/pending/amps.md +2 -4
  100. data/tests/unittest/pending/empty_cells.md +2 -6
  101. data/tests/unittest/pending/link.md +2 -21
  102. data/tests/unittest/pending/ref.md +2 -3
  103. data/tests/unittest/recover/recover_links.md +7 -8
  104. data/tests/{bugs → unittest/red_tests}/abbrev.md +12 -103
  105. data/tests/unittest/{lists7.md → red_tests/lists7.md} +2 -13
  106. data/tests/unittest/{lists7b.md → red_tests/lists7b.md} +2 -10
  107. data/tests/unittest/{lists8.md → red_tests/lists8.md} +2 -9
  108. data/tests/unittest/red_tests/xml.md +70 -0
  109. data/tests/unittest/references/long_example.md +2 -7
  110. data/tests/unittest/references/spaces_and_numbers.md +2 -3
  111. data/tests/unittest/smartypants.md +2 -47
  112. data/tests/unittest/syntax_hl.md +2 -18
  113. data/tests/unittest/table_attributes.md +2 -8
  114. data/tests/unittest/test.md +2 -3
  115. data/tests/unittest/underscore_in_words.md +27 -0
  116. data/tests/unittest/wrapping.md +2 -11
  117. data/tests/unittest/xml2.md +2 -5
  118. data/tests/unittest/xml3.md +2 -8
  119. data/tests/unittest/xml_instruction.md +2 -10
  120. data/unit_test_span.sh +2 -1
  121. metadata +242 -241
  122. data/docs/changelog.html +0 -490
  123. data/docs/entity_test.html +0 -258
  124. data/docs/exd.html +0 -307
  125. data/docs/index.html +0 -332
  126. data/docs/markdown_syntax.html +0 -690
  127. data/docs/maruku.html +0 -332
  128. data/docs/proposal.html +0 -326
  129. data/docs/tmp.md +0 -2
  130. data/lib/sort_prof.rb +0 -22
  131. data/tests/bugs/links.md +0 -47
  132. data/tests/diagrams/diagrams.md +0 -302
  133. data/tests/s5/a.md +0 -13
  134. data/tests/s5/instiki+s5.md +0 -105
  135. data/tests/unittest/xml.md +0 -54
data/docs/tmp.md DELETED
@@ -1,2 +0,0 @@
1
- α α, αβ . β.
2
- α α, αβ . β.
data/lib/sort_prof.rb DELETED
@@ -1,22 +0,0 @@
1
-
2
- field = (ARGV.shift or '2').to_i
3
-
4
- lines = $stdin.read.split("\n")
5
- # leave the first lines
6
-
7
- while l = lines.shift
8
- puts l
9
- break if l =~ /total/
10
- end
11
-
12
-
13
-
14
-
15
- puts lines.sort {|a,b|
16
- a.split[field].to_f <=> b.split[field].to_f
17
- }.reverse.join("\n")
18
-
19
-
20
-
21
-
22
-
data/tests/bugs/links.md DELETED
@@ -1,47 +0,0 @@
1
- Write a comment here
2
- *** Parameters: ***
3
- {} # params
4
- *** Markdown input: ***
5
- Amazing [Museo].
6
-
7
- [Museo]: <http://www.josbuivenga.demon.nl/museo.html> (Jos Buivenga's Museo free typeface)
8
-
9
- *** Output of inspect ***
10
- md_el(:document,[
11
- md_par(["Amazing ", md_link(["Museo"],"museo"), "."]),
12
- md_ref_def("museo", "http://www.josbuivenga.demon.nl/museo.html", {:title=>"Jos Buivenga"})
13
- ],{},[])
14
- *** Output of to_html ***
15
- <p>Amazing <a href='http://www.josbuivenga.demon.nl/museo.html' title='Jos Buivenga'>Museo</a>.</p>
16
- *** Output of to_latex ***
17
- Amazing \href{http://www.josbuivenga.demon.nl/museo.html>}{Museo}.
18
- *** Output of to_md ***
19
- Amazing Museo.
20
- *** Output of to_s ***
21
- Amazing Museo.
22
- *** EOF ***
23
-
24
-
25
-
26
-
27
- Failed tests: [:to_latex]
28
-
29
- *** Output of inspect ***
30
- md_el(:document,[
31
- md_par(["Amazing ", md_link(["Museo"],"museo"), "."]),
32
- md_ref_def("museo", "http://www.josbuivenga.demon.nl/museo.html", {:title=>"Jos Buivenga"})
33
- ],{},[])
34
- *** Output of to_html ***
35
- <p>Amazing <a href='http://www.josbuivenga.demon.nl/museo.html' title='Jos Buivenga'>Museo</a>.</p>
36
- *** Output of to_latex ***
37
- -----| WARNING | -----
38
- Amazing \href{http://www.josbuivenga.demon.nl/museo.html}{Museo}.
39
- *** Output of to_md ***
40
- Amazing Museo.
41
- *** Output of to_s ***
42
- Amazing Museo.
43
- *** Output of Markdown.pl ***
44
- <p>Amazing [Museo].</p>
45
-
46
- *** Output of Markdown.pl (parsed) ***
47
- Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element>
@@ -1,302 +0,0 @@
1
- Write a comment here
2
- *** Parameters: ***
3
- {} # params
4
- *** Markdown input: ***
5
-
6
- I would like to add a syntax for drawing basic diagrams
7
- and convert them to PNG/PDF/SVG.
8
-
9
-
10
- +----------+ +----------+
11
- | Makefile | ---> | Compiler | ==> ...
12
- +----------+ +----------+
13
- | ^
14
- v |
15
- ---------
16
- {:diagram title="My diagram"}
17
-
18
-
19
- {:diagram: style=""}
20
-
21
- How to do vertical bold arrows?
22
-
23
- !
24
- V
25
-
26
- Curved arrows:
27
- +-> | Yes: |
28
- ___________________ /
29
- | is the agent ok? | --|
30
- --------------{:r}+
31
-
32
- {:r: border="solid 3px red"}
33
-
34
- Big boxes:
35
-
36
- +-------+
37
- |{:long}| --->
38
- +-------+
39
-
40
- {+long: This is a long box}
41
-
42
- Or
43
-
44
- +----------------+ ________
45
- | This is a very | ---> | Box |
46
- | long cell | |________|
47
- +----------------+
48
- - Yes
49
- /
50
- -------+
51
- \
52
- - No
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
- *** Output of inspect ***
61
- md_el(:document,[
62
- md_par([
63
- "I would like to add a syntax for drawing basic diagrams and convert them to PNG/PDF/SVG."
64
- ]),
65
- md_el(:code,[],{:raw_code=>"+----------+ +----------+\n| Makefile | ---> | Compiler | ==> ...\n+----------+ +----------+\n | ^\n v |\n --------- "},[[:ref, "diagram"], ["title", "My diagram"]]),
66
- md_el(:ald,[],{:ald=>[],:ald_id=>"diagram"},[]),
67
- md_par(["How to do vertical bold arrows?"]),
68
- md_el(:code,[],{:raw_code=>"!\nV \n"},[]),
69
- md_par([
70
- "Curved arrows: +-> | Yes: | ___________________ / | is the agent ok? | ",
71
- md_entity("ndash"),
72
- "| ",
73
- md_entity("mdash"),
74
- md_entity("mdash"),
75
- md_entity("mdash"),
76
- md_entity("mdash"),
77
- md_entity("ndash"),
78
- "+"
79
- ]),
80
- md_el(:code,[],{:raw_code=>"{:r: border=\"solid 3px red\"}\n"},[]),
81
- md_par(["Big boxes:"]),
82
- md_el(:code,[],{:raw_code=>"+-------+\n|{:long}| ---> \n+-------+\n\n{+long: This is a long box}"},[]),
83
- md_par(["Or"]),
84
- md_el(:code,[],{:raw_code=>"+----------------+ ________\n| This is a very | ---> | Box |\n| long cell | |________|\n+----------------+\n - Yes\n / \n-------+ \n \\\n - No"},[])
85
- ],{},[])
86
- *** Output of to_html ***
87
-
88
- <p>I would like to add a syntax for drawing basic diagrams and convert them to PNG/PDF/SVG.</p>
89
-
90
- <pre><code>+----------+ +----------+
91
- | Makefile | ---&gt; | Compiler | ==&gt; ...
92
- +----------+ +----------+
93
- | ^
94
- v |
95
- --------- </code></pre>
96
-
97
- <p>How to do vertical bold arrows?</p>
98
-
99
- <pre><code>!
100
- V
101
- </code></pre>
102
-
103
- <p>Curved arrows: +-&gt; | Yes: | ___________________ / | is the agent ok? | &#8211;| &#8212;&#8212;&#8212;&#8212;&#8211;+</p>
104
-
105
- <pre><code>{:r: border=&quot;solid 3px red&quot;}
106
- </code></pre>
107
-
108
- <p>Big boxes:</p>
109
-
110
- <pre><code>+-------+
111
- |{:long}| ---&gt;
112
- +-------+
113
-
114
- {+long: This is a long box}</code></pre>
115
-
116
- <p>Or</p>
117
-
118
- <pre><code>+----------------+ ________
119
- | This is a very | ---&gt; | Box |
120
- | long cell | |________|
121
- +----------------+
122
- - Yes
123
- /
124
- -------+
125
- \
126
- - No</code></pre>
127
-
128
- *** Output of to_latex ***
129
- I would like to add a syntax for drawing basic diagrams and convert them to PNG/PDF/SVG.
130
-
131
- \begin{verbatim}+----------+ +----------+
132
- | Makefile | ---> | Compiler | ==> ...
133
- +----------+ +----------+
134
- | ^
135
- v |
136
- --------- \end{verbatim}
137
- How to do vertical bold arrows?
138
-
139
- \begin{verbatim}!
140
- V
141
- \end{verbatim}
142
- Curved arrows: +-{\tt \char62} | Yes: | \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ / | is the agent ok? | --{}| ---{}---{}---{}---{}--{}+
143
-
144
- \begin{verbatim}{:r: border="solid 3px red"}
145
- \end{verbatim}
146
- Big boxes:
147
-
148
- \begin{verbatim}+-------+
149
- |{:long}| --->
150
- +-------+
151
-
152
- {+long: This is a long box}\end{verbatim}
153
- Or
154
-
155
- \begin{verbatim}+----------------+ ________
156
- | This is a very | ---> | Box |
157
- | long cell | |________|
158
- +----------------+
159
- - Yes
160
- /
161
- -------+
162
- \
163
- - No\end{verbatim}
164
-
165
- *** Output of to_md ***
166
- I would like to add a syntax for
167
- drawing basic diagrams and convert them
168
- to PNG/PDF/SVG.
169
-
170
- How to do vertical bold arrows?
171
-
172
- Curved arrows: +-> | Yes: |
173
- ___________________ / | is the agent
174
- ok? | | +
175
-
176
- Big boxes:
177
-
178
- Or
179
-
180
-
181
- *** Output of to_s ***
182
- I would like to add a syntax for drawing basic diagrams and convert them to PNG/PDF/SVG.How to do vertical bold arrows?Curved arrows: +-> | Yes: | ___________________ / | is the agent ok? | | +Big boxes:Or
183
- *** EOF ***
184
-
185
-
186
-
187
- OK!
188
-
189
-
190
-
191
- *** Output of Markdown.pl ***
192
- <p>I would like to add a syntax for drawing basic diagrams
193
- and convert them to PNG/PDF/SVG.</p>
194
-
195
- <pre><code>+----------+ +----------+
196
- | Makefile | ---&gt; | Compiler | ==&gt; ...
197
- +----------+ +----------+
198
- | ^
199
- v |
200
- ---------
201
- </code></pre>
202
-
203
- <p>{:diagram title="My diagram"}</p>
204
-
205
- <p>{:diagram: style=""}</p>
206
-
207
- <p>How to do vertical bold arrows?</p>
208
-
209
- <pre><code>!
210
- V
211
- </code></pre>
212
-
213
- <p>Curved arrows:
214
- +-> | Yes: |
215
- <strong><em>_</em><em>_</em><em>_</em><em>_</em><em>_</em></strong> /
216
- | is the agent ok? | --|
217
- --------------{:r}+</p>
218
-
219
- <pre><code>{:r: border="solid 3px red"}
220
- </code></pre>
221
-
222
- <p>Big boxes:</p>
223
-
224
- <pre><code>+-------+
225
- |{:long}| ---&gt;
226
- +-------+
227
-
228
- {+long: This is a long box}
229
- </code></pre>
230
-
231
- <p>Or</p>
232
-
233
- <pre><code>+----------------+ ________
234
- | This is a very | ---&gt; | Box |
235
- | long cell | |________|
236
- +----------------+
237
- - Yes
238
- /
239
- -------+
240
- \
241
- - No
242
- </code></pre>
243
-
244
- *** Output of Markdown.pl (parsed) ***
245
- <p>I would like to add a syntax for drawing basic diagrams
246
- and convert them to PNG/PDF/SVG.</p
247
- ><pre
248
- ><code>+----------+ +----------+
249
- | Makefile | ---&gt; | Compiler | ==&gt; ...
250
- +----------+ +----------+
251
- | ^
252
- v |
253
- ---------
254
- </code
255
- ></pre
256
- ><p>{:diagram title="My diagram"}</p
257
- ><p>{:diagram: style=""}</p
258
- ><p>How to do vertical bold arrows?</p
259
- ><pre
260
- ><code>!
261
- V
262
- </code
263
- ></pre
264
- ><p>Curved arrows:
265
- +-> | Yes: |
266
- <strong
267
- ><em>_</em
268
- ><em>_</em
269
- ><em>_</em
270
- ><em>_</em
271
- ><em>_</em
272
- ></strong
273
- > /
274
- | is the agent ok? | --|
275
- --------------{:r}+</p
276
- ><pre
277
- ><code>{:r: border="solid 3px red"}
278
- </code
279
- ></pre
280
- ><p>Big boxes:</p
281
- ><pre
282
- ><code>+-------+
283
- |{:long}| ---&gt;
284
- +-------+
285
-
286
- {+long: This is a long box}
287
- </code
288
- ></pre
289
- ><p>Or</p
290
- ><pre
291
- ><code>+----------------+ ________
292
- | This is a very | ---&gt; | Box |
293
- | long cell | |________|
294
- +----------------+
295
- - Yes
296
- /
297
- -------+
298
- \
299
- - No
300
- </code
301
- ></pre
302
- >
data/tests/s5/a.md DELETED
@@ -1,13 +0,0 @@
1
- Title
2
- =====
3
-
4
- Slide 1
5
- -------
6
-
7
- * point
8
-
9
- Slide 2
10
- -------
11
-
12
- * point
13
-
@@ -1,105 +0,0 @@
1
- author: Jacques Distler
2
- company: University of Texas at Austin
3
- title: S5 Integration
4
- subtitle: slides in Instiki
5
- slide_footer: Released to the Internets
6
- slide_subfooter: March 1, 2007
7
-
8
- :category: S5-slideshow
9
-
10
- S5 Integration
11
- ==============
12
-
13
- S5
14
- --------------------------------------
15
-
16
- 1. [S5](http://meyerweb.com/eric/tools/s5/) is an open-source presentation package, written by Eric Meyer.
17
- 2. Andrea Censi included some basic S5 support in [Maruku](http://maruku.rubyforge.org/), his Ruby Markdown implementation.
18
- 2. My role was to
19
- * make it compatible[^xhtml] with real XHTML
20
- * integrate it into Instiki
21
- 3. Driven by Maruku and itex2MML, it's trivial to include equations, inline SVG graphics, etc.
22
-
23
- [^xhtml]: This consisted of fixing the Javascript to use DOM-scripting, instead of `innerHTML`.
24
-
25
- Composing a presentation
26
- --------------------------------------
27
-
28
- At the top of this presentation, is some header information:
29
-
30
- author: Jacques Distler
31
- company: University of Texas at Austin
32
- title: S5 Integration
33
- subtitle: slides in Instiki
34
- slide_footer: Released to the Internets
35
- slide_subfooter: March 1, 2007
36
-
37
- :category: S5-slideshow
38
-
39
- The `:category: S5-slideshow` is essential. It tells Instiki that this page is an S5 slideshow. Any page in this category has an extra "S5" view, in addition to the "TeX" and "Print" views. The rest of the header fields are optional. If you omit `author: ...`, then the name of the person who last edited the page is used. If you omit `title: ...`, then the name of the page is used.
40
-
41
- Composing ...
42
- -----------------------------------------
43
-
44
- After that header information, is a series of slides
45
-
46
- My Slideshow
47
- ==============
48
-
49
- First Slide Title
50
- -----------------
51
-
52
- * First point
53
- * Second point
54
-
55
- Second Slide Title
56
- ------------------
57
-
58
- * Another boring bullet point.
59
-
60
- etc.
61
-
62
-
63
- Features
64
- --------------------------------------
65
-
66
- * Mathematics, either inline $\left(\frac{\sin(\pi x)}{\pi x}\right)$ or block
67
- \[
68
- \label{gaussian}
69
- \int_{\infty}^{\infty}e^{-x^2} \mathrm{d}x = \sqrt{\pi}
70
- \]
71
- are fully supported. You just type standard [itex](http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html), and equations like (eq:gaussian) just appear.
72
- * Incremental display is supported.
73
- * Notes are allowed, but there isn't (yet) a native Maruku syntax for entering them. _Horror of horrors!_ You need to type a little XHTML markup to get them.
74
- {: .incremental .show-first}
75
-
76
- <div markdown="1" class="notes">
77
-
78
- You have to type
79
-
80
- &lt;div class="notes"&gt;
81
-
82
- These are my notes for this slide.
83
-
84
- &lt;/div&gt;
85
-
86
- Usually, these optional notes contain the gory details and complicated equations, like $E=m c^2$, too messy to be presented in the main thread of the talk.
87
-
88
- </div>
89
-
90
-
91
- Features II
92
- ---------------------------------------------------
93
-
94
- To get incremental display, use Maruku's [metadata syntax](http://maruku.rubyforge.org/proposal.html)
95
- {: .incremental}
96
-
97
- * Place a `{: .incremental .show-first}` or `{: .incremental}` to get incremental display.
98
-
99
- * This even works with nested lists.
100
- {: .incremental}
101
-
102
- * Yes, all of S5's [other features](http://meyerweb.com/eric/tools/s5/features.html) are there, too.
103
- * Of course, it doesn't have all the garish visual effects of Apple's Keynote.
104
- * If you can't do without garish, tacky, visual effects, there's always SVG.
105
- {: .incremental}