maruku 0.5.5 → 0.5.6

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.
Files changed (41) hide show
  1. data/bin/maruku +9 -3
  2. data/docs/changelog.html +52 -4
  3. data/docs/changelog.md +35 -5
  4. data/docs/index.html +13 -5
  5. data/docs/maruku.html +13 -5
  6. data/docs/maruku.md +14 -3
  7. data/lib/maruku/defaults.rb +4 -1
  8. data/lib/maruku/input/parse_block.rb +1 -1
  9. data/lib/maruku/input/parse_span_better.rb +14 -9
  10. data/lib/maruku/input/type_detection.rb +1 -1
  11. data/lib/maruku/input_textile2/t2_parser.rb +1 -1
  12. data/lib/maruku/output/to_html.rb +10 -0
  13. data/lib/maruku/output/to_latex.rb +1 -1
  14. data/lib/maruku/string_utils.rb +4 -0
  15. data/lib/maruku/tests/new_parser.rb +1 -1
  16. data/lib/maruku/version.rb +1 -1
  17. data/maruku_gem.rb +1 -1
  18. data/tests/unittest/email.md +2 -2
  19. data/tests/unittest/inline_html.md +134 -8
  20. data/tests/unittest/links.md +1 -1
  21. data/tests/unittest/links2.md +42 -0
  22. data/tests/unittest/lists10.md +62 -0
  23. data/tests/unittest/lists11.md +57 -0
  24. data/tests/unittest/lists8.md +2 -7
  25. data/tests/unittest/lists_after_paragraph.md +2 -2
  26. data/tests/unittest/misc_sw.md +2 -2
  27. data/tests/unittest/notyet/triggering.md +2 -2
  28. data/tests/unittest/paragraphs.md +1 -1
  29. data/tests/unittest/wrapping.md +2 -2
  30. data/unit_test_block.sh +5 -0
  31. data/unit_test_span.sh +2 -0
  32. metadata +215 -213
  33. data/lib/maruku/ext/diagrams/diagrams.rb +0 -8
  34. data/lib/maruku/ext/diagrams/grid.rb +0 -78
  35. data/lib/maruku/ext/diagrams/inspect.rb +0 -11
  36. data/lib/maruku/ext/diagrams/layout.rb +0 -508
  37. data/lib/maruku/ext/diagrams/parser.rb +0 -219
  38. data/lib/maruku/ext/diagrams/structures.rb +0 -168
  39. data/lib/maruku/ext/diagrams/to_html.rb +0 -37
  40. data/lib/maruku/ext/diagrams/to_latex.rb +0 -103
  41. data/lib/maruku/ext/diagrams/unittest.rb +0 -123
data/bin/maruku CHANGED
@@ -115,7 +115,7 @@ inputs.each do |f, input|
115
115
  suffix='.tex'
116
116
  out = doc.to_latex_document
117
117
  when :tex_frag
118
- suffix='.html_frag'
118
+ suffix='.tex_frag'
119
119
  out = doc.to_latex
120
120
  when :inspect
121
121
  suffix='.txt'
@@ -138,8 +138,13 @@ inputs.each do |f, input|
138
138
  output_file = job + suffix
139
139
  end
140
140
 
141
- $stderr.puts "Writing to #{output_file}"
142
- File.open(output_file,'w') do |f| f.puts out end
141
+ if output_file == "-"
142
+ $stderr.puts "Writing to standard output"
143
+ $stdout.puts out
144
+ else
145
+ $stderr.puts "Writing to #{output_file}"
146
+ File.open(output_file,'w') do |f| f.puts out end
147
+ end
143
148
 
144
149
  if export == :pdf
145
150
  cmd = "pdflatex '#{job}' -interaction=nonstopmode "+
@@ -149,6 +154,7 @@ inputs.each do |f, input|
149
154
  system cmd
150
155
  end
151
156
  else # write to stdout
157
+ $stderr.puts "Writing to standard output"
152
158
  $stdout.puts out
153
159
  end
154
160
  end
@@ -5,10 +5,58 @@
5
5
  <html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
6
6
  <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title><link href='style.css' rel='stylesheet' type='text/css' />
7
7
  </head>
8
- <body>
9
- <h4 id='last'>Changes in the development version (<strong>not yet released</strong>)</h4>
8
+ <body><!-- #### Changes in the development version (**not yet released**) #### {#last} -->
9
+ <h4 id='stable'>Changes in 0.5.6</h4>
10
10
 
