maruku 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 md_code_block(Maruku::MDDocument::Latex_preamble_enc_cjk) ?>
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 md_code_block(Maruku::MDDocument::Latex_preamble_enc_utf8) ?>
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
- #{user_preamble}
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
 
@@ -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
@@ -19,7 +19,7 @@
19
19
  #++
20
20
 
21
21
  module MaRuKu
22
- Version = '0.4.1'
22
+ Version = '0.4.2'
23
23
 
24
24
  MarukuURL = 'http://maruku.rubyforge.org/'
25
25
 
@@ -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}: .chello
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},[[:id, "par1"]]),
25
- md_par([
26
- "Paragraph with ",
27
- md_em(["emphasis"], [[:ref, "hello"], [:ref, "notfound"]]),
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='par1'>Header no attributes</h3>
35
+ <h3 id='header_no_attributes'>Header no attributes</h3>
39
36
 
40
- <p id='par2'>Paragraph with <em class='chello'>emphasis</em></p>
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{par1}{}\subsubsection*{{Header no attributes}}\label{par1}
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 emphasis
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}: .chello</p>
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}: .chello</p
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}: b
11
- {b}: a
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}: b
44
- {b}: a</p>
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}: b
50
- {b}: a</p
48
+ {:a}</p
49
+ ><p>{:a: b}
50
+ {:b: a}</p
51
51
  >
@@ -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="&#109;&#x61;&#x69;&#x6C;&#116;&#x6F;:a&#x6E;&#100;&#114;&#x65;a&#64;&#105;&#x6E;&#x76;&#x61;&#108;&#x69;&#100;&#46;&#105;&#116;">a&#x6E;&#100;&#114;&#x65;a&#64;&#105;&#x6E;&#x76;&#x61;&#108;&#x69;&#100;&#46;&#105;&#116;</a></p>
36
+ <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;">&#97;&#x6E;&#x64;&#114;&#x65;&#97;&#64;&#x69;&#x6E;&#118;&#97;l&#x69;&#x64;.&#x69;&#x74;</a></p>
37
37
 
38
38
  *** Output of Markdown.pl (parsed) ***
39
- <p>This is an email address: <a href='&amp;#109;&amp;#x61;&amp;#x69;&amp;#x6C;&amp;#116;&amp;#x6F;:a&amp;#x6E;&amp;#100;&amp;#114;&amp;#x65;a&amp;#64;&amp;#105;&amp;#x6E;&amp;#x76;&amp;#x61;&amp;#108;&amp;#x69;&amp;#100;&amp;#46;&amp;#105;&amp;#116;'>a&#x6E;&#100;&#114;&#x65;a&#64;&#105;&#x6E;&#x76;&#x61;&#108;&#x69;&#100;&#46;&#105;&#116;</a
39
+ <p>This is an email address: <a href='m&amp;#x61;&amp;#105;&amp;#x6C;&amp;#x74;o:&amp;#97;&amp;#x6E;&amp;#x64;&amp;#114;&amp;#x65;&amp;#97;&amp;#64;&amp;#x69;&amp;#x6E;&amp;#118;&amp;#97;l&amp;#x69;&amp;#x64;.&amp;#x69;&amp;#x74;'>&#97;&#x6E;&#x64;&#114;&#x65;&#97;&#64;&#x69;&#x6E;&#118;&#97;l&#x69;&#x64;.&#x69;&#x74;</a
40
40
  ></p
41
41
  >
@@ -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 or 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.
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="&#109;&#97;&#105;&#x6C;&#x74;&#x6F;:&#x62;&#105;&#108;&#108;&#64;&#x67;&#111;&#111;&#103;&#x6C;&#x65;&#x2E;&#99;&#111;&#109;">&#x62;&#105;&#108;&#108;&#64;&#x67;&#111;&#111;&#103;&#x6C;&#x65;&#x2E;&#99;&#111;&#109;</a>
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="&#109;&#x61;&#105;&#x6C;t&#111;:&#98;&#x69;&#108;&#108;&#64;&#103;&#x6F;&#x6F;g&#108;&#101;&#46;&#99;&#x6F;&#x6D;">&#98;&#x69;&#108;&#108;&#64;&#103;&#x6F;&#x6F;g&#108;&#101;&#46;&#99;&#x6F;&#x6D;</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>
@@ -1,6 +1,6 @@
1
1
  Write a comment abouth the test here.
2
2
  *** Parameters: ***
3
- {:subject_short=>"painless software", :order=>"-9.5", :date=>"Nov 20 2006", :subject=>"Software not painful to use", :topic=>"/misc/coolsw", :archive=>false, :inmenu=>true}
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
@@ -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=>""},[[:ref, "exec"]]),
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.1
7
- date: 2007-01-08
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