bai-maruku 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +102 -0
- data/bin/marudown +29 -0
- data/bin/maruku +181 -0
- data/bin/marutest +345 -0
- data/bin/marutex +31 -0
- data/docs/changelog.md +334 -0
- data/docs/div_syntax.md +36 -0
- data/docs/entity_test.md +23 -0
- data/docs/markdown_syntax.md +899 -0
- data/docs/maruku.md +346 -0
- data/docs/math.md +194 -0
- data/docs/other_stuff.md +51 -0
- data/docs/proposal.md +309 -0
- data/lib/maruku.rb +141 -0
- data/lib/maruku/attributes.rb +227 -0
- data/lib/maruku/defaults.rb +71 -0
- data/lib/maruku/errors_management.rb +92 -0
- data/lib/maruku/ext/div.rb +133 -0
- data/lib/maruku/ext/math.rb +41 -0
- data/lib/maruku/ext/math/elements.rb +27 -0
- data/lib/maruku/ext/math/latex_fix.rb +12 -0
- data/lib/maruku/ext/math/mathml_engines/blahtex.rb +107 -0
- data/lib/maruku/ext/math/mathml_engines/itex2mml.rb +29 -0
- data/lib/maruku/ext/math/mathml_engines/none.rb +20 -0
- data/lib/maruku/ext/math/mathml_engines/ritex.rb +24 -0
- data/lib/maruku/ext/math/parsing.rb +119 -0
- data/lib/maruku/ext/math/to_html.rb +187 -0
- data/lib/maruku/ext/math/to_latex.rb +26 -0
- data/lib/maruku/helpers.rb +260 -0
- data/lib/maruku/input/charsource.rb +326 -0
- data/lib/maruku/input/extensions.rb +69 -0
- data/lib/maruku/input/html_helper.rb +189 -0
- data/lib/maruku/input/linesource.rb +111 -0
- data/lib/maruku/input/parse_block.rb +614 -0
- data/lib/maruku/input/parse_doc.rb +227 -0
- data/lib/maruku/input/parse_span_better.rb +746 -0
- data/lib/maruku/input/rubypants.rb +225 -0
- data/lib/maruku/input/type_detection.rb +147 -0
- data/lib/maruku/input_textile2/t2_parser.rb +163 -0
- data/lib/maruku/maruku.rb +33 -0
- data/lib/maruku/output/s5/fancy.rb +756 -0
- data/lib/maruku/output/s5/to_s5.rb +138 -0
- data/lib/maruku/output/to_html.rb +991 -0
- data/lib/maruku/output/to_latex.rb +590 -0
- data/lib/maruku/output/to_latex_entities.rb +367 -0
- data/lib/maruku/output/to_latex_strings.rb +64 -0
- data/lib/maruku/output/to_markdown.rb +164 -0
- data/lib/maruku/output/to_s.rb +56 -0
- data/lib/maruku/string_utils.rb +191 -0
- data/lib/maruku/structures.rb +167 -0
- data/lib/maruku/structures_inspect.rb +87 -0
- data/lib/maruku/structures_iterators.rb +61 -0
- data/lib/maruku/tests/benchmark.rb +82 -0
- data/lib/maruku/tests/new_parser.rb +373 -0
- data/lib/maruku/tests/tests.rb +136 -0
- data/lib/maruku/textile2.rb +1 -0
- data/lib/maruku/toc.rb +199 -0
- data/lib/maruku/usage/example1.rb +33 -0
- data/lib/maruku/version.rb +40 -0
- data/maruku.gemspec +32 -0
- data/tests/bugs/code_in_links.md +101 -0
- data/tests/bugs/complex_escaping.md +38 -0
- data/tests/math/syntax.md +46 -0
- data/tests/math_usage/document.md +13 -0
- data/tests/others/abbreviations.md +11 -0
- data/tests/others/blank.md +4 -0
- data/tests/others/code.md +5 -0
- data/tests/others/code2.md +8 -0
- data/tests/others/code3.md +16 -0
- data/tests/others/email.md +4 -0
- data/tests/others/entities.md +19 -0
- data/tests/others/escaping.md +16 -0
- data/tests/others/extra_dl.md +101 -0
- data/tests/others/extra_header_id.md +13 -0
- data/tests/others/extra_table1.md +40 -0
- data/tests/others/footnotes.md +17 -0
- data/tests/others/headers.md +10 -0
- data/tests/others/hrule.md +10 -0
- data/tests/others/images.md +20 -0
- data/tests/others/inline_html.md +42 -0
- data/tests/others/links.md +38 -0
- data/tests/others/list1.md +4 -0
- data/tests/others/list2.md +5 -0
- data/tests/others/list3.md +8 -0
- data/tests/others/lists.md +32 -0
- data/tests/others/lists_after_paragraph.md +44 -0
- data/tests/others/lists_ol.md +39 -0
- data/tests/others/misc_sw.md +105 -0
- data/tests/others/one.md +1 -0
- data/tests/others/paragraphs.md +13 -0
- data/tests/others/sss06.md +352 -0
- data/tests/others/test.md +4 -0
- data/tests/s5/s5profiling.md +48 -0
- data/tests/unittest/abbreviations.md +64 -0
- data/tests/unittest/alt.md +29 -0
- data/tests/unittest/attributes/att2.md +32 -0
- data/tests/unittest/attributes/att3.md +40 -0
- data/tests/unittest/attributes/attributes.md +69 -0
- data/tests/unittest/attributes/circular.md +38 -0
- data/tests/unittest/attributes/default.md +34 -0
- data/tests/unittest/blank.md +36 -0
- data/tests/unittest/blanks_in_code.md +87 -0
- data/tests/unittest/bug_def.md +28 -0
- data/tests/unittest/bug_table.md +58 -0
- data/tests/unittest/code.md +46 -0
- data/tests/unittest/code2.md +40 -0
- data/tests/unittest/code3.md +83 -0
- data/tests/unittest/data_loss.md +37 -0
- data/tests/unittest/divs/div1.md +179 -0
- data/tests/unittest/divs/div2.md +33 -0
- data/tests/unittest/divs/div3_nest.md +57 -0
- data/tests/unittest/easy.md +27 -0
- data/tests/unittest/email.md +32 -0
- data/tests/unittest/encoding/iso-8859-1.md +35 -0
- data/tests/unittest/encoding/utf-8.md +30 -0
- data/tests/unittest/entities.md +106 -0
- data/tests/unittest/escaping.md +79 -0
- data/tests/unittest/extra_dl.md +64 -0
- data/tests/unittest/extra_header_id.md +75 -0
- data/tests/unittest/extra_table1.md +49 -0
- data/tests/unittest/footnotes.md +109 -0
- data/tests/unittest/headers.md +49 -0
- data/tests/unittest/hex_entities.md +49 -0
- data/tests/unittest/hrule.md +51 -0
- data/tests/unittest/html2.md +34 -0
- data/tests/unittest/html3.md +43 -0
- data/tests/unittest/html4.md +37 -0
- data/tests/unittest/html5.md +35 -0
- data/tests/unittest/ie.md +61 -0
- data/tests/unittest/images.md +102 -0
- data/tests/unittest/images2.md +43 -0
- data/tests/unittest/inline_html.md +187 -0
- data/tests/unittest/inline_html2.md +33 -0
- data/tests/unittest/links.md +164 -0
- data/tests/unittest/links2.md +34 -0
- data/tests/unittest/list1.md +58 -0
- data/tests/unittest/list12.md +40 -0
- data/tests/unittest/list2.md +68 -0
- data/tests/unittest/list3.md +76 -0
- data/tests/unittest/list4.md +101 -0
- data/tests/unittest/lists.md +204 -0
- data/tests/unittest/lists10.md +46 -0
- data/tests/unittest/lists11.md +28 -0
- data/tests/unittest/lists6.md +53 -0
- data/tests/unittest/lists9.md +76 -0
- data/tests/unittest/lists_after_paragraph.md +220 -0
- data/tests/unittest/lists_ol.md +274 -0
- data/tests/unittest/loss.md +28 -0
- data/tests/unittest/math/equations.md +86 -0
- data/tests/unittest/math/inline.md +58 -0
- data/tests/unittest/math/math2.md +88 -0
- data/tests/unittest/math/notmath.md +37 -0
- data/tests/unittest/math/table.md +52 -0
- data/tests/unittest/math/table2.md +54 -0
- data/tests/unittest/misc_sw.md +537 -0
- data/tests/unittest/notyet/escape.md +33 -0
- data/tests/unittest/notyet/header_after_par.md +70 -0
- data/tests/unittest/notyet/ticks.md +30 -0
- data/tests/unittest/notyet/triggering.md +169 -0
- data/tests/unittest/olist.md +57 -0
- data/tests/unittest/one.md +27 -0
- data/tests/unittest/paragraph.md +28 -0
- data/tests/unittest/paragraph_rules/dont_merge_ref.md +54 -0
- data/tests/unittest/paragraph_rules/tab_is_blank.md +36 -0
- data/tests/unittest/paragraphs.md +58 -0
- data/tests/unittest/pending/amps.md +27 -0
- data/tests/unittest/pending/empty_cells.md +49 -0
- data/tests/unittest/pending/link.md +84 -0
- data/tests/unittest/pending/ref.md +33 -0
- data/tests/unittest/recover/recover_links.md +27 -0
- data/tests/unittest/red_tests/abbrev.md +1388 -0
- data/tests/unittest/red_tests/lists7.md +68 -0
- data/tests/unittest/red_tests/lists7b.md +128 -0
- data/tests/unittest/red_tests/lists8.md +76 -0
- data/tests/unittest/references/long_example.md +83 -0
- data/tests/unittest/references/spaces_and_numbers.md +27 -0
- data/tests/unittest/smartypants.md +126 -0
- data/tests/unittest/syntax_hl.md +64 -0
- data/tests/unittest/table_attributes.md +46 -0
- data/tests/unittest/test.md +31 -0
- data/tests/unittest/underscore_in_words.md +27 -0
- data/tests/unittest/wrapping.md +79 -0
- data/tests/unittest/xml.md +45 -0
- data/tests/unittest/xml2.md +31 -0
- data/tests/unittest/xml3.md +38 -0
- data/tests/unittest/xml_instruction.md +64 -0
- data/tests/utf8-files/simple.md +1 -0
- data/unit_test_block.sh +5 -0
- data/unit_test_span.sh +3 -0
- metadata +251 -0
@@ -0,0 +1,136 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
|
3
|
+
#
|
4
|
+
# This file is part of Maruku.
|
5
|
+
#
|
6
|
+
# Maruku is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Maruku is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Maruku; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
+
#++
|
20
|
+
|
21
|
+
|
22
|
+
require 'maruku'
|
23
|
+
|
24
|
+
class Maruku
|
25
|
+
|
26
|
+
|
27
|
+
def Maruku.failed(test, doc, s)
|
28
|
+
raise "Test failed: #{s}\n*****\n#{test}\n*****\n"+
|
29
|
+
"#{doc.inspect}\n*****\n{doc.to_html}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def Maruku.metaTests
|
33
|
+
ref = {:id => 'id1', :class => ['class1','class2'],
|
34
|
+
:style=> 'Style is : important = for all } things'}
|
35
|
+
|
36
|
+
|
37
|
+
tests = MetaTests.split('***')
|
38
|
+
for test in tests
|
39
|
+
#puts "Test: #{test.inspect}"
|
40
|
+
doc = Maruku.new(test)
|
41
|
+
|
42
|
+
doc.children.size == 1 ||
|
43
|
+
failed(test, doc, "children != 1")
|
44
|
+
|
45
|
+
|
46
|
+
h = doc.children[0]
|
47
|
+
|
48
|
+
h.node_type==:header ||
|
49
|
+
failed(test, doc, "child not header")
|
50
|
+
|
51
|
+
# puts doc.inspect
|
52
|
+
# puts doc.to_html
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
MetaTests = <<EOF
|
57
|
+
|
58
|
+
# Head # {ref1 ref2 ref3}
|
59
|
+
|
60
|
+
{ref1}: id: id1; class: class1
|
61
|
+
{ref2}: class: class2
|
62
|
+
{ref3}: style: "Style is : important = for all } things"
|
63
|
+
|
64
|
+
***
|
65
|
+
|
66
|
+
# Head # {ref1 ref3 ref2}
|
67
|
+
|
68
|
+
{ref1}: id: id1; class: class1
|
69
|
+
{ref2}: class: class2
|
70
|
+
{ref3}: style: "Style is : important = for all } things"
|
71
|
+
|
72
|
+
***
|
73
|
+
|
74
|
+
# Head # {ref1 ref2 ref3}
|
75
|
+
|
76
|
+
{ref1}: id= id1; class=class1
|
77
|
+
{ref2}: class=class2
|
78
|
+
{ref3}: style="Style is : important = for all } things"
|
79
|
+
|
80
|
+
***
|
81
|
+
|
82
|
+
# Head # {ref1 ref2 ref3}
|
83
|
+
|
84
|
+
{ref1}: id=id1 class=class1
|
85
|
+
{ref2}: class=class2
|
86
|
+
{ref3}: style="Style is : important = for all } things"
|
87
|
+
|
88
|
+
***
|
89
|
+
# Head # {ref1 ref2 ref3}
|
90
|
+
|
91
|
+
{ref1}: id:id1 class:class1
|
92
|
+
{ref2}: class : class2
|
93
|
+
{ref3}: style = "Style is : important = for all } things"
|
94
|
+
|
95
|
+
***
|
96
|
+
# Head # {ref1 ref2 ref3}
|
97
|
+
|
98
|
+
{ref1}: id:id1 class:class1
|
99
|
+
{ref2}: class : class2
|
100
|
+
{ref3}: style = "Style is : important = for all } things"
|
101
|
+
|
102
|
+
***
|
103
|
+
|
104
|
+
# Head # {#id1 .class1 ref2 ref3}
|
105
|
+
|
106
|
+
{ref2}: class : class2
|
107
|
+
{ref3}: style = "Style is : important = for all } things"
|
108
|
+
|
109
|
+
***
|
110
|
+
|
111
|
+
# Head # { #id1 .class1 ref2 ref3 }
|
112
|
+
|
113
|
+
{ref2}: class : class2
|
114
|
+
{ref3}: style = "Style is : important = for all } things"
|
115
|
+
|
116
|
+
***
|
117
|
+
|
118
|
+
# Head # { id=id1 class=class1 ref2 ref3 }
|
119
|
+
|
120
|
+
{ref2}: class : class2
|
121
|
+
{ref3}: style = "Style is : important = for all } things"
|
122
|
+
|
123
|
+
***
|
124
|
+
|
125
|
+
# Head # { id:id1 class="class1" class:"class2" style="Style is : important = for all } things"}
|
126
|
+
|
127
|
+
EOF
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
if File.basename($0) == 'tests.rb'
|
132
|
+
Maruku.metaTests
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'maruku/input_textile2/t2_parser'
|
data/lib/maruku/toc.rb
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
|
3
|
+
#
|
4
|
+
# This file is part of Maruku.
|
5
|
+
#
|
6
|
+
# Maruku is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Maruku is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Maruku; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
+
#++
|
20
|
+
|
21
|
+
|
22
|
+
module MaRuKu
|
23
|
+
|
24
|
+
class MDDocument
|
25
|
+
# an instance of Section (see below)
|
26
|
+
attr_accessor :toc
|
27
|
+
end
|
28
|
+
|
29
|
+
# This represents a section in the TOC.
|
30
|
+
class Section
|
31
|
+
# a Fixnum, is == header_element.level
|
32
|
+
attr_accessor :section_level
|
33
|
+
|
34
|
+
# An array of fixnum, like [1,2,5] for Section 1.2.5
|
35
|
+
attr_accessor :section_number
|
36
|
+
|
37
|
+
# reference to header (header has h.meta[:section] to self)
|
38
|
+
attr_accessor :header_element
|
39
|
+
|
40
|
+
# Array of immediate children of this element
|
41
|
+
attr_accessor :immediate_children
|
42
|
+
|
43
|
+
# Array of Section inside this section
|
44
|
+
attr_accessor :section_children
|
45
|
+
|
46
|
+
def initialize
|
47
|
+
@immediate_children = []
|
48
|
+
@section_children = []
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class Section
|
53
|
+
def inspect(indent=1)
|
54
|
+
s = ""
|
55
|
+
if @header_element
|
56
|
+
s += "\_"*indent + "(#{@section_level})>\t #{@section_number.join('.')} : "
|
57
|
+
s += @header_element.children_to_s +
|
58
|
+
" (id: '#{@header_element.attributes[:id]}')\n"
|
59
|
+
else
|
60
|
+
s += "Master\n"
|
61
|
+
end
|
62
|
+
|
63
|
+
@section_children.each do |c|
|
64
|
+
s+=c.inspect(indent+1)
|
65
|
+
end
|
66
|
+
s
|
67
|
+
end
|
68
|
+
|
69
|
+
# Numerate this section and its children
|
70
|
+
def numerate(a=[])
|
71
|
+
self.section_number = a
|
72
|
+
section_children.each_with_index do |c,i|
|
73
|
+
c.numerate(a.clone.push(i+1))
|
74
|
+
end
|
75
|
+
if h = self.header_element
|
76
|
+
h.attributes[:section_number] = self.section_number
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
include REXML
|
81
|
+
# Creates an HTML toc.
|
82
|
+
# Call this on the root
|
83
|
+
def to_html
|
84
|
+
div = Element.new 'div'
|
85
|
+
div.attributes['class'] = 'maruku_toc'
|
86
|
+
div << create_toc
|
87
|
+
div
|
88
|
+
end
|
89
|
+
|
90
|
+
def create_toc
|
91
|
+
ul = Element.new 'ul'
|
92
|
+
# let's remove the bullets
|
93
|
+
ul.attributes['style'] = 'list-style: none;'
|
94
|
+
@section_children.each do |c|
|
95
|
+
li = Element.new 'li'
|
96
|
+
if span = c.header_element.render_section_number
|
97
|
+
li << span
|
98
|
+
end
|
99
|
+
a = c.header_element.wrap_as_element('a')
|
100
|
+
a.delete_attribute 'id'
|
101
|
+
a.attributes['href'] = "##{c.header_element.attributes[:id]}"
|
102
|
+
li << a
|
103
|
+
li << c.create_toc if c.section_children.size>0
|
104
|
+
ul << li
|
105
|
+
end
|
106
|
+
ul
|
107
|
+
end
|
108
|
+
|
109
|
+
# Creates a latex toc.
|
110
|
+
# Call this on the root
|
111
|
+
def to_latex
|
112
|
+
to_latex_rec + "\n\n"
|
113
|
+
end
|
114
|
+
|
115
|
+
def to_latex_rec
|
116
|
+
s = ""
|
117
|
+
@section_children.each do |c|
|
118
|
+
s += "\\noindent"
|
119
|
+
number = c.header_element.section_number
|
120
|
+
s += number if number
|
121
|
+
text = c.header_element.children_to_latex
|
122
|
+
id = c.header_element.attributes[:id]
|
123
|
+
s += "\\hyperlink{#{id}}{#{text}}"
|
124
|
+
s += "\\dotfill \\pageref*{#{id}} \\linebreak\n"
|
125
|
+
s += c.to_latex_rec if c.section_children.size>0
|
126
|
+
|
127
|
+
end
|
128
|
+
s
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
class MDDocument
|
134
|
+
|
135
|
+
def create_toc
|
136
|
+
each_element(:header) do |h|
|
137
|
+
h.attributes[:id] ||= h.generate_id
|
138
|
+
end
|
139
|
+
|
140
|
+
stack = []
|
141
|
+
|
142
|
+
# the ancestor section
|
143
|
+
s = Section.new
|
144
|
+
s.section_level = 0
|
145
|
+
|
146
|
+
stack.push s
|
147
|
+
|
148
|
+
i = 0;
|
149
|
+
while i < @children.size
|
150
|
+
while i < @children.size
|
151
|
+
if @children[i].node_type == :header
|
152
|
+
level = @children[i].level
|
153
|
+
break if level <= stack.last.section_level+1
|
154
|
+
end
|
155
|
+
|
156
|
+
stack.last.immediate_children.push @children[i]
|
157
|
+
i += 1
|
158
|
+
end
|
159
|
+
|
160
|
+
break if i>=@children.size
|
161
|
+
|
162
|
+
header = @children[i]
|
163
|
+
level = header.level
|
164
|
+
|
165
|
+
if level > stack.last.section_level
|
166
|
+
# this level is inside
|
167
|
+
|
168
|
+
s2 = Section.new
|
169
|
+
s2.section_level = level
|
170
|
+
s2.header_element = header
|
171
|
+
header.instance_variable_set :@section, s2
|
172
|
+
|
173
|
+
stack.last.section_children.push s2
|
174
|
+
stack.push s2
|
175
|
+
|
176
|
+
i+=1
|
177
|
+
elsif level == stack.last.section_level
|
178
|
+
# this level is a sibling
|
179
|
+
stack.pop
|
180
|
+
else
|
181
|
+
# this level is a parent
|
182
|
+
stack.pop
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
# If there is only one big header, then assume
|
188
|
+
# it is the master
|
189
|
+
if s.section_children.size == 1
|
190
|
+
s = s.section_children.first
|
191
|
+
end
|
192
|
+
|
193
|
+
# Assign section numbers
|
194
|
+
s.numerate
|
195
|
+
|
196
|
+
s
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'maruku'
|
2
|
+
|
3
|
+
text = <<EOF
|
4
|
+
Chapter 1
|
5
|
+
=========
|
6
|
+
|
7
|
+
It was a stormy and rainy night.
|
8
|
+
|
9
|
+
EOF
|
10
|
+
|
11
|
+
invalid = <<EOF
|
12
|
+
|
13
|
+
This is a [bad link.
|
14
|
+
|
15
|
+
EOF
|
16
|
+
|
17
|
+
Maruku.new(text).to_html
|
18
|
+
|
19
|
+
s = ""
|
20
|
+
|
21
|
+
begin
|
22
|
+
Maruku.new(invalid, {:on_error => :raise, :error_stream => s})
|
23
|
+
puts "Error! It should have thrown an exception."
|
24
|
+
rescue
|
25
|
+
# puts "ok, got error"
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
Maruku.new(invalid, {:on_error => :warning, :error_stream => s})
|
30
|
+
rescue
|
31
|
+
puts "Error! It should not have thrown an exception."
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
|
3
|
+
#
|
4
|
+
# This file is part of Maruku.
|
5
|
+
#
|
6
|
+
# Maruku is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Maruku is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Maruku; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
+
#++
|
20
|
+
|
21
|
+
module MaRuKu
|
22
|
+
Version = '0.5.9'
|
23
|
+
|
24
|
+
MarukuURL = 'http://maruku.rubyforge.org/'
|
25
|
+
|
26
|
+
# If true, use also PHP Markdown extra syntax
|
27
|
+
#
|
28
|
+
# Note: it is not guaranteed that if it's false
|
29
|
+
# then no special features will be used.
|
30
|
+
#
|
31
|
+
# So please, ignore it for now.
|
32
|
+
def markdown_extra?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def new_meta_data?
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/maruku.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{maruku}
|
5
|
+
s.version = "0.5.9"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Andrea Censi"]
|
9
|
+
s.autorequire = %q{maruku}
|
10
|
+
s.date = %q{2009-05-04}
|
11
|
+
s.description = %q{Maruku is a Markdown interpreter in Ruby. It features native export to HTML and PDF (via Latex). The output is really beautiful!}
|
12
|
+
s.email = %q{andrea@rubyforge.org}
|
13
|
+
s.executables = ["maruku", "marutex"]
|
14
|
+
s.files = ["lib/maruku.rb", "lib/maruku/ext/math/to_latex.rb", "lib/maruku/ext/math/to_html.rb", "lib/maruku/ext/math/parsing.rb", "lib/maruku/ext/math/mathml_engines/blahtex.rb", "lib/maruku/ext/math/mathml_engines/itex2mml.rb", "lib/maruku/ext/math/mathml_engines/none.rb", "lib/maruku/ext/math/mathml_engines/ritex.rb", "lib/maruku/ext/math/latex_fix.rb", "lib/maruku/ext/math/elements.rb", "lib/maruku/ext/math.rb", "lib/maruku/ext/div.rb", "lib/maruku/errors_management.rb", "lib/maruku/input/linesource.rb", "lib/maruku/input/parse_span_better.rb", "lib/maruku/input/parse_block.rb", "lib/maruku/input/parse_doc.rb", "lib/maruku/input/charsource.rb", "lib/maruku/input/type_detection.rb", "lib/maruku/input/extensions.rb", "lib/maruku/input/html_helper.rb", "lib/maruku/input/rubypants.rb", "lib/maruku/tests/benchmark.rb", "lib/maruku/tests/tests.rb", "lib/maruku/tests/new_parser.rb", "lib/maruku/usage/example1.rb", "lib/maruku/defaults.rb", "lib/maruku/helpers.rb", "lib/maruku/structures_inspect.rb", "lib/maruku/maruku.rb", "lib/maruku/attributes.rb", "lib/maruku/string_utils.rb", "lib/maruku/structures.rb", "lib/maruku/structures_iterators.rb", "lib/maruku/output/s5/fancy.rb", "lib/maruku/output/s5/to_s5.rb", "lib/maruku/output/to_latex.rb", "lib/maruku/output/to_html.rb", "lib/maruku/output/to_latex_strings.rb", "lib/maruku/output/to_latex_entities.rb", "lib/maruku/output/to_s.rb", "lib/maruku/output/to_markdown.rb", "lib/maruku/toc.rb", "lib/maruku/textile2.rb", "lib/maruku/input_textile2/t2_parser.rb", "lib/maruku/version.rb", "docs/markdown_syntax.md", "docs/math.md", "docs/maruku.md", "docs/proposal.md", "docs/div_syntax.md", "docs/other_stuff.md", "docs/entity_test.md", "docs/changelog.md", "tests/s5/s5profiling.md", "tests/bugs/complex_escaping.md", "tests/bugs/code_in_links.md", "tests/math/syntax.md", "tests/unittest/hrule.md", "tests/unittest/divs/div1.md", "tests/unittest/divs/div2.md", "tests/unittest/divs/div3_nest.md", "tests/unittest/math/math2.md", "tests/unittest/math/table.md", "tests/unittest/math/equations.md", "tests/unittest/math/notmath.md", "tests/unittest/math/inline.md", "tests/unittest/math/table2.md", "tests/unittest/escaping.md", "tests/unittest/code.md", "tests/unittest/misc_sw.md", "tests/unittest/list1.md", "tests/unittest/list2.md", "tests/unittest/list3.md", "tests/unittest/list4.md", "tests/unittest/lists.md", "tests/unittest/xml2.md", "tests/unittest/xml3.md", "tests/unittest/footnotes.md", "tests/unittest/inline_html2.md", "tests/unittest/recover/recover_links.md", "tests/unittest/lists_after_paragraph.md", "tests/unittest/abbreviations.md", "tests/unittest/images2.md", "tests/unittest/paragraph_rules/dont_merge_ref.md", "tests/unittest/paragraph_rules/tab_is_blank.md", "tests/unittest/ie.md", "tests/unittest/extra_table1.md", "tests/unittest/olist.md", "tests/unittest/easy.md", "tests/unittest/paragraphs.md", "tests/unittest/html2.md", "tests/unittest/html3.md", "tests/unittest/html4.md", "tests/unittest/html5.md", "tests/unittest/bug_table.md", "tests/unittest/email.md", "tests/unittest/syntax_hl.md", "tests/unittest/blank.md", "tests/unittest/paragraph.md", "tests/unittest/attributes/attributes.md", "tests/unittest/attributes/circular.md", "tests/unittest/attributes/default.md", "tests/unittest/attributes/att2.md", "tests/unittest/attributes/att3.md", "tests/unittest/smartypants.md", "tests/unittest/code2.md", "tests/unittest/code3.md", "tests/unittest/red_tests/lists7b.md", "tests/unittest/red_tests/lists7.md", "tests/unittest/red_tests/lists8.md", "tests/unittest/red_tests/abbrev.md", "tests/unittest/loss.md", "tests/unittest/encoding/iso-8859-1.md", "tests/unittest/encoding/utf-8.md", "tests/unittest/test.md", "tests/unittest/bug_def.md", "tests/unittest/data_loss.md", "tests/unittest/alt.md", "tests/unittest/lists10.md", "tests/unittest/lists11.md", "tests/unittest/table_attributes.md", "tests/unittest/lists_ol.md", "tests/unittest/images.md", "tests/unittest/extra_header_id.md", "tests/unittest/list12.md", "tests/unittest/notyet/triggering.md", "tests/unittest/notyet/escape.md", "tests/unittest/notyet/header_after_par.md", "tests/unittest/notyet/ticks.md", "tests/unittest/one.md", "tests/unittest/lists6.md", "tests/unittest/lists9.md", "tests/unittest/blanks_in_code.md", "tests/unittest/xml.md", "tests/unittest/references/spaces_and_numbers.md", "tests/unittest/references/long_example.md", "tests/unittest/entities.md", "tests/unittest/pending/link.md", "tests/unittest/pending/ref.md", "tests/unittest/pending/amps.md", "tests/unittest/pending/empty_cells.md", "tests/unittest/hex_entities.md", "tests/unittest/links2.md", "tests/unittest/inline_html.md", "tests/unittest/wrapping.md", "tests/unittest/underscore_in_words.md", "tests/unittest/headers.md", "tests/unittest/extra_dl.md", "tests/unittest/links.md", "tests/unittest/xml_instruction.md", "tests/others/hrule.md", "tests/others/escaping.md", "tests/others/code.md", "tests/others/misc_sw.md", "tests/others/list1.md", "tests/others/list2.md", "tests/others/list3.md", "tests/others/lists.md", "tests/others/footnotes.md", "tests/others/lists_after_paragraph.md", "tests/others/abbreviations.md", "tests/others/extra_table1.md", "tests/others/paragraphs.md", "tests/others/email.md", "tests/others/blank.md", "tests/others/code2.md", "tests/others/code3.md", "tests/others/test.md", "tests/others/lists_ol.md", "tests/others/images.md", "tests/others/extra_header_id.md", "tests/others/one.md", "tests/others/sss06.md", "tests/others/entities.md", "tests/others/inline_html.md", "tests/others/headers.md", "tests/others/extra_dl.md", "tests/others/links.md", "tests/utf8-files/simple.md", "tests/math_usage/document.md", "bin/marutex", "bin/marudown", "bin/marutest", "bin/maruku", "unit_test_block.sh", "unit_test_span.sh", "Rakefile", "maruku.gemspec"]
|
15
|
+
s.homepage = %q{http://maruku.rubyforge.org}
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.3.1}
|
18
|
+
s.summary = %q{Maruku is a Markdown-superset interpreter written in Ruby.}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
s.add_runtime_dependency(%q<syntax>, [">= 1.0.0"])
|
26
|
+
else
|
27
|
+
s.add_dependency(%q<syntax>, [">= 1.0.0"])
|
28
|
+
end
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<syntax>, [">= 1.0.0"])
|
31
|
+
end
|
32
|
+
end
|