11
- <h4 id='stable'>Changes in 0.5.5</h4>
11
+ <ul>
12
+ <li>
13
+ <p>News:</p>
14
+
15
+ <ul>
16
+ <li>Now Maruku is in the official Gentoo Portage tree (done by <a href='http://agorf.gr/'>Aggelos Orfanakos</a>)</li>
17
+ </ul>
18
+ </li>
19
+
20
+ <li>
21
+ <p>New stuff:</p>
22
+
23
+ <ul>
24
+ <li>Attribute <code>maruku_signature</code> defaults to false. (many people asked this)</li>
25
+
26
+ <li>unittests scripts are included in the distribution.</li>
27
+
28
+ <li>New attribute <code>filter_html</code>: if true, raw HTML/XML is discarded. (asked by Marik)</li>
29
+
30
+ <li>Command line: if output file is <code>-</code>, Maruku writes to stdout.</li>
31
+ </ul>
32
+ </li>
33
+
34
+ <li>
35
+ <p>Bug fixes:</p>
36
+
37
+ <ul>
38
+ <li>Another tiny bug in HTML parsing.</li>
39
+
40
+ <li>In latex, <code>\linebreak</code> was used instead of <code>\newline</code> (reported by Sam Kleinman)</li>
41
+
42
+ <li>Fixed bug with non-alpha numeric characters in ref.ids (reported by Aggelos Orfanakos)</li>
43
+ </ul>
44
+ </li>
45
+
46
+ <li>
47
+ <p>Pending bugs/feature requests:</p>
48
+
49
+ <ul>
50
+ <li>Maruku does not allow 3-space indented lists.</li>
51
+
52
+ <li>Lists item whose first character is UTF8 are not recognized (reported by Aggelos Orfanakos)</li>
53
+
54
+ <li>Maruku cannot output <code>&quot;</code>-delimited attributes, because <code>REXML</code> does not support it.</li>
55
+ </ul>
56
+ </li>
57
+ </ul>
58
+
59
+ <h4 id='changes_in_055'>Changes in 0.5.5</h4>
12
60
 
13
61
  <ul>
14
62
  <li>
@@ -439,4 +487,4 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
439
487
  <p>Support for images in PDF.</p>
440
488
  </li>
441
489
  </ul>
442
- <div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown-superset interpreter for Ruby'>Maruku</a> at 18:01 on Wednesday, March 07th, 2007.</span></div></body></html>
490
+ </body></html>
@@ -2,14 +2,37 @@ CSS: style.css
2
2
  LaTeX CJK: true
3
3
  HTML use syntax: true
4
4
 
5
+ <!-- #### Changes in the development version (**not yet released**) #### {#last} -->
5
6
 
6
- [Jacques Distler]: http://golem.ph.utexas.edu/~distler
7
- [itex2MML]: http://golem.ph.utexas.edu/~distler/blog/itex2MML.html
8
- [math]: http://rubyforge.maruku.org/math.html
7
+ #### Changes in 0.5.6 #### {#stable}
8
+
9
+ * News:
10
+
11
+ - Now Maruku is in the official Gentoo Portage tree (done by [Aggelos Orfanakos])
12
+
13
+ * New stuff:
14
+
15
+ - Attribute `maruku_signature` defaults to false. (many people asked this)
16
+ - unittests scripts are included in the distribution.
17
+ - New attribute `filter_html`: if true, raw HTML/XML is discarded. (asked by Marik)
18
+ - Command line: if output file is `-`, Maruku writes to stdout.
19
+
20
+ * Bug fixes:
21
+
22
+ * Another tiny bug in HTML parsing.
23
+ * In latex, `\linebreak` was used instead of `\newline` (reported by Sam Kleinman)
24
+ * Fixed bug with non-alpha numeric characters in ref.ids (reported by Aggelos Orfanakos)
9
25
 
10
- #### Changes in the development version (**not yet released**) #### {#last}
26
+
27
+ * Pending bugs/feature requests:
28
+
29
+ - Maruku does not allow 3-space indented lists.
30
+ - Lists item whose first character is UTF8 are not recognized (reported by Aggelos Orfanakos)
31
+ - Maruku cannot output `"`-delimited attributes, because `REXML` does not support it.
32
+
33
+ [Aggelos Orfanakos]: http://agorf.gr/
11
34
 
12
- #### Changes in 0.5.5 #### {#stable}
35
+ #### Changes in 0.5.5 ####
13
36
 
14
37
  * Features:
15
38
 
