maruku 0.3.0 → 0.4.0

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