maruku 0.4.1 → 0.4.2
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/bin/maruku +41 -25
- data/docs/char.html +1924 -0
- data/docs/entity_test.html +2 -2
- data/docs/exd.html +92 -0
- data/docs/index.html +77 -23
- data/docs/markdown_syntax.html +6 -6
- data/docs/maruku.html +75 -21
- data/docs/maruku.md +60 -26
- data/docs/proposal.html +105 -123
- data/docs/proposal.md +121 -109
- data/lib/maruku/attributes.rb +33 -1
- data/lib/maruku/defaults.rb +8 -0
- data/lib/maruku/input/charsource.rb +8 -2
- data/lib/maruku/input/parse_block.rb +44 -18
- data/lib/maruku/input/parse_doc.rb +28 -26
- data/lib/maruku/input/parse_span_better.rb +57 -41
- data/lib/maruku/input/type_detection.rb +3 -2
- data/lib/maruku/output/to_html.rb +6 -6
- data/lib/maruku/output/to_latex.rb +21 -5
- data/lib/maruku/structures.rb +0 -4
- data/lib/maruku/tests/new_parser.rb +6 -1
- data/lib/maruku/version.rb +1 -1
- data/tests/unittest/attributes/att2.md +36 -0
- data/tests/unittest/attributes/att3.md +55 -0
- data/tests/unittest/attributes/attributes.md +23 -18
- data/tests/unittest/attributes/circular.md +9 -9
- data/tests/unittest/email.md +2 -2
- data/tests/unittest/links.md +2 -2
- data/tests/unittest/misc_sw.md +1 -1
- data/tests/unittest/syntax_hl.md +3 -5
- data/tests/unittest/xml_instruction.md +1 -2
- metadata +6 -2
@@ -65,11 +65,11 @@ You have to have these fonts installed -- and this can be a pain.
|
|
65
65
|
|
66
66
|
If `latex_cjk` is specified, this is added to the preamble:
|
67
67
|
|
68
|
-
<?mrk
|
68
|
+
<?mrk md_codeblock(Maruku::MDDocument::Latex_preamble_enc_cjk) ?>
|
69
69
|
|
70
70
|
while the default is to add this:
|
71
71
|
|
72
|
-
<?mrk
|
72
|
+
<?mrk md_codeblock(Maruku::MDDocument::Latex_preamble_enc_utf8) ?>
|
73
73
|
|
74
74
|
=end
|
75
75
|
encoding = @doc.attributes[:latex_cjk] ?
|
@@ -107,13 +107,14 @@ will produce:
|
|
107
107
|
% Packages required by code
|
108
108
|
#{required}
|
109
109
|
|
110
|
-
|
111
|
-
|
110
|
+
% Packages always used
|
112
111
|
\\usepackage{hyperref}
|
113
112
|
\\usepackage{xspace}
|
114
113
|
\\usepackage[usenames,dvipsnames]{color}
|
115
114
|
\\usepackage[margin=1in]{geometry}
|
116
|
-
\\hypersetup{colorlinks=true}
|
115
|
+
\\hypersetup{colorlinks=true,urlcolor=blue}
|
116
|
+
|
117
|
+
#{user_preamble}
|
117
118
|
|
118
119
|
\\begin{document}
|
119
120
|
#{body}
|
@@ -316,6 +317,21 @@ Otherwise, a standard `verbatim` environment is used.
|
|
316
317
|
"#{colorspec}{\\tt #{s}}"
|
317
318
|
end
|
318
319
|
|
320
|
+
def to_latex_immediate_link
|
321
|
+
a = create_html_element 'a'
|
322
|
+
url = self.url
|
323
|
+
text = url.gsub(/^mailto:/,'') # don't show mailto
|
324
|
+
# gsub('~','$\sim$')
|
325
|
+
text = latex_escape(text)
|
326
|
+
if url[0,1] == '#'
|
327
|
+
url = url[1,url.size]
|
328
|
+
return "\\hyperlink{#{url}}{#{text}}"
|
329
|
+
else
|
330
|
+
|
331
|
+
return "\\href{#{url}}{#{text}}"
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
319
335
|
def to_latex_im_link
|
320
336
|
url = self.url
|
321
337
|
|
data/lib/maruku/structures.rb
CHANGED
@@ -48,10 +48,6 @@ end
|
|
48
48
|
|
49
49
|
module MaRuKu
|
50
50
|
|
51
|
-
Globals = {
|
52
|
-
:unsafe_features => false,
|
53
|
-
}
|
54
|
-
|
55
51
|
# I did not want to have a class for each possible element.
|
56
52
|
# Instead I opted to have only the class "MDElement"
|
57
53
|
# that represents eveything in the document (paragraphs, headers, etc).
|
@@ -210,6 +210,7 @@ module MaRuKu; module Tests
|
|
210
210
|
["![a][ imref ]"],
|
211
211
|
["![a][\timref\t]"],
|
212
212
|
|
213
|
+
|
213
214
|
['<http://example.com/?foo=1&bar=2>',
|
214
215
|
[md_url('http://example.com/?foo=1&bar=2')], 'Immediate link'],
|
215
216
|
['a<http://example.com/?foo=1&bar=2>b',
|
@@ -217,7 +218,8 @@ module MaRuKu; module Tests
|
|
217
218
|
['<andrea@censi.org>',
|
218
219
|
[md_email('andrea@censi.org')], 'Email address'],
|
219
220
|
['<mailto:andrea@censi.org>'],
|
220
|
-
|
221
|
+
["Developmen <http://rubyforge.org/projects/maruku/>",
|
222
|
+
["Developmen ", md_url("http://rubyforge.org/projects/maruku/")]],
|
221
223
|
["a<!-- -->b", ['a',md_html('<!-- -->'),'b'],
|
222
224
|
'HTML Comment'],
|
223
225
|
|
@@ -258,6 +260,7 @@ module MaRuKu; module Tests
|
|
258
260
|
["#{Maruku8}", [Maruku8], "Reading UTF-8"],
|
259
261
|
["#{AccIta1}", [AccIta8], "Converting ISO-8859-1 to UTF-8",
|
260
262
|
{:encoding => 'iso-8859-1'}],
|
263
|
+
|
261
264
|
]
|
262
265
|
|
263
266
|
good_cases = unit_tests_for_attribute_lists + good_cases
|
@@ -276,10 +279,12 @@ module MaRuKu; module Tests
|
|
276
279
|
end
|
277
280
|
end
|
278
281
|
|
282
|
+
|
279
283
|
|
280
284
|
@verbose = verbose
|
281
285
|
m = Maruku.new
|
282
286
|
m.attributes[:on_error] = :raise
|
287
|
+
Globals[:debug_keep_ials] = true
|
283
288
|
|
284
289
|
good_cases.each do |input, expected, comment|
|
285
290
|
output = nil
|
data/lib/maruku/version.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
*** Parameters: ***
|
3
|
+
{}
|
4
|
+
*** Markdown input: ***
|
5
|
+
{a}: a
|
6
|
+
{:b: a}
|
7
|
+
|
8
|
+
*** Output of inspect ***
|
9
|
+
md_el(:document,[
|
10
|
+
md_el(:ald,[],{:ald=>[[:ref, "a"]],:ald_id=>"a"},[]),
|
11
|
+
md_el(:ald,[],{:ald=>[[:ref, "a"]],:ald_id=>"b"},[])
|
12
|
+
],{},[])
|
13
|
+
*** Output of to_html ***
|
14
|
+
|
15
|
+
*** Output of to_latex ***
|
16
|
+
|
17
|
+
*** Output of to_md ***
|
18
|
+
|
19
|
+
*** Output of to_s ***
|
20
|
+
|
21
|
+
*** EOF ***
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
OK!
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
*** Output of Markdown.pl ***
|
30
|
+
<p>{a}: a
|
31
|
+
{:b: a}</p>
|
32
|
+
|
33
|
+
*** Output of Markdown.pl (parsed) ***
|
34
|
+
<p>{a}: a
|
35
|
+
{:b: a}</p
|
36
|
+
>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
IALs can refer to element before or after.
|
2
|
+
*** Parameters: ***
|
3
|
+
{}
|
4
|
+
*** Markdown input: ***
|
5
|
+
Paragraph1
|
6
|
+
{:#par1}
|
7
|
+
|
8
|
+
{:#par2}
|
9
|
+
Paragraph2
|
10
|
+
*** Output of inspect ***
|
11
|
+
md_el(:document,[
|
12
|
+
md_par(["Paragraph1"], [[:id, "par1"]]),
|
13
|
+
md_par(["Paragraph2"], [[:id, "par2"]])
|
14
|
+
],{},[])
|
15
|
+
*** Output of to_html ***
|
16
|
+
|
17
|
+
<p id='par1'>Paragraph1</p>
|
18
|
+
|
19
|
+
<p id='par2'>Paragraph2</p>
|
20
|
+
|
21
|
+
*** Output of to_latex ***
|
22
|
+
Paragraph1
|
23
|
+
|
24
|
+
Paragraph2
|
25
|
+
|
26
|
+
|
27
|
+
*** Output of to_md ***
|
28
|
+
Paragraph1
|
29
|
+
|
30
|
+
Paragraph2
|
31
|
+
|
32
|
+
|
33
|
+
*** Output of to_s ***
|
34
|
+
Paragraph1Paragraph2
|
35
|
+
*** EOF ***
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
OK!
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
*** Output of Markdown.pl ***
|
44
|
+
<p>Paragraph1
|
45
|
+
{:#par1}</p>
|
46
|
+
|
47
|
+
<p>{:#par2}
|
48
|
+
Paragraph2</p>
|
49
|
+
|
50
|
+
*** Output of Markdown.pl (parsed) ***
|
51
|
+
<p>Paragraph1
|
52
|
+
{:#par1}</p
|
53
|
+
><p>{:#par2}
|
54
|
+
Paragraph2</p
|
55
|
+
>
|
@@ -10,24 +10,21 @@ Header with attributes {#header1}
|
|
10
10
|
|
11
11
|
### Header no attributes ###
|
12
12
|
|
13
|
-
{warn2}Paragraph with a.
|
13
|
+
{:warn2}Paragraph with a.
|
14
14
|
{#par1}
|
15
15
|
|
16
16
|
Paragraph with *emphasis*{hello notfound}
|
17
17
|
{#par2}
|
18
18
|
|
19
|
-
{hello
|
19
|
+
{:hello: .chello}
|
20
20
|
*** Output of inspect ***
|
21
21
|
md_el(:document,[
|
22
22
|
md_el(:header,["Header with attributes"],{:level=>2},[[:id, "header1"]]),
|
23
23
|
md_el(:header,["Header with attributes"],{:level=>3},[[:id, "header2"]]),
|
24
|
-
md_el(:header,["Header no attributes"],{:level=>3},[
|
25
|
-
md_par([
|
26
|
-
|
27
|
-
|
28
|
-
md_ial([[:ref, "hello"], [:ref, "notfound"]])
|
29
|
-
], [[:id, "par2"]]),
|
30
|
-
md_el(:ald,[],{:ald=>[[:class, "chello"]],:ald_id=>"hello"},[])
|
24
|
+
md_el(:header,["Header no attributes"],{:level=>3},[]),
|
25
|
+
md_par(["Paragraph with a."], [[:id, "par1"]]),
|
26
|
+
md_par(["Paragraph with ", md_em(["emphasis"])], [[:id, "par2"]]),
|
27
|
+
md_el(:ald,[],{:ald=>[[:class, "chello"]],:ald_id=>"o"},[])
|
31
28
|
],{},[])
|
32
29
|
*** Output of to_html ***
|
33
30
|
|
@@ -35,24 +32,32 @@ md_el(:document,[
|
|
35
32
|
|
36
33
|
<h3 id='header2'>Header with attributes</h3>
|
37
34
|
|
38
|
-
<h3 id='
|
35
|
+
<h3 id='header_no_attributes'>Header no attributes</h3>
|
39
36
|
|
40
|
-
<p id='
|
37
|
+
<p id='par1'>Paragraph with a.</p>
|
38
|
+
|
39
|
+
<p id='par2'>Paragraph with <em>emphasis</em></p>
|
41
40
|
|
42
41
|
*** Output of to_latex ***
|
43
42
|
\hypertarget{header1}{}\subsection*{{Header with attributes}}\label{header1}
|
44
43
|
|
45
44
|
\hypertarget{header2}{}\subsubsection*{{Header with attributes}}\label{header2}
|
46
45
|
|
47
|
-
\hypertarget{
|
46
|
+
\hypertarget{header_no_attributes}{}\subsubsection*{{Header no attributes}}\label{header_no_attributes}
|
47
|
+
|
48
|
+
Paragraph with a.
|
48
49
|
|
49
50
|
Paragraph with {\em emphasis}
|
50
51
|
|
51
52
|
|
52
53
|
*** Output of to_md ***
|
53
|
-
Header with attributesHeader with attributesHeader no attributesParagraph with
|
54
|
+
Header with attributesHeader with attributesHeader no attributesParagraph with a.
|
55
|
+
|
56
|
+
Paragraph with emphasis
|
57
|
+
|
58
|
+
|
54
59
|
*** Output of to_s ***
|
55
|
-
Header with attributesHeader with attributesHeader no attributesParagraph with emphasis
|
60
|
+
Header with attributesHeader with attributesHeader no attributesParagraph with a.Paragraph with emphasis
|
56
61
|
*** EOF ***
|
57
62
|
|
58
63
|
|
@@ -68,22 +73,22 @@ Header with attributesHeader with attributesHeader no attributesParagraph with e
|
|
68
73
|
|
69
74
|
<h3>Header no attributes</h3>
|
70
75
|
|
71
|
-
<p>{warn2}Paragraph with a.
|
76
|
+
<p>{:warn2}Paragraph with a.
|
72
77
|
{#par1}</p>
|
73
78
|
|
74
79
|
<p>Paragraph with <em>emphasis</em>{hello notfound}
|
75
80
|
{#par2}</p>
|
76
81
|
|
77
|
-
<p>{hello
|
82
|
+
<p>{:hello: .chello}</p>
|
78
83
|
|
79
84
|
*** Output of Markdown.pl (parsed) ***
|
80
85
|
<h2>Header with attributes {#header1} </h2
|
81
86
|
><h3>Header with attributes ### {#header2}</h3
|
82
87
|
><h3>Header no attributes</h3
|
83
|
-
><p>{warn2}Paragraph with a.
|
88
|
+
><p>{:warn2}Paragraph with a.
|
84
89
|
{#par1}</p
|
85
90
|
><p>Paragraph with <em>emphasis</em
|
86
91
|
>{hello notfound}
|
87
92
|
{#par2}</p
|
88
|
-
><p>{hello
|
93
|
+
><p>{:hello: .chello}</p
|
89
94
|
>
|
@@ -4,11 +4,11 @@
|
|
4
4
|
*** Markdown input: ***
|
5
5
|
|
6
6
|
Paragraph
|
7
|
-
{a}
|
7
|
+
{:a}
|
8
8
|
|
9
9
|
|
10
|
-
{a
|
11
|
-
{b
|
10
|
+
{:a: b}
|
11
|
+
{:b: a}
|
12
12
|
|
13
13
|
*** Output of inspect ***
|
14
14
|
md_el(:document,[
|
@@ -38,14 +38,14 @@ Paragraph
|
|
38
38
|
|
39
39
|
*** Output of Markdown.pl ***
|
40
40
|
<p>Paragraph
|
41
|
-
{a}</p>
|
41
|
+
{:a}</p>
|
42
42
|
|
43
|
-
<p>{a
|
44
|
-
{b
|
43
|
+
<p>{:a: b}
|
44
|
+
{:b: a}</p>
|
45
45
|
|
46
46
|
*** Output of Markdown.pl (parsed) ***
|
47
47
|
<p>Paragraph
|
48
|
-
{a}</p
|
49
|
-
><p>{a
|
50
|
-
{b
|
48
|
+
{:a}</p
|
49
|
+
><p>{:a: b}
|
50
|
+
{:b: a}</p
|
51
51
|
>
|
data/tests/unittest/email.md
CHANGED
@@ -33,9 +33,9 @@ This is an email address:
|
|
33
33
|
|
34
34
|
|
35
35
|
*** Output of Markdown.pl ***
|
36
|
-
<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>
|
37
37
|
|
38
38
|
*** Output of Markdown.pl (parsed) ***
|
39
|
-
<p>This is an email address: <a href='&#
|
39
|
+
<p>This is an email address: <a href='m&#x61;&#105;&#x6C;&#x74;o:&#97;&#x6E;&#x64;&#114;&#x65;&#97;&#64;&#x69;&#x6E;&#118;&#97;l&#x69;&#x64;.&#x69;&#x74;'>andrea@invalid.it</a
|
40
40
|
></p
|
41
41
|
>
|
data/tests/unittest/links.md
CHANGED
@@ -113,7 +113,7 @@ Inline with title: \href{http://google.com}{Google images}
|
|
113
113
|
|
114
114
|
Inline with title: \href{http://google.com}{Google images}
|
115
115
|
|
116
|
-
Search on
|
116
|
+
Search on \href{http://www.gogole.com}{\char104\char116\char116\char112\char58\char47\char47\char119\char119\char119\char46\char103\char111\char103\char111\char108\char101\char46\char99\char111\char109} or \href{http://Here.com}{\char104\char116\char116\char112\char58\char47\char47\char72\char101\char114\char101\char46\char99\char111\char109} or ask \href{mailto:bill@google.com}{\char98\char105\char108\char108\char64\char103\char111\char111\char103\char108\char101\char46\char99\char111\char109} or you might ask bill@google.com.
|
117
117
|
|
118
118
|
If all else fails, ask \href{http://www.google.com}{Google}
|
119
119
|
|
@@ -168,7 +168,7 @@ Search on GoogleSearch on GoogleSearch on GoogleSearch on GoogleSearch on Google
|
|
168
168
|
|
169
169
|
<p>Inline with title: <a href="http://google.com "Title"">Google images</a></p>
|
170
170
|
|
171
|
-
<p>Search on <a href="http://www.gogole.com">http://www.gogole.com</a> or <a href="http://Here.com">http://Here.com</a> or ask <a href="m&#
|
171
|
+
<p>Search on <a href="http://www.gogole.com">http://www.gogole.com</a> or <a href="http://Here.com">http://Here.com</a> or ask <a href="mailto:bill@google.com">bill@google.com</a>
|
172
172
|
or you might ask bill@google.com.</p>
|
173
173
|
|
174
174
|
<p>If all else fails, ask <a href="http://www.google.com">Google</a></p>
|
data/tests/unittest/misc_sw.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Write a comment abouth the test here.
|
2
2
|
*** Parameters: ***
|
3
|
-
{:
|
3
|
+
{:date=>"Nov 20 2006", :subject=>"Software not painful to use", :archive=>false, :inmenu=>true, :subject_short=>"painless software", :topic=>"/misc/coolsw", :order=>"-9.5"}
|
4
4
|
*** Markdown input: ***
|
5
5
|
Subject: Software not painful to use
|
6
6
|
Subject_short: painless software
|
data/tests/unittest/syntax_hl.md
CHANGED
@@ -10,10 +10,8 @@ This is ruby code:
|
|
10
10
|
|
11
11
|
This is ruby code:
|
12
12
|
|
13
|
-
|
14
|
-
|
15
13
|
require 'maruku'
|
16
|
-
{lang=ruby html_use_syntax}
|
14
|
+
{: lang=ruby html_use_syntax}
|
17
15
|
|
18
16
|
puts Maruku.new($stdin).to_html
|
19
17
|
*** Output of inspect ***
|
@@ -74,7 +72,7 @@ puts Maruku.new($stdin).to_html
|
|
74
72
|
<pre><code>require 'maruku'
|
75
73
|
</code></pre>
|
76
74
|
|
77
|
-
<p>{lang=ruby html<em>use</em>syntax}</p>
|
75
|
+
<p>{: lang=ruby html<em>use</em>syntax}</p>
|
78
76
|
|
79
77
|
<pre><code>puts Maruku.new($stdin).to_html
|
80
78
|
</code></pre>
|
@@ -92,7 +90,7 @@ puts Maruku.new($stdin).to_html
|
|
92
90
|
><code>require 'maruku'
|
93
91
|
</code
|
94
92
|
></pre
|
95
|
-
><p>{lang=ruby html<em>use</em
|
93
|
+
><p>{: lang=ruby html<em>use</em
|
96
94
|
>syntax}</p
|
97
95
|
><pre
|
98
96
|
><code>puts Maruku.new($stdin).to_html
|
@@ -31,8 +31,7 @@ md_el(:document,[
|
|
31
31
|
]),
|
32
32
|
md_par([
|
33
33
|
"Inside: ",
|
34
|
-
md_el(:xml_instr,[],{:code=>"puts \"Inside: Hello\"",:target=>""},[
|
35
|
-
md_ial([[:ref, "exec"]]),
|
34
|
+
md_el(:xml_instr,[],{:code=>"puts \"Inside: Hello\"",:target=>""},[]),
|
36
35
|
" last"
|
37
36
|
])
|
38
37
|
],{},[])
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: maruku
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2007-01-
|
6
|
+
version: 0.4.2
|
7
|
+
date: 2007-01-11
|
8
8
|
summary: A Markdown interpreter in Ruby
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -62,7 +62,9 @@ files:
|
|
62
62
|
- docs/markdown_syntax.md
|
63
63
|
- docs/maruku.md
|
64
64
|
- docs/proposal.md
|
65
|
+
- docs/char.html
|
65
66
|
- docs/entity_test.html
|
67
|
+
- docs/exd.html
|
66
68
|
- docs/index.html
|
67
69
|
- docs/markdown_syntax.html
|
68
70
|
- docs/maruku.html
|
@@ -136,6 +138,8 @@ files:
|
|
136
138
|
- tests/unittest/test.md
|
137
139
|
- tests/unittest/wrapping.md
|
138
140
|
- tests/unittest/xml_instruction.md
|
141
|
+
- tests/unittest/attributes/att2.md
|
142
|
+
- tests/unittest/attributes/att3.md
|
139
143
|
- tests/unittest/attributes/attributes.md
|
140
144
|
- tests/unittest/attributes/circular.md
|
141
145
|
- tests/unittest/attributes/default.md
|