maruku 0.5.2 → 0.5.3
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.
- data/Rakefile +73 -0
- data/bin/marutest +13 -13
- data/docs/changelog.html +35 -3
- data/docs/changelog.md +21 -2
- data/docs/entity_test.html +1 -1
- data/docs/exd.html +3 -3
- data/docs/index.html +4 -4
- data/docs/markdown_syntax.html +1 -1
- data/docs/maruku.html +4 -4
- data/docs/maruku.md +7 -2
- data/docs/proposal.html +1 -1
- data/docs/tmp.md +2 -0
- data/lib/maruku/attributes.rb +6 -3
- data/lib/maruku/input/parse_block.rb +5 -4
- data/lib/maruku/input/parse_span_better.rb +1 -1
- data/lib/maruku/input/type_detection.rb +2 -2
- data/lib/maruku/output/to_html.rb +2 -1
- data/lib/maruku/output/to_latex.rb +7 -8
- data/lib/maruku/output/to_latex_entities.rb +4 -4
- data/lib/maruku/tests/new_parser.rb +13 -6
- data/lib/maruku/version.rb +1 -1
- data/tests/diagrams/diagrams.md +248 -0
- data/tests/unittest/bug_def.md +36 -0
- data/tests/unittest/bug_table.md +77 -0
- data/tests/unittest/email.md +2 -2
- data/tests/unittest/entities.md +5 -5
- data/tests/unittest/footnotes.md +3 -3
- data/tests/unittest/images.md +1 -1
- data/tests/unittest/links.md +1 -1
- data/tests/unittest/list2.md +1 -1
- data/tests/unittest/lists.md +1 -1
- data/tests/unittest/lists_ol.md +1 -1
- data/tests/unittest/math/inline.md +1 -1
- data/tests/unittest/math/table2.md +1 -1
- data/tests/unittest/misc_sw.md +3 -3
- data/tests/unittest/references/long_example.md +2 -2
- data/tests/unittest/smartypants.md +4 -4
- data/tests/unittest/table_attributes.md +59 -0
- metadata +8 -3
@@ -762,7 +762,8 @@ of the form `#ff00ff`.
|
|
762
762
|
i += num_columns
|
763
763
|
end
|
764
764
|
|
765
|
-
table = create_html_element 'table'
|
765
|
+
table = create_html_element 'table',
|
766
|
+
[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]
|
766
767
|
thead = Element.new 'thead'
|
767
768
|
tr = Element.new 'tr'
|
768
769
|
array_to_html(head).each do |x| tr<<x end
|
@@ -127,7 +127,6 @@ will produce:
|
|
127
127
|
\\usepackage{hyperref}
|
128
128
|
\\usepackage{xspace}
|
129
129
|
\\usepackage[usenames,dvipsnames]{color}
|
130
|
-
\\usepackage[margin=1in]{geometry}
|
131
130
|
\\hypersetup{colorlinks=true,urlcolor=blue}
|
132
131
|
|
133
132
|
#{user_preamble}
|
@@ -550,13 +549,13 @@ Otherwise, a standard `verbatim` environment is used.
|
|
550
549
|
end
|
551
550
|
|
552
551
|
# puts a space after commands if needed
|
553
|
-
e.each_index do |i|
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
end
|
552
|
+
# e.each_index do |i|
|
553
|
+
# if e[i] =~ /\\\w+\s*$/ # command
|
554
|
+
# if (s=e[i+1]) && s[0] == ?\ # space
|
555
|
+
# e[i] = e[i] + "\\ "
|
556
|
+
# end
|
557
|
+
# end
|
558
|
+
# end
|
560
559
|
|
561
560
|
e.join(join_char)
|
562
561
|
end
|
@@ -42,12 +42,12 @@ module MaRuKu; module Out; module Latex
|
|
42
42
|
@doc.latex_require_package p
|
43
43
|
end
|
44
44
|
|
45
|
-
if replace =~ /^\\/
|
46
|
-
replace = replace + " "
|
47
|
-
end
|
45
|
+
# if replace =~ /^\\/
|
46
|
+
# replace = replace + " "
|
47
|
+
# end
|
48
48
|
|
49
49
|
if replace
|
50
|
-
return replace
|
50
|
+
return replace + "{}"
|
51
51
|
else
|
52
52
|
tell_user "Cannot translate entity #{entity_name.inspect} to LaTeX."
|
53
53
|
return entity_name
|
@@ -266,8 +266,8 @@ module MaRuKu; module Tests
|
|
266
266
|
# ['$ 20,000$', ['$ 20,000$']],
|
267
267
|
# ['$20,000 $ $20,000$', ['$20,000 $ ', md_inline_math('20,000')]],
|
268
268
|
["#{Maruku8}", [Maruku8], "Reading UTF-8"],
|
269
|
-
["#{AccIta1}", [AccIta8], "Converting ISO-8859-1 to UTF-8",
|
270
|
-
{:encoding => 'iso-8859-1'}],
|
269
|
+
# ["#{AccIta1}", [AccIta8], "Converting ISO-8859-1 to UTF-8",
|
270
|
+
# {:encoding => 'iso-8859-1'}],
|
271
271
|
|
272
272
|
]
|
273
273
|
|
@@ -294,6 +294,7 @@ module MaRuKu; module Tests
|
|
294
294
|
m.attributes[:on_error] = :raise
|
295
295
|
Globals[:debug_keep_ials] = true
|
296
296
|
|
297
|
+
num_ok = 0
|
297
298
|
good_cases.each do |input, expected, comment|
|
298
299
|
output = nil
|
299
300
|
begin
|
@@ -309,6 +310,7 @@ module MaRuKu; module Tests
|
|
309
310
|
raise e if @break_on_first_error
|
310
311
|
else
|
311
312
|
quiet || print_status(comment,'OK')
|
313
|
+
num_ok += 1
|
312
314
|
end
|
313
315
|
end
|
314
316
|
|
@@ -318,6 +320,7 @@ module MaRuKu; module Tests
|
|
318
320
|
print_status(comment, 'FAILED', s)
|
319
321
|
break if break_on_first_error
|
320
322
|
else
|
323
|
+
num_ok += 1
|
321
324
|
quiet || print_status(comment, 'OK')
|
322
325
|
end
|
323
326
|
else # I expected a raise
|
@@ -327,8 +330,12 @@ module MaRuKu; module Tests
|
|
327
330
|
print_status(comment, 'FAILED (no throw)', s)
|
328
331
|
break if break_on_first_error
|
329
332
|
end
|
330
|
-
end
|
331
|
-
|
333
|
+
end
|
334
|
+
end # do
|
335
|
+
if num_ok != good_cases.size
|
336
|
+
return false
|
337
|
+
else
|
338
|
+
return true
|
332
339
|
end
|
333
340
|
end
|
334
341
|
|
@@ -358,6 +365,6 @@ end
|
|
358
365
|
verbose = ARGV.include? 'v'
|
359
366
|
break_on_first = ARGV.include? 'b'
|
360
367
|
quiet = ARGV.include? 'q'
|
361
|
-
Maruku.new.test_span_parser(verbose, break_on_first, quiet)
|
362
|
-
|
368
|
+
ok = Maruku.new.test_span_parser(verbose, break_on_first, quiet)
|
363
369
|
|
370
|
+
exit (ok ? 0 : 1)
|
data/lib/maruku/version.rb
CHANGED
data/tests/diagrams/diagrams.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
Write a comment here
|
2
|
+
*** Parameters: ***
|
3
|
+
{} # params
|
4
|
+
*** Markdown input: ***
|
1
5
|
|
2
6
|
I would like to add a syntax for drawing basic diagrams
|
3
7
|
and convert them to PNG/PDF/SVG.
|
@@ -52,3 +56,247 @@ Or
|
|
52
56
|
|
53
57
|
|
54
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 | ---> | Compiler | ==> ...
|
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: +-> | Yes: | ___________________ / | is the agent ok? | –| ————–+</p>
|
104
|
+
|
105
|
+
<pre><code>{:r: border="solid 3px red"}
|
106
|
+
</code></pre>
|
107
|
+
|
108
|
+
<p>Big boxes:</p>
|
109
|
+
|
110
|
+
<pre><code>+-------+
|
111
|
+
|{:long}| --->
|
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 | ---> | 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 | ---> | Compiler | ==> ...
|
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}| --->
|
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 | ---> | 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 | ---> | Compiler | ==> ...
|
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}| --->
|
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 | ---> | Box |
|
293
|
+
| long cell | |________|
|
294
|
+
+----------------+
|
295
|
+
- Yes
|
296
|
+
/
|
297
|
+
-------+
|
298
|
+
\
|
299
|
+
- No
|
300
|
+
</code
|
301
|
+
></pre
|
302
|
+
>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Write a comment here
|
2
|
+
*** Parameters: ***
|
3
|
+
{} # params
|
4
|
+
*** Markdown input: ***
|
5
|
+
[test][]:
|
6
|
+
|
7
|
+
*** Output of inspect ***
|
8
|
+
md_el(:document,[md_par([md_link(["test"],"test"), ":"])],{},[])
|
9
|
+
*** Output of to_html ***
|
10
|
+
|
11
|
+
<p><span>test</span>:</p>
|
12
|
+
|
13
|
+
*** Output of to_latex ***
|
14
|
+
test:
|
15
|
+
|
16
|
+
|
17
|
+
*** Output of to_md ***
|
18
|
+
test:
|
19
|
+
|
20
|
+
|
21
|
+
*** Output of to_s ***
|
22
|
+
test:
|
23
|
+
*** EOF ***
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
OK!
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
*** Output of Markdown.pl ***
|
32
|
+
<p>[test][]:</p>
|
33
|
+
|
34
|
+
*** Output of Markdown.pl (parsed) ***
|
35
|
+
<p>[test][]:</p
|
36
|
+
>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Write a comment here
|
2
|
+
*** Parameters: ***
|
3
|
+
{} # params
|
4
|
+
*** Markdown input: ***
|
5
|
+
|
6
|
+
|
7
|
+
hello
|
8
|
+
{: summary="Table summary" .class1 style="color:red"}
|
9
|
+
|
10
|
+
h | h
|
11
|
+
----------|--
|
12
|
+
{:t} c1 | c2
|
13
|
+
{: summary="Table summary" .class1 style="color:red"}
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
{:t: scope="row"}
|
18
|
+
*** Output of inspect ***
|
19
|
+
md_el(:document,[
|
20
|
+
md_par(["hello"], [["summary", "Table summary"], [:class, "class1"], ["style", "color:red"]]),
|
21
|
+
md_el(:table,[
|
22
|
+
md_el(:head_cell,["h"],{},[]),
|
23
|
+
md_el(:head_cell,["h"],{},[]),
|
24
|
+
md_el(:cell,[" c1"],{},[[:ref, "t"]]),
|
25
|
+
md_el(:cell,["c2"],{},[])
|
26
|
+
],{:align=>[:left, :left]},[["summary", "Table summary"], [:class, "class1"], ["style", "color:red"]]),
|
27
|
+
md_el(:ald,[],{:ald=>[["scope", "row"]],:ald_id=>"t"},[])
|
28
|
+
],{},[])
|
29
|
+
*** Output of to_html ***
|
30
|
+
|
31
|
+
<p class='class1' style='color:red'>hello</p>
|
32
|
+
<table class='class1' summary='Table summary' style='color:red'><thead><tr><th>h</th><th>h</th></tr></thead><tbody><tr><th scope='row' style='text-align: left;'> c1</th><td style='text-align: left;'>c2</td>
|
33
|
+
</tr></tbody></table>
|
34
|
+
*** Output of to_latex ***
|
35
|
+
hello
|
36
|
+
|
37
|
+
\begin{tabular}{l|l}
|
38
|
+
h&h\\
|
39
|
+
\hline
|
40
|
+
c1&c2\\
|
41
|
+
\end{tabular}
|
42
|
+
|
43
|
+
|
44
|
+
*** Output of to_md ***
|
45
|
+
hello
|
46
|
+
|
47
|
+
hh c1c2
|
48
|
+
*** Output of to_s ***
|
49
|
+
hellohh c1c2
|
50
|
+
*** EOF ***
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
OK!
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
*** Output of Markdown.pl ***
|
59
|
+
<p>hello
|
60
|
+
{: summary="Table summary" .class1 style="color:red"}</p>
|
61
|
+
|
62
|
+
<p>h | h
|
63
|
+
----------|--
|
64
|
+
{:t} c1 | c2
|
65
|
+
{: summary="Table summary" .class1 style="color:red"}</p>
|
66
|
+
|
67
|
+
<p>{:t: scope="row"}</p>
|
68
|
+
|
69
|
+
*** Output of Markdown.pl (parsed) ***
|
70
|
+
<p>hello
|
71
|
+
{: summary="Table summary" .class1 style="color:red"}</p
|
72
|
+
><p>h | h
|
73
|
+
----------|--
|
74
|
+
{:t} c1 | c2
|
75
|
+
{: summary="Table summary" .class1 style="color:red"}</p
|
76
|
+
><p>{:t: scope="row"}</p
|
77
|
+
>
|