@@ -234,6 +257,13 @@ HTML use syntax: true
234
257
  [rdoc]: http://maruku.rubyforge.org/rdoc/
235
258
  [meta]: http://maruku.rubyforge.org/proposal.html
236
259
 
260
+
261
+
262
+ [Jacques Distler]: http://golem.ph.utexas.edu/~distler
263
+ [itex2MML]: http://golem.ph.utexas.edu/~distler/blog/itex2MML.html
264
+ [math]: http://rubyforge.maruku.org/math.html
265
+
266
+
237
267
  #### Changes in 0.3 ####
238
268
 
239
269
  * A real parser is used instead of a regexp-based system, also for span-level
@@ -6,16 +6,20 @@
6
6
  <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' />
7
7
  </head>
8
8
  <body>
9
- <p><img src='logo.png' id='logo' alt='' /></p>
9
+ <p><img src='logo.png' id='logo' alt='MaRuKu' /></p>
10
10
 
11
11
  <h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
12
12
 
13
13
  <p><a href='http://maruku.rubyforge.org/'>Maruku</a> is a Markdown interpreter written in <a href='http://www.ruby-lang.org'>Ruby</a>.</p>
14
14
 
15
15
  <blockquote id='news'>
16
- <p><a href='#release_notes'>Last release</a> is version 0.5.4 &#8211; 2007-02-18.</p>
16
+ <p><a href='#release_notes'>Last release</a> is version 0.5.6 &#8211; 2007-05-22.</p>
17
17
 
18
- <p>Use this command to update:</p>
18
+ <p>Install using <a href='http://rubygems.org'>rubygems</a>:</p>
19
+
20
+ <pre><code>$ gem install maruku</code></pre>
21
+
22
+ <p>Use this command to update to latest version:</p>
19
23
 
20
24
  <pre><code>$ gem update maruku</code></pre>
21
25
  </blockquote>
@@ -309,7 +313,11 @@ cell | center-align | right-align |</code></pre>
309
313
  <p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
310
314
  </li>
311
315
  </ul>
