maruku 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/docs/maruku.md +1 -1
- data/lib/maruku/parse_block.rb +7 -2
- data/lib/maruku/to_html.rb +38 -28
- data/lib/maruku/version.rb +1 -1
- metadata +71 -65
data/docs/maruku.md
CHANGED
@@ -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
|
|
data/lib/maruku/parse_block.rb
CHANGED
@@ -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] =
|
436
|
+
e.meta[:raw_code] = source
|
432
437
|
e
|
433
438
|
end
|
434
439
|
|
data/lib/maruku/to_html.rb
CHANGED
@@ -253,37 +253,28 @@ class MDElement
|
|
253
253
|
|
254
254
|
element =
|
255
255
|
if use_syntax && lang
|
256
|
-
|
257
|
-
|
256
|
+
begin
|
257
|
+
convertor = Syntax::Convertors::HTML.for_syntax lang
|
258
|
+
html = convertor.convert( source )
|
258
259
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
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/,'»'+' '*3)
|
263
|
+
s.gsub!(/ /,'¬')
|
264
|
+
end
|
273
265
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
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
|
-
|
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(/&/,'&')
|
292
|
+
s = Text.normalize(s)
|
293
|
+
|
294
|
+
show_spaces = get_setting(:code_show_spaces)
|
295
|
+
if show_spaces
|
296
|
+
s.gsub!(/\t/,'»'+' '*3)
|
297
|
+
s.gsub!(/ /,'¬')
|
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'
|
data/lib/maruku/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
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
|
-
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
|
-
|
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
|
-
|
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
|
-
|
30
|
+
- Andrea Censi
|
29
31
|
files:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
79
|
-
|
83
|
+
- maruku
|
84
|
+
- marutex
|
80
85
|
extensions: []
|
86
|
+
|
81
87
|
requirements: []
|
88
|
+
|
82
89
|
dependencies:
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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:
|