maruku 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/{maruku0.3 → marudown} +6 -14
- data/bin/maruku +1 -1
- data/bin/marutest +37 -9
- data/docs/TOFIX.html +22 -0
- data/docs/TOFIX.md +3 -0
- data/docs/changelog-0.2.13.html +30 -0
- data/docs/changelog-0.2.13.md +6 -0
- data/docs/changelog-0.3.html +19 -5
- data/docs/faq.html +51 -40
- data/docs/faq.md +3 -3
- data/docs/hidden_o_n_squared.md +10 -0
- data/docs/index.html +84 -396
- data/docs/markdown_syntax.html +139 -330
- data/docs/markdown_syntax.md +80 -93
- data/docs/maruku.html +84 -396
- data/docs/maruku.md +88 -158
- data/docs/proposal.html +13 -106
- data/docs/proposal.md +3 -3
- data/docs/todo.html +38 -28
- data/lib/maruku.rb +77 -11
- data/lib/maruku/attributes.rb +186 -0
- data/lib/maruku/defaults.rb +40 -0
- data/lib/maruku/errors_management.rb +55 -39
- data/lib/maruku/helpers.rb +156 -72
- data/lib/maruku/input/charsource.rb +319 -0
- data/lib/maruku/{html_helper.rb → input/html_helper.rb} +30 -9
- data/lib/maruku/input/linesource.rb +111 -0
- data/lib/maruku/input/parse_block.rb +562 -0
- data/lib/maruku/{parse_doc.rb → input/parse_doc.rb} +60 -28
- data/lib/maruku/{parse_span_better.rb → input/parse_span_better.rb} +226 -256
- data/lib/maruku/input/type_detection.rb +137 -0
- data/lib/maruku/maruku.rb +33 -0
- data/lib/maruku/{to_html.rb → output/to_html.rb} +151 -132
- data/lib/maruku/{to_latex.rb → output/to_latex.rb} +31 -35
- data/lib/maruku/{to_latex_entities.rb → output/to_latex_entities.rb} +25 -3
- data/lib/maruku/output/to_latex_strings.rb +64 -0
- data/lib/maruku/output/to_markdown.rb +164 -0
- data/lib/maruku/{to_s.rb → output/to_s.rb} +6 -0
- data/lib/maruku/string_utils.rb +12 -181
- data/lib/maruku/structures.rb +91 -67
- data/lib/maruku/structures_inspect.rb +78 -0
- data/lib/maruku/structures_iterators.rb +24 -2
- data/lib/maruku/tests/benchmark.rb +41 -9
- data/lib/maruku/tests/new_parser.rb +317 -286
- data/lib/maruku/tests/tests.rb +20 -0
- data/lib/maruku/toc.rb +64 -64
- data/lib/maruku/usage/example1.rb +33 -0
- data/lib/maruku/version.rb +8 -2
- data/tests/unittest/abbreviations.md +27 -16
- data/tests/unittest/attributes/attributes.md +89 -0
- data/tests/unittest/attributes/circular.md +51 -0
- data/tests/unittest/attributes/default.md +47 -0
- data/tests/unittest/blank.md +10 -6
- data/tests/unittest/blanks_in_code.md +26 -26
- data/tests/unittest/code.md +9 -9
- data/tests/unittest/code2.md +12 -13
- data/tests/unittest/code3.md +34 -34
- data/tests/unittest/easy.md +9 -7
- data/tests/unittest/email.md +9 -7
- data/tests/unittest/encoding/iso-8859-1.md +41 -4
- data/tests/unittest/encoding/utf-8.md +6 -5
- data/tests/unittest/entities.md +52 -80
- data/tests/unittest/escaping.md +47 -35
- data/tests/unittest/extra_dl.md +19 -29
- data/tests/unittest/extra_header_id.md +31 -24
- data/tests/unittest/extra_table1.md +14 -32
- data/tests/unittest/footnotes.md +58 -42
- data/tests/unittest/headers.md +11 -11
- data/tests/unittest/hrule.md +14 -24
- data/tests/unittest/images.md +41 -26
- data/tests/unittest/inline_html.md +104 -56
- data/tests/unittest/inline_html2.md +38 -0
- data/tests/unittest/links.md +74 -33
- data/tests/unittest/list1.md +18 -15
- data/tests/unittest/list2.md +31 -13
- data/tests/unittest/list3.md +29 -28
- data/tests/unittest/list4.md +103 -12
- data/tests/unittest/lists.md +86 -53
- data/tests/unittest/lists6.md +53 -0
- data/tests/unittest/lists7.md +31 -0
- data/tests/unittest/lists_after_paragraph.md +105 -71
- data/tests/unittest/lists_ol.md +149 -73
- data/tests/unittest/misc_sw.md +366 -326
- data/tests/unittest/notyet/escape.md +10 -10
- data/tests/unittest/notyet/header_after_par.md +20 -14
- data/tests/unittest/notyet/ticks.md +8 -35
- data/tests/unittest/notyet/triggering.md +72 -45
- data/tests/unittest/olist.md +78 -0
- data/tests/unittest/one.md +5 -3
- data/tests/unittest/paragraph.md +5 -3
- data/tests/unittest/paragraph_rules/dont_merge_ref.md +15 -9
- data/tests/unittest/paragraph_rules/tab_is_blank.md +9 -5
- data/tests/unittest/paragraphs.md +21 -26
- data/tests/unittest/recover/recover_links.md +6 -5
- data/tests/unittest/references/long_example.md +39 -30
- data/tests/unittest/references/spaces_and_numbers.md +2 -2
- data/tests/unittest/syntax_hl.md +33 -31
- data/tests/unittest/test.md +4 -6
- data/tests/unittest/wrapping.md +43 -26
- metadata +160 -139
- data/docs/markdown_extra2.html +0 -87
- data/docs/markdown_extra2.md +0 -83
- data/docs/markdown_syntax_2.html +0 -152
- data/lib/maruku/parse_block.rb +0 -564
- data/lib/maruku/parse_span.rb +0 -451
- data/lib/maruku/to_latex_strings.rb +0 -59
- data/lib/maruku/to_markdown.rb +0 -110
- data/lib/test.rb +0 -29
@@ -0,0 +1,47 @@
|
|
1
|
+
This shows the use of default attributes list.
|
2
|
+
*** Parameters: ***
|
3
|
+
{}
|
4
|
+
*** Markdown input: ***
|
5
|
+
Paragraph2
|
6
|
+
{#2}
|
7
|
+
|
8
|
+
{paragraph}: .maruku-par
|
9
|
+
|
10
|
+
*** Output of inspect ***
|
11
|
+
md_el(:document,[
|
12
|
+
md_par(["Paragraph2"], [[:id, "2"]]),
|
13
|
+
md_el(:ald,[],{:ald_id=>"paragraph",:ald=>[[:class, "maruku-par"]]},[])
|
14
|
+
],{},[])
|
15
|
+
*** Output of to_html ***
|
16
|
+
|
17
|
+
<p class='maruku-par' id='2'>Paragraph2</p>
|
18
|
+
|
19
|
+
*** Output of to_latex ***
|
20
|
+
Paragraph2
|
21
|
+
|
22
|
+
|
23
|
+
*** Output of to_md ***
|
24
|
+
Paragraph2
|
25
|
+
|
26
|
+
|
27
|
+
*** Output of to_s ***
|
28
|
+
Paragraph2
|
29
|
+
*** EOF ***
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
OK!
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
*** Output of Markdown.pl ***
|
38
|
+
<p>Paragraph2
|
39
|
+
{#2}</p>
|
40
|
+
|
41
|
+
<p>{paragraph}: .maruku-par</p>
|
42
|
+
|
43
|
+
*** Output of Markdown.pl (parsed) ***
|
44
|
+
<p>Paragraph2
|
45
|
+
{#2}</p
|
46
|
+
><p>{paragraph}: .maruku-par</p
|
47
|
+
>
|
data/tests/unittest/blank.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Write a comment
|
1
|
+
Write a comment about the test here.
|
2
2
|
*** Parameters: ***
|
3
3
|
{}
|
4
4
|
*** Markdown input: ***
|
@@ -7,7 +7,7 @@ Linea 1
|
|
7
7
|
|
8
8
|
Linea 2
|
9
9
|
*** Output of inspect ***
|
10
|
-
md_el(:document,[md_par(["Linea 1"]), md_par(["Linea 2"])]
|
10
|
+
md_el(:document,[md_par(["Linea 1"]), md_par(["Linea 2"])],{},[])
|
11
11
|
*** Output of to_html ***
|
12
12
|
|
13
13
|
<p>Linea 1</p>
|
@@ -20,8 +20,12 @@ Linea 1
|
|
20
20
|
Linea 2
|
21
21
|
|
22
22
|
|
23
|
-
*** Output of
|
24
|
-
Linea
|
23
|
+
*** Output of to_md ***
|
24
|
+
Linea 1
|
25
|
+
|
26
|
+
Linea 2
|
27
|
+
|
28
|
+
|
25
29
|
*** Output of to_s ***
|
26
30
|
Linea 1Linea 2
|
27
31
|
*** EOF ***
|
@@ -39,5 +43,5 @@ Linea 1Linea 2
|
|
39
43
|
|
40
44
|
*** Output of Markdown.pl (parsed) ***
|
41
45
|
<p>Linea 1</p
|
42
|
-
|
43
|
-
|
46
|
+
><p>Linea 2</p
|
47
|
+
>
|
@@ -27,34 +27,28 @@ This block is composed of 2
|
|
27
27
|
*** Output of inspect ***
|
28
28
|
md_el(:document,[
|
29
29
|
md_par(["This block is composed of three lines:"]),
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
]
|
30
|
+
md_el(:code,[],{:raw_code=>"one\n\nthree\n"},[]),
|
31
|
+
md_par(["This block is composed of 5"]),
|
32
|
+
md_el(:code,[],{:raw_code=>"one\n\n\nfour\n\n"},[]),
|
33
|
+
md_par(["This block is composed of 2"]),
|
34
|
+
md_el(:code,[],{:raw_code=>"two"},[])
|
35
|
+
],{},[])
|
36
36
|
*** Output of to_html ***
|
37
37
|
|
38
38
|
<p>This block is composed of three lines:</p>
|
39
|
-
|
40
39
|
<pre><code>one
|
41
40
|
|
42
41
|
three
|
43
42
|
</code></pre>
|
44
|
-
|
45
43
|
<p>This block is composed of 5</p>
|
46
|
-
|
47
44
|
<pre><code>one
|
48
45
|
|
49
46
|
|
50
47
|
four
|
51
48
|
|
52
49
|
</code></pre>
|
53
|
-
|
54
50
|
<p>This block is composed of 2</p>
|
55
|
-
|
56
51
|
<pre><code>two</code></pre>
|
57
|
-
|
58
52
|
*** Output of to_latex ***
|
59
53
|
This block is composed of three lines:
|
60
54
|
|
@@ -74,8 +68,14 @@ This block is composed of 2
|
|
74
68
|
|
75
69
|
\begin{verbatim}two\end{verbatim}
|
76
70
|
|
77
|
-
*** Output of
|
78
|
-
This block is composed of three lines:
|
71
|
+
*** Output of to_md ***
|
72
|
+
This block is composed of three lines:
|
73
|
+
|
74
|
+
This block is composed of 5
|
75
|
+
|
76
|
+
This block is composed of 2
|
77
|
+
|
78
|
+
|
79
79
|
*** Output of to_s ***
|
80
80
|
This block is composed of three lines:This block is composed of 5This block is composed of 2
|
81
81
|
*** EOF ***
|
@@ -109,23 +109,23 @@ four
|
|
109
109
|
|
110
110
|
*** Output of Markdown.pl (parsed) ***
|
111
111
|
<p>This block is composed of three lines:</p
|
112
|
-
|
113
|
-
|
112
|
+
><pre
|
113
|
+
><code>one
|
114
114
|
|
115
115
|
three
|
116
116
|
</code
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
117
|
+
></pre
|
118
|
+
><p>This block is composed of 5</p
|
119
|
+
><pre
|
120
|
+
><code>one
|
121
121
|
|
122
122
|
|
123
123
|
four
|
124
124
|
</code
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
125
|
+
></pre
|
126
|
+
><p>This block is composed of 2</p
|
127
|
+
><pre
|
128
|
+
><code>two
|
129
129
|
</code
|
130
|
-
|
131
|
-
|
130
|
+
></pre
|
131
|
+
>
|
data/tests/unittest/code.md
CHANGED
@@ -12,17 +12,15 @@ Here is an example of AppleScript:
|
|
12
12
|
*** Output of inspect ***
|
13
13
|
md_el(:document,[
|
14
14
|
md_par(["Here is an example of AppleScript:"]),
|
15
|
-
|
16
|
-
]
|
15
|
+
md_el(:code,[],{:raw_code=>"tell application \"Foo\"\n beep\nend tell\n\ttab"},[])
|
16
|
+
],{},[])
|
17
17
|
*** Output of to_html ***
|
18
18
|
|
19
19
|
<p>Here is an example of AppleScript:</p>
|
20
|
-
|
21
20
|
<pre><code>tell application "Foo"
|
22
21
|
beep
|
23
22
|
end tell
|
24
23
|
tab</code></pre>
|
25
|
-
|
26
24
|
*** Output of to_latex ***
|
27
25
|
Here is an example of AppleScript:
|
28
26
|
|
@@ -31,8 +29,10 @@ Here is an example of AppleScript:
|
|
31
29
|
end tell
|
32
30
|
tab\end{verbatim}
|
33
31
|
|
34
|
-
*** Output of
|
32
|
+
*** Output of to_md ***
|
35
33
|
Here is an example of AppleScript:
|
34
|
+
|
35
|
+
|
36
36
|
*** Output of to_s ***
|
37
37
|
Here is an example of AppleScript:
|
38
38
|
*** EOF ***
|
@@ -54,11 +54,11 @@ end tell
|
|
54
54
|
|
55
55
|
*** Output of Markdown.pl (parsed) ***
|
56
56
|
<p>Here is an example of AppleScript:</p
|
57
|
-
|
58
|
-
|
57
|
+
><pre
|
58
|
+
><code>tell application "Foo"
|
59
59
|
beep
|
60
60
|
end tell
|
61
61
|
tab
|
62
62
|
</code
|
63
|
-
|
64
|
-
|
63
|
+
></pre
|
64
|
+
>
|
data/tests/unittest/code2.md
CHANGED
@@ -7,15 +7,13 @@ Write a comment abouth the test here.
|
|
7
7
|
> Ciao
|
8
8
|
*** Output of inspect ***
|
9
9
|
md_el(:document,[
|
10
|
-
md_el(:quote,[md_par(["Code"]), md_el(:code,[]
|
11
|
-
]
|
10
|
+
md_el(:quote,[md_par(["Code"]), md_el(:code,[],{:raw_code=>"Ciao"},[])],{},[])
|
11
|
+
],{},[])
|
12
12
|
*** Output of to_html ***
|
13
13
|
|
14
14
|
<blockquote>
|
15
15
|
<p>Code</p>
|
16
|
-
|
17
|
-
<pre><code>Ciao</code></pre>
|
18
|
-
</blockquote>
|
16
|
+
<pre><code>Ciao</code></pre></blockquote>
|
19
17
|
|
20
18
|
*** Output of to_latex ***
|
21
19
|
\begin{quote}%
|
@@ -25,8 +23,10 @@ Code
|
|
25
23
|
|
26
24
|
\end{quote}
|
27
25
|
|
28
|
-
*** Output of
|
26
|
+
*** Output of to_md ***
|
29
27
|
Code
|
28
|
+
|
29
|
+
|
30
30
|
*** Output of to_s ***
|
31
31
|
Code
|
32
32
|
*** EOF ***
|
@@ -47,13 +47,12 @@ Code
|
|
47
47
|
|
48
48
|
*** Output of Markdown.pl (parsed) ***
|
49
49
|
<blockquote>
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
<p>Code</p
|
51
|
+
>
|
53
52
|
<pre
|
54
|
-
|
53
|
+
><code>Ciao
|
55
54
|
</code
|
56
|
-
|
57
|
-
|
55
|
+
></pre
|
56
|
+
>
|
58
57
|
</blockquote
|
59
|
-
|
58
|
+
>
|
data/tests/unittest/code3.md
CHANGED
@@ -22,33 +22,25 @@ This is not code
|
|
22
22
|
*** Output of inspect ***
|
23
23
|
md_el(:document,[
|
24
24
|
md_par(["This is code (4 spaces):"]),
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
]
|
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
33
|
*** Output of to_html ***
|
34
34
|
|
35
35
|
<p>This is code (4 spaces):</p>
|
36
|
-
|
37
36
|
<pre><code>Code</code></pre>
|
38
|
-
|
39
37
|
<p>This is not code</p>
|
40
|
-
|
41
38
|
<pre><code>Code
|
42
39
|
</code></pre>
|
43
|
-
|
44
40
|
<p>This is code (1 tab):</p>
|
45
|
-
|
46
41
|
<pre><code>Code</code></pre>
|
47
|
-
|
48
42
|
<p>This is not code</p>
|
49
|
-
|
50
43
|
<pre><code>Code</code></pre>
|
51
|
-
|
52
44
|
*** Output of to_latex ***
|
53
45
|
This is code (4 spaces):
|
54
46
|
|
@@ -64,8 +56,16 @@ This is not code
|
|
64
56
|
|
65
57
|
\begin{verbatim}Code\end{verbatim}
|
66
58
|
|
67
|
-
*** Output of
|
68
|
-
This is code (4 spaces):
|
59
|
+
*** Output of to_md ***
|
60
|
+
This is code (4 spaces):
|
61
|
+
|
62
|
+
This is not code
|
63
|
+
|
64
|
+
This is code (1 tab):
|
65
|
+
|
66
|
+
This is not code
|
67
|
+
|
68
|
+
|
69
69
|
*** Output of to_s ***
|
70
70
|
This is code (4 spaces):This is not codeThis is code (1 tab):This is not code
|
71
71
|
*** EOF ***
|
@@ -99,23 +99,23 @@ This is code (4 spaces):This is not codeThis is code (1 tab):This is not code
|
|
99
99
|
|
100
100
|
*** Output of Markdown.pl (parsed) ***
|
101
101
|
<p>This is code (4 spaces):</p
|
102
|
-
|
103
|
-
|
102
|
+
><pre
|
103
|
+
><code>Code
|
104
104
|
</code
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
></pre
|
106
|
+
><p>This is not code</p
|
107
|
+
><pre
|
108
|
+
><code>Code
|
109
109
|
</code
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
></pre
|
111
|
+
><p>This is code (1 tab):</p
|
112
|
+
><pre
|
113
|
+
><code>Code
|
114
114
|
</code
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
></pre
|
116
|
+
><p>This is not code</p
|
117
|
+
><pre
|
118
|
+
><code>Code
|
119
119
|
</code
|
120
|
-
|
121
|
-
|
120
|
+
></pre
|
121
|
+
>
|
data/tests/unittest/easy.md
CHANGED
@@ -4,7 +4,7 @@ Simple test for emphasis.
|
|
4
4
|
*** Markdown input: ***
|
5
5
|
*Hello!* how are **you**?
|
6
6
|
*** Output of inspect ***
|
7
|
-
md_el(:document,[md_par([md_em(["Hello!"]), " how are ", md_strong(["you"]), "?"])]
|
7
|
+
md_el(:document,[md_par([md_em(["Hello!"]), " how are ", md_strong(["you"]), "?"])],{},[])
|
8
8
|
*** Output of to_html ***
|
9
9
|
|
10
10
|
<p><em>Hello!</em> how are <strong>you</strong>?</p>
|
@@ -13,8 +13,10 @@ md_el(:document,[md_par([md_em(["Hello!"]), " how are ", md_strong(["you"]), "?"
|
|
13
13
|
{\em Hello!} how are {\bf you}?
|
14
14
|
|
15
15
|
|
16
|
-
*** Output of
|
17
|
-
Hello!
|
16
|
+
*** Output of to_md ***
|
17
|
+
Hello!how are you?
|
18
|
+
|
19
|
+
|
18
20
|
*** Output of to_s ***
|
19
21
|
Hello! how are you?
|
20
22
|
*** EOF ***
|
@@ -30,7 +32,7 @@ Hello! how are you?
|
|
30
32
|
|
31
33
|
*** Output of Markdown.pl (parsed) ***
|
32
34
|
<p
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
><em>Hello!</em
|
36
|
+
> how are <strong>you</strong
|
37
|
+
>?</p
|
38
|
+
>
|
data/tests/unittest/email.md
CHANGED
@@ -9,7 +9,7 @@ This is an email address: <andrea@invalid.it>
|
|
9
9
|
*** Output of inspect ***
|
10
10
|
md_el(:document,[
|
11
11
|
md_par(["This is an email address: ", md_email("andrea@invalid.it")])
|
12
|
-
]
|
12
|
+
],{},[])
|
13
13
|
*** Output of to_html ***
|
14
14
|
|
15
15
|
<p>This is an email address: <a href='mailto:andrea@invalid.it'>andrea@invalid.it</a></p>
|
@@ -18,8 +18,10 @@ md_el(:document,[
|
|
18
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
19
|
|
20
20
|
|
21
|
-
*** Output of
|
22
|
-
This is an email address:
|
21
|
+
*** Output of to_md ***
|
22
|
+
This is an email address:
|
23
|
+
|
24
|
+
|
23
25
|
*** Output of to_s ***
|
24
26
|
This is an email address:
|
25
27
|
*** EOF ***
|
@@ -31,9 +33,9 @@ This is an email address:
|
|
31
33
|
|
32
34
|
|
33
35
|
*** Output of Markdown.pl ***
|
34
|
-
<p>This is an email address: <a href="
|
36
|
+
<p>This is an email address: <a href="mailto:andrea@invalid.it">andrea@invalid.it</a></p>
|
35
37
|
|
36
38
|
*** Output of Markdown.pl (parsed) ***
|
37
|
-
<p>This is an email address: <a href='
|
38
|
-
|
39
|
-
|
39
|
+
<p>This is an email address: <a href='&#x6D;a&#x69;&#x6C;&#x74;&#x6F;:&#97;&#x6E;&#100;&#x72;&#x65;&#x61;&#64;&#x69;n&#x76;&#97;&#x6C;&#x69;&#x64;&#x2E;&#x69;t'>andrea@invalid.it</a
|
40
|
+
></p
|
41
|
+
>
|