312
- <!--
316
+ <script src='http://www.google-analytics.com/urchin.js' type='text/javascript'>
317
+ </script><script type='text/javascript'>
318
+ _uacct = "UA-155626-2";
319
+ urchinTracker();
320
+ </script><!--
313
321
  Future developments {#future}
314
322
 
315
323
  I think that [Pandoc] and [MultiMarkdown] are very cool projects.
@@ -321,4 +329,4 @@ I would love to have an equivalent in Ruby.
321
329
 
322
330
  --><div class='footnotes'><hr /><ol><li id='fn:1'>
323
331
  <p>I really was missing those.</p>
324
- <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div><div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown-superset interpreter for Ruby'>Maruku</a> at 13:32 on Sunday, February 18th, 2007.</span></div></body></html>
332
+ <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div></body></html>
@@ -6,16 +6,20 @@
6
6
  <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' />
7
7
  </head>
8
8
  <body>
9
- <p><img src='logo.png' id='logo' alt='' /></p>
9
+ <p><img src='logo.png' id='logo' alt='MaRuKu' /></p>
10
10
 
11
11
  <h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
12
12
 
13
13
  <p><a href='http://maruku.rubyforge.org/'>Maruku</a> is a Markdown interpreter written in <a href='http://www.ruby-lang.org'>Ruby</a>.</p>
14
14
 
15
15
  <blockquote id='news'>
16
- <p><a href='#release_notes'>Last release</a> is version 0.5.4 &#8211; 2007-02-18.</p>
16
+ <p><a href='#release_notes'>Last release</a> is version 0.5.6 &#8211; 2007-05-22.</p>
17
17
 
18
- <p>Use this command to update:</p>
18
+ <p>Install using <a href='http://rubygems.org'>rubygems</a>:</p>
19
+
20
+ <pre><code>$ gem install maruku</code></pre>
21
+
22
+ <p>Use this command to update to latest version:</p>
19
23
 
20
24
  <pre><code>$ gem update maruku</code></pre>
21
25
  </blockquote>
@@ -309,7 +313,11 @@ cell | center-align | right-align |</code></pre>
309
313
  <p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
310
314
  </li>
311
315
  </ul>
312
- <!--
316
+ <script src='http://www.google-analytics.com/urchin.js' type='text/javascript'>
317
+ </script><script type='text/javascript'>
318
+ _uacct = "UA-155626-2";
319
+ urchinTracker();
320
+ </script><!--
313
321
  Future developments {#future}
314
322
 
315
323
  I think that [Pandoc] and [MultiMarkdown] are very cool projects.
@@ -321,4 +329,4 @@ I would love to have an equivalent in Ruby.
321
329
 
322
330
  --><div class='footnotes'><hr /><ol><li id='fn:1'>
323
331
  <p>I really was missing those.</p>
324
- <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div><div class='maruku_signature'><hr /><span style='font-size: small; font-style: italic'>Created by <a href='http://maruku.rubyforge.org' title='Maruku: a Markdown-superset interpreter for Ruby'>Maruku</a> at 13:32 on Sunday, February 18th, 2007.</span></div></body></html>
332
+ <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div></body></html>
@@ -13,14 +13,19 @@ Mar**u**k**u**: a Markdown-superset interpreter
13
13
 
14
14
  [Maruku] is a Markdown interpreter written in [Ruby].
15
15
 
16
- > [Last release](#release_notes) is version 0.5.4 -- 2007-02-18.
16
+ > [Last release](#release_notes) is version 0.5.6 -- 2007-05-22.
17
17
  >
18
- > Use this command to update:
18
+ > Install using [rubygems]:
19
+ >
20
+ > $ gem install maruku
21
+ >
22
+ > Use this command to update to latest version:
19
23
  >
20
24
  > $ gem update maruku
25
+ >
21
26
  {#news}
22
27
 
23
-
28
+ [rubygems]: http://rubygems.org
24
29
 
25
30
  * * *
26
31
 
@@ -372,6 +377,12 @@ Examples of PHP Markdown Extra syntax {#extra}
372
377
  *[ABB]: Simply an abbreviation
373
378
 
374
379
 
380
+ <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
381
+ </script>
382
+ <script type="text/javascript">
383
+ _uacct = "UA-155626-2";
384
+ urchinTracker();
385
+ </script>
375
386
 
376
387
  <!--
377
388
  Future developments {#future}
@@ -28,9 +28,12 @@ Globals = {
28
28
 
29
29
  :use_numbered_headers => false,
30
30
 
31
- :maruku_signature => true,
31
+ :maruku_signature => false,
32
32
  :code_background_color => '#fef',
33
33
  :code_show_spaces => false,
34
+
35
+ :filter_html => false,
36
+
34
37
  :html_math_output_mathml => true, # also set :html_math_engine
35
38
  :html_math_engine => 'none', #ritex, itex2mml
36
39
 
@@ -477,7 +477,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
477
477
  end
478
478
 
479
479
  id = match[1]; url = match[2]; title = match[3];
480
- id = id.strip.downcase.gsub(' ','_')
480
+ id = sanitize_ref_id(id)
481
481
 
482
482
  hash = self.refs[id] = {:url=>url,:title=>title}
483
483
 
@@ -197,9 +197,13 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
197
197
  end
198
198
  end
199
199
  when ?{ # extension
200
- src.ignore_char # {
201
- interpret_extension(src, con, [?}])
202
- src.ignore_char # }
200
+ if [?#, ?., ?:].include? src.next_char
201
+ src.ignore_char # {
202
+ interpret_extension(src, con, [?}])
203
+ src.ignore_char # }
204
+ else
205
+ con.push_char src.shift_char
206
+ end
203
207
  when nil
204
208
  maruku_error( ("Unclosed span (waiting for %s"+
205
209
  "#{exit_on_strings.inspect})") % [
@@ -283,7 +287,7 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
283
287
  end
284
288
 
285
289
  def extension_meta(src, con, break_on_chars)
286
- if m = src.read_regexp(/([^\s\:]+):/)
290
+ if m = src.read_regexp(/([^\s\:\"\']+):/)
287
291
  name = m[1]
288
292
  al = read_attribute_list(src, con, break_on_chars)
289
293
  # puts "#{name}=#{al.inspect}"
@@ -455,12 +459,13 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
455
459
 
456
460
  consumed = 0
457
461
  while true
458
- h.eat_this next_stuff[consumed].chr; consumed += 1
459
- break if h.is_finished?
460
-
461
462
  if consumed >= next_stuff.size
462
463
  maruku_error "Malformed HTML starting at #{next_stuff.inspect}", src, con
464
+ break
463
465
  end
466
+
467
+ h.eat_this next_stuff[consumed].chr; consumed += 1
468
+ break if h.is_finished?
464
469
  end
465
470
  src.ignore_chars(consumed)
466
471
  con.push_element md_html(h.stuff_you_read)
@@ -576,9 +581,9 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
576
581
  ref_id = read_ref_id(src,con)
577
582
  if ref_id
578
583
  if ref_id.size == 0
579
- ref_id = children.to_s.downcase.gsub(' ','_')
584
+ ref_id = sanitize_ref_id(children.to_s)
580
585
  else
581
- ref_id = ref_id.downcase
586
+ ref_id = sanitize_ref_id(ref_id)
582
587
  end
583
588
  con.push_element md_link(children, ref_id)
584
589
  else
@@ -76,7 +76,7 @@ module MaRuKu; module Strings
76
76
  # $1 = id $2 = attribute list
77
77
  AttributeDefinitionList = /^\s{0,3}\{([\w\d\s]+)\}:\s*(.*)\s*$/
78
78
  #
79
- InlineAttributeList = /^\s{0,3}\{(.*)\}\s*$/
79
+ InlineAttributeList = /^\s{0,3}\{([:#\.].*)\}\s*$/
80
80
  # Example:
81
81
  # ^:blah blah
82
82
  # ^: blah blah
@@ -108,6 +108,7 @@ module MaRuKu
108
108
  # Input is a LineSource
109
109
  def t2_parse_blocks(src, output)
110
110
  while src.cur_line
111
+ l = src.shift_line
111
112
 
112
113
  # ignore empty line
113
114
  if l.t2_empty? then
@@ -115,7 +116,6 @@ module MaRuKu
115
116
  next
116
117
  end
117
118
 
118
- l = src.shift_line
119
119
  # TODO: lists
120
120
  # TODO: xml
121
121
  # TODO: `==`
@@ -741,7 +741,17 @@ of the form `#ff00ff`.
741
741
  return a
742
742
  end
743
743
 
744
+ =begin maruku_doc
745
+ Attribute: filter_html
746
+ Scope: document
747
+
748
+ If true, raw HTML is discarded from the output.
749
+
750
+ =end
751
+
744
752
  def to_html_raw_html
753
+ return [] if get_setting(:filter_html)
754
+
745
755
  raw_html = self.raw_html
746
756
  if rexml_doc = @parsed_html
747
757
  root = rexml_doc.root
@@ -152,7 +152,7 @@ end end
152
152
  module MaRuKu; module Out; module Latex
153
153
 
154
154
  def to_latex_hrule; "\n\\vspace{.5em} \\hrule \\vspace{.5em}\n" end
155
- def to_latex_linebreak; "\\linebreak " end
155
+ def to_latex_linebreak; "\\newline " end
156
156
 
157
157
  def to_latex_paragraph
158
158
  children_to_latex+"\n\n"
@@ -146,6 +146,10 @@ module MaRuKu; module Strings
146
146
  s[0, i+1].strip
147
147
  end
148
148
 
149
+ def sanitize_ref_id(x)
150
+ x.downcase.gsub(' ','_').gsub(/[^\w]/,'')
151
+ end
152
+
149
153
 
150
154
  # removes initial quote
151
155
  def unquote(s)
@@ -155,7 +155,7 @@ module MaRuKu; module Tests
155
155
  ["[a]", [ md_link(["a"],'a')], 'Empty link'],
156
156
  ["[a][]", ],
157
157
  ["[a][]b", [ md_link(["a"],'a'),'b'], 'Empty link'],
158
- ["[a\\]][]", [ md_link(["a]"],'a]')], 'Escape inside link'],
158
+ ["[a\\]][]", [ md_link(["a]"],'a')], 'Escape inside link (throw ?] away)'],
159
159
 
160
160
  ["[a", :throw, 'Link not closed'],
161
161
  ["[a][", :throw, 'Ref not closed'],
@@ -19,7 +19,7 @@
19
19
  #++
20
20
 
21
21
  module MaRuKu
22
- Version = '0.5.5'
22
+ Version = '0.5.6'
23
23
 
24
24
  MarukuURL = 'http://maruku.rubyforge.org/'
25
25
 
@@ -12,7 +12,7 @@ $spec = Gem::Specification.new do |s|
12
12
  s.files = Dir['lib/**/*.rb'] + Dir['lib/*.rb'] +
13
13
  Dir['docs/*.md'] + Dir['docs/*.html'] +
14
14
  Dir['tests/**/*.md'] +
15
- Dir['bin/*'] + ['Rakefile', 'maruku_gem.rb']
15
+ Dir['bin/*'] + Dir['*.sh'] + ['Rakefile', 'maruku_gem.rb']
16
16
 
17
17
  s.bindir = 'bin'
18
18
  s.executables = ['maruku','marutex']