maruku 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -484,7 +484,7 @@ So the idea is:
484
484
  1. Opening brace `{`.
485
485
  2. Any string that does not contain the sequence `}@`.
486
486
  3. Closing brace and at-symbol `}@`.
487
- 4 Attributes specification like the block-level metadata.
487
+ 4. Attributes specification like the block-level metadata.
488
488
 
489
489
  Other examples:
490
490
 
@@ -421,14 +421,19 @@ class Maruku
421
421
  lines << strip_indent(shift_line, 4)
422
422
  end
423
423
 
424
- while lines.last && (line_node_type(lines.last) == :empty )
424
+ #while lines.last && (line_node_type(lines.last) == :empty )
425
+ while lines.last && lines.last.strip.size == 0
425
426
  lines.pop
426
427
  end
427
428
 
428
429
  return nil if lines.empty?
430
+
431
+ source = lines.join("\n")
432
+ # ignore trailing lines
433
+ source = source.gsub(/\n*$/,'')
429
434
 
430
435
  # dbg_describe_ary(lines, 'CODE')
431
- e.meta[:raw_code] = lines.join("\n")
436
+ e.meta[:raw_code] = source
432
437
  e
433
438
  end
434
439
 
@@ -253,37 +253,28 @@ class MDElement
253
253
 
254
254
  element =
255
255
  if use_syntax && lang
256
- convertor = Syntax::Convertors::HTML.for_syntax lang
257
- html = convertor.convert( source )
256
+ begin
257
+ convertor = Syntax::Convertors::HTML.for_syntax lang
258
+ html = convertor.convert( source )
258
259
 
259
- show_spaces = get_setting(:code_show_spaces)
260
- if show_spaces
261
- s.gsub!(/\t/,'&raquo;'+'&nbsp;'*3)
262
- s.gsub!(/ /,'&not;')
263
- end
264
-
265
- # puts "html: #{html}"
266
- pre = Document.new(html, {:respect_whitespace =>:all}).root
267
- pre.attributes['class'] = lang
268
- # puts "After: #{pre}"
269
- pre
270
- else
271
- pre = Element.new 'pre'
272
- s = source
260
+ show_spaces = get_setting(:code_show_spaces)
261
+ if show_spaces
262
+ s.gsub!(/\t/,'&raquo;'+'&nbsp;'*3)
263
+ s.gsub!(/ /,'&not;')
264
+ end
273
265
 
274
- s = s.gsub(/&/,'&amp;')
275
- s = Text.normalize(s)
276
-
277
- show_spaces = get_setting(:code_show_spaces)
278
- if show_spaces
279
- s.gsub!(/\t/,'&raquo;'+'&nbsp;'*3)
280
- s.gsub!(/ /,'&not;')
266
+ pre = Document.new(html, {:respect_whitespace =>:all}).root
267
+ pre.attributes['class'] = lang
268
+ pre
269
+ rescue Object => e
270
+ $stderr.puts "Error while using the syntax library for code:\n#{source.inspect}"
271
+ $stderr.puts "Lang is #{lang} object is: "
272
+ $stderr.puts @meta.inspect
273
+ $stderr.puts "Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
274
+ to_html_code_using_pre(source)
281
275
  end
282
-
283
- text = Text.new(s, true, nil, false )
284
-
285
- pre << text
286
- pre
276
+ else
277
+ to_html_code_using_pre(source)
287
278
  end
288
279
 
289
280
  color = get_setting(:code_background_color,DEFAULT_CODE_COLOR)
@@ -292,6 +283,25 @@ class MDElement
292
283
  end
293
284
  element
294
285
  end
286
+
287
+ def to_html_code_using_pre(source)
288
+ pre = Element.new 'pre'
289
+ s = source
290
+
291
+ s = s.gsub(/&/,'&amp;')
292
+ s = Text.normalize(s)
293
+
294
+ show_spaces = get_setting(:code_show_spaces)
295
+ if show_spaces
296
+ s.gsub!(/\t/,'&raquo;'+'&nbsp;'*3)
297
+ s.gsub!(/ /,'&not;')
298
+ end
299
+
300
+ text = Text.new(s, true, nil, false )
301
+
302
+ pre << text
303
+ pre
304
+ end
295
305
 
296
306
  def to_html_inline_code;
297
307
  pre = Element.new 'tt'
@@ -1,6 +1,6 @@
1
1
 
2
2
  class Maruku
3
- Version = '0.2.7'
3
+ Version = '0.2.8'
4
4
 
5
5
  MarukuURL = 'http://maruku.rubyforge.org/'
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.10
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: maruku
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.7
7
- date: 2006-12-27
6
+ version: 0.2.8
7
+ date: 2006-12-27 00:00:00 +01:00
8
8
  summary: A Markdown interpreter in Ruby
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: andrea@rubyforge.org
12
12
  homepage: http://maruku.rubyforge.org
13
13
  rubyforge_project:
@@ -18,75 +18,81 @@ bindir: bin
18
18
  has_rdoc: false
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
27
29
  authors:
28
- - Andrea Censi
30
+ - Andrea Censi
29
31
  files:
30
- - lib/maruku.rb
31
- - lib/maruku/parse_block.rb
32
- - lib/maruku/parse_span.rb
33
- - lib/maruku/string_utils.rb
34
- - lib/maruku/structures.rb
35
- - lib/maruku/to_html.rb
36
- - lib/maruku/to_latex.rb
37
- - lib/maruku/to_latex_strings.rb
38
- - lib/maruku/to_s.rb
39
- - lib/maruku/toc.rb
40
- - lib/maruku/version.rb
41
- - docs/markdown_syntax.md
42
- - docs/maruku.md
43
- - docs/todo.md
44
- - tests/abbreviations.md
45
- - tests/blank.md
46
- - tests/code.md
47
- - tests/code2.md
48
- - tests/code3.md
49
- - tests/email.md
50
- - tests/entities.md
51
- - tests/escaping.md
52
- - tests/extra_dl.md
53
- - tests/extra_header_id.md
54
- - tests/extra_table1.md
55
- - tests/footnotes.md
56
- - tests/headers.md
57
- - tests/hrule.md
58
- - tests/images.md
59
- - tests/inline_html.md
60
- - tests/links.md
61
- - tests/list1.md
62
- - tests/list2.md
63
- - tests/list3.md
64
- - tests/lists.md
65
- - tests/lists_ol.md
66
- - tests/misc_sw.md
67
- - tests/one.md
68
- - tests/paragraphs.md
69
- - tests/sss06.md
70
- - tests/test.md
71
- - tests/bugs/code_in_links.md
72
- - bin/maruku
73
- - bin/marutex
32
+ - lib/maruku.rb
33
+ - lib/maruku/parse_block.rb
34
+ - lib/maruku/parse_span.rb
35
+ - lib/maruku/string_utils.rb
36
+ - lib/maruku/structures.rb
37
+ - lib/maruku/to_html.rb
38
+ - lib/maruku/to_latex.rb
39
+ - lib/maruku/to_latex_strings.rb
40
+ - lib/maruku/to_s.rb
41
+ - lib/maruku/toc.rb
42
+ - lib/maruku/version.rb
43
+ - docs/markdown_syntax.md
44
+ - docs/maruku.md
45
+ - docs/todo.md
46
+ - tests/abbreviations.md
47
+ - tests/blank.md
48
+ - tests/code.md
49
+ - tests/code2.md
50
+ - tests/code3.md
51
+ - tests/email.md
52
+ - tests/entities.md
53
+ - tests/escaping.md
54
+ - tests/extra_dl.md
55
+ - tests/extra_header_id.md
56
+ - tests/extra_table1.md
57
+ - tests/footnotes.md
58
+ - tests/headers.md
59
+ - tests/hrule.md
60
+ - tests/images.md
61
+ - tests/inline_html.md
62
+ - tests/links.md
63
+ - tests/list1.md
64
+ - tests/list2.md
65
+ - tests/list3.md
66
+ - tests/lists.md
67
+ - tests/lists_ol.md
68
+ - tests/misc_sw.md
69
+ - tests/one.md
70
+ - tests/paragraphs.md
71
+ - tests/sss06.md
72
+ - tests/test.md
73
+ - tests/bugs/code_in_links.md
74
+ - bin/maruku
75
+ - bin/marutex
74
76
  test_files: []
77
+
75
78
  rdoc_options: []
79
+
76
80
  extra_rdoc_files: []
81
+
77
82
  executables:
78
- - maruku
79
- - marutex
83
+ - maruku
84
+ - marutex
80
85
  extensions: []
86
+
81
87
  requirements: []
88
+
82
89
  dependencies:
83
- - !ruby/object:Gem::Dependency
84
- name: syntax
85
- version_requirement:
86
- version_requirements: !ruby/object:Gem::Version::Requirement
87
- requirements:
88
- -
89
- - ">="
90
- - !ruby/object:Gem::Version
91
- version: 1.0.0
92
- version:
90
+ - !ruby/object:Gem::Dependency
91
+ name: syntax
92
+ version_requirement:
93
+ version_requirements: !ruby/object:Gem::Version::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 1.0.0
98
+ version: