remi-maruku 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +73 -0
- data/bin/marudown +29 -0
- data/bin/maruku +176 -0
- data/bin/marutest +338 -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 +70 -0
- data/lib/maruku/errors_management.rb +92 -0
- data/lib/maruku/ext/div.rb +100 -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 +11 -0
- data/lib/maruku/ext/math/mathml_engines/blahtex.rb +104 -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 +105 -0
- data/lib/maruku/ext/math/to_html.rb +170 -0
- data/lib/maruku/ext/math/to_latex.rb +22 -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 +613 -0
- data/lib/maruku/input/parse_doc.rb +227 -0
- data/lib/maruku/input/parse_span_better.rb +732 -0
- data/lib/maruku/input/rubypants.rb +225 -0
- data/lib/maruku/input/type_detection.rb +144 -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 +125 -0
- data/lib/maruku/output/to_html.rb +971 -0
- data/lib/maruku/output/to_latex.rb +563 -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 +53 -0
- data/lib/maruku/string_utils.rb +191 -0
- data/lib/maruku/structures.rb +165 -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 +370 -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/tests/bugs/code_in_links.md +16 -0
- data/tests/bugs/complex_escaping.md +4 -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 +72 -0
- data/tests/unittest/alt.md +30 -0
- data/tests/unittest/attributes/att2.md +34 -0
- data/tests/unittest/attributes/att3.md +45 -0
- data/tests/unittest/attributes/attributes.md +82 -0
- data/tests/unittest/attributes/circular.md +43 -0
- data/tests/unittest/attributes/default.md +38 -0
- data/tests/unittest/blank.md +39 -0
- data/tests/unittest/blanks_in_code.md +106 -0
- data/tests/unittest/bug_def.md +29 -0
- data/tests/unittest/bug_table.md +67 -0
- data/tests/unittest/code.md +53 -0
- data/tests/unittest/code2.md +46 -0
- data/tests/unittest/code3.md +102 -0
- data/tests/unittest/data_loss.md +42 -0
- data/tests/unittest/divs/div1.md +204 -0
- data/tests/unittest/divs/div2.md +34 -0
- data/tests/unittest/divs/div3_nest.md +62 -0
- data/tests/unittest/easy.md +28 -0
- data/tests/unittest/email.md +33 -0
- data/tests/unittest/encoding/iso-8859-1.md +38 -0
- data/tests/unittest/encoding/utf-8.md +33 -0
- data/tests/unittest/entities.md +124 -0
- data/tests/unittest/escaping.md +89 -0
- data/tests/unittest/extra_dl.md +72 -0
- data/tests/unittest/extra_header_id.md +86 -0
- data/tests/unittest/extra_table1.md +55 -0
- data/tests/unittest/footnotes.md +126 -0
- data/tests/unittest/headers.md +54 -0
- data/tests/unittest/hex_entities.md +50 -0
- data/tests/unittest/hrule.md +60 -0
- data/tests/unittest/html2.md +38 -0
- data/tests/unittest/html3.md +47 -0
- data/tests/unittest/html4.md +42 -0
- data/tests/unittest/html5.md +38 -0
- data/tests/unittest/ie.md +82 -0
- data/tests/unittest/images.md +114 -0
- data/tests/unittest/images2.md +46 -0
- data/tests/unittest/inline_html.md +260 -0
- data/tests/unittest/inline_html2.md +36 -0
- data/tests/unittest/links.md +197 -0
- data/tests/unittest/list1.md +66 -0
- data/tests/unittest/list2.md +76 -0
- data/tests/unittest/list3.md +88 -0
- data/tests/unittest/list4.md +116 -0
- data/tests/unittest/lists.md +241 -0
- data/tests/unittest/lists11.md +31 -0
- data/tests/unittest/lists6.md +54 -0
- data/tests/unittest/lists7.md +79 -0
- data/tests/unittest/lists7b.md +136 -0
- data/tests/unittest/lists8.md +83 -0
- data/tests/unittest/lists9.md +85 -0
- data/tests/unittest/lists_after_paragraph.md +268 -0
- data/tests/unittest/lists_ol.md +324 -0
- data/tests/unittest/loss.md +29 -0
- data/tests/unittest/math/equations.md +69 -0
- data/tests/unittest/math/inline.md +66 -0
- data/tests/unittest/math/math2.md +110 -0
- data/tests/unittest/math/notmath.md +40 -0
- data/tests/unittest/math/table.md +43 -0
- data/tests/unittest/math/table2.md +60 -0
- data/tests/unittest/misc_sw.md +615 -0
- data/tests/unittest/notyet/escape.md +36 -0
- data/tests/unittest/notyet/header_after_par.md +81 -0
- data/tests/unittest/notyet/ticks.md +31 -0
- data/tests/unittest/notyet/triggering.md +206 -0
- data/tests/unittest/olist.md +64 -0
- data/tests/unittest/one.md +28 -0
- data/tests/unittest/paragraph.md +29 -0
- data/tests/unittest/paragraph_rules/dont_merge_ref.md +57 -0
- data/tests/unittest/paragraph_rules/tab_is_blank.md +39 -0
- data/tests/unittest/paragraphs.md +66 -0
- data/tests/unittest/pending/amps.md +29 -0
- data/tests/unittest/pending/empty_cells.md +53 -0
- data/tests/unittest/pending/link.md +103 -0
- data/tests/unittest/recover/recover_links.md +28 -0
- data/tests/unittest/references/long_example.md +88 -0
- data/tests/unittest/references/spaces_and_numbers.md +28 -0
- data/tests/unittest/smartypants.md +171 -0
- data/tests/unittest/syntax_hl.md +80 -0
- data/tests/unittest/table_attributes.md +52 -0
- data/tests/unittest/test.md +32 -0
- data/tests/unittest/wrapping.md +88 -0
- data/tests/unittest/xml.md +54 -0
- data/tests/unittest/xml2.md +34 -0
- data/tests/unittest/xml3.md +44 -0
- data/tests/unittest/xml_instruction.md +72 -0
- data/tests/utf8-files/simple.md +1 -0
- data/unit_test_block.sh +5 -0
- data/unit_test_span.sh +2 -0
- metadata +243 -0
data/docs/other_stuff.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
* *Jan. 22* With very minimal changes, Maruku now works in JRuby.
|
2
|
+
It is very slow, though.
|
3
|
+
|
4
|
+
Some benchmarks:
|
5
|
+
|
6
|
+
* G4 1.5GhZ, Ruby 1.8.5:
|
7
|
+
|
8
|
+
Maruku (to_html): parsing 0.65 sec + rendering 0.40 sec = 1.04 sec
|
9
|
+
Maruku (to_latex): parsing 0.70 sec + rendering 0.21 sec = 0.91 sec
|
10
|
+
|
11
|
+
* G4 1.5GhZ, JRuby 1.9.2:
|
12
|
+
|
13
|
+
Maruku (to_html): parsing 4.77 sec + rendering 2.24 sec = 7.01 sec
|
14
|
+
Maruku (to_latex): parsing 4.04 sec + rendering 1.12 sec = 5.16 sec
|
15
|
+
|
16
|
+
* *Jan. 21* Integration of Blahtex. PNG export of formula and alignment works
|
17
|
+
ok in Mozilla, Safari, Camino, Opera. IE7 is acting strangely.
|
18
|
+
|
19
|
+
* Support for LaTeX-style formula input, and export to MathML.
|
20
|
+
|
21
|
+
[Jacques Distler] is integrating Maruku into Instiki (a Ruby On Rails-based wiki software), as to have a Ruby wiki with proper math support. You know, these physicists like all those funny symbols.
|
22
|
+
|
23
|
+
* To have the MathML export, it is needed to install one of:
|
24
|
+
|
25
|
+
* [RiTeX] (`gem install ritex`)
|
26
|
+
* [itex2MML] supports much more complex formulas than Ritex.
|
27
|
+
* PNG for old browser is not here yet. The plan is to use
|
28
|
+
BlahTeX.
|
29
|
+
|
30
|
+
|
31
|
+
* Command line options for the `maruku` command:
|
32
|
+
|
33
|
+
Usage: maruku [options] [file1.md [file2.md ...
|
34
|
+
-v, --[no-]verbose Run verbosely
|
35
|
+
-u, --[no-]unsafe Use unsafe features
|
36
|
+
-b Break on error
|
37
|
+
-m, --math-engine ENGINE Uses ENGINE to render MathML
|
38
|
+
--pdf Write PDF
|
39
|
+
--html Write HTML
|
40
|
+
--tex Write LaTeX
|
41
|
+
--inspect Shows the parsing result
|
42
|
+
--version Show version
|
43
|
+
-h, --help Show this message
|
44
|
+
|
45
|
+
* Other things:
|
46
|
+
|
47
|
+
* Created the embryo of an extension system. Please don't use it
|
48
|
+
yet, as probably the API is bound to change.
|
49
|
+
|
50
|
+
* There are a couple of hidden, unsafe, features that are not enabled by default.
|
51
|
+
|
data/docs/proposal.md
ADDED
@@ -0,0 +1,309 @@
|
|
1
|
+
CSS: style.css
|
2
|
+
LaTeX_use_listings: true
|
3
|
+
html_use_syntax: true
|
4
|
+
use_numbered_headers: true
|
5
|
+
|
6
|
+
Proposal for adding a meta-data syntax to Markdown
|
7
|
+
=============================================
|
8
|
+
|
9
|
+
This document describes a syntax for attaching meta-data to
|
10
|
+
block-level elements (headers, paragraphs, code blocks,…),
|
11
|
+
and to span-level elements (links, images,…).
|
12
|
+
|
13
|
+
***Note: this is an evolving proposal***
|
14
|
+
|
15
|
+
Last updated **January 10th, 2007**:
|
16
|
+
|
17
|
+
* Changed the syntax for compatibility with a future extension mechanism.
|
18
|
+
|
19
|
+
The first character in the curly braces must be a colon, optionally
|
20
|
+
followed by a space:
|
21
|
+
|
22
|
+
{: ref .class #id}
|
23
|
+
|
24
|
+
The old syntax was `{ref .class #id}`.
|
25
|
+
|
26
|
+
For ALDs, the new syntax is:
|
27
|
+
|
28
|
+
{:ref_id: key=val .class #id }
|
29
|
+
|
30
|
+
instead of:
|
31
|
+
|
32
|
+
{ref_id}: key=val .class #id
|
33
|
+
|
34
|
+
Converters that don't use this syntax may just ignore everything
|
35
|
+
which is in curly braces and starts with ":".
|
36
|
+
|
37
|
+
* IAL can be put both *before* and *after* the element.
|
38
|
+
There is no ambiguity as a blank line is needed between elements:
|
39
|
+
|
40
|
+
Paragraph 1
|
41
|
+
|
42
|
+
{:par2}
|
43
|
+
Paragraph 2
|
44
|
+
|
45
|
+
is equivalent to:
|
46
|
+
|
47
|
+
Paragraph 1
|
48
|
+
|
49
|
+
Paragraph 2
|
50
|
+
{:par2}
|
51
|
+
|
52
|
+
* Simplified rules for escaping.
|
53
|
+
|
54
|
+
*Table of contents:*
|
55
|
+
|
56
|
+
> * Table of contents
|
57
|
+
> {:toc}
|
58
|
+
|
59
|
+
Overview
|
60
|
+
--------
|
61
|
+
|
62
|
+
This proposal describes two additions to the Markdown syntax:
|
63
|
+
|
64
|
+
1. inline attribute lists (IAL)
|
65
|
+
|
66
|
+
## Header ## {: key=val .class #id ref_id}
|
67
|
+
|
68
|
+
2. attribute lists definitions (ALD)
|
69
|
+
|
70
|
+
{:ref_id: key=val .class #id}
|
71
|
+
|
72
|
+
Every span-level or block-level element can be followed by an IAL:
|
73
|
+
|
74
|
+
### Header ### {: #header1 class=c1}
|
75
|
+
|
76
|
+
Paragraph *with emphasis*{: class=c1}
|
77
|
+
second line of paragraph
|
78
|
+
{: class=c1}
|
79
|
+
|
80
|
+
In this example, the three IALs refer to the header, the emphasis span, and the entire paragraph, respectively.
|
81
|
+
|
82
|
+
IALs can reference ALDs. The result of the following example is the same as the previous one:
|
83
|
+
|
84
|
+
### Header ### {: #header1 c1}
|
85
|
+
|
86
|
+
Paragraph *with emphasis*{:c1}
|
87
|
+
second line of paragraph
|
88
|
+
{:c1}
|
89
|
+
|
90
|
+
{:c1: class=c1}
|
91
|
+
|
92
|
+
Attribute lists
|
93
|
+
---------------
|
94
|
+
|
95
|
+
This is an example attribute list, which shows
|
96
|
+
everything you can put inside:
|
97
|
+
|
98
|
+
{: key1=val key2="long val" #myid .class1 .class2 ref1 ref2}
|
99
|
+
|
100
|
+
More in particular, an attribute list is a whitespace-separated list
|
101
|
+
of elements of 4 different kinds:
|
102
|
+
|
103
|
+
1. key/value pairs (quoted if necessary)
|
104
|
+
2. [references to ALD](#using_tags) (`ref1`,`ref2`)
|
105
|
+
3. [id specifiers](#class_id) (`#myid`)
|
106
|
+
4. [class specifiers](#class_id) (`.myclass`)
|
107
|
+
|
108
|
+
### `id` and `class` are special ### {#class_id}
|
109
|
+
|
110
|
+
For ID and classes there are special shortcuts:
|
111
|
+
|
112
|
+
* `#myid` is a shortcut for `id=myid`
|
113
|
+
* `.myclass` means "add `myclass` to the current `class` attribute".
|
114
|
+
|
115
|
+
So these are equivalent:
|
116
|
+
|
117
|
+
{: .class1 .class2}
|
118
|
+
{: class="class1 class2"}
|
119
|
+
|
120
|
+
|
121
|
+
The following attribute lists are equivalent:
|
122
|
+
|
123
|
+
{: #myid .class1 .class2}
|
124
|
+
{: id=myid class=class1 .class2}
|
125
|
+
{: id=myid class="class1 class2"}
|
126
|
+
{: id=myid class="will be overridden" class=class1 .class2}
|
127
|
+
|
128
|
+
Where to put inline attribute lists
|
129
|
+
----------------------------------
|
130
|
+
|
131
|
+
### For block-level elements ###
|
132
|
+
|
133
|
+
For paragraphs and other block-level elements, IAL go
|
134
|
+
**after** the element:
|
135
|
+
|
136
|
+
This is a paragraph.
|
137
|
+
Line 2 of the paragraph.
|
138
|
+
{: #myid .myclass}
|
139
|
+
|
140
|
+
A quote with a citation url:
|
141
|
+
> Who said that?
|
142
|
+
{: cite=google.com}
|
143
|
+
|
144
|
+
Note: empty lines between the block and the IAL are not tolerated.
|
145
|
+
So this is not legal:
|
146
|
+
|
147
|
+
This is a paragraph.
|
148
|
+
Line 2 of the paragraph.
|
149
|
+
|
150
|
+
{: #myid .myclass}
|
151
|
+
|
152
|
+
Attribute lists may be indented up to 3 spaces:
|
153
|
+
|
154
|
+
Paragraph1
|
155
|
+
{:ok}
|
156
|
+
|
157
|
+
Paragraph2
|
158
|
+
{:ok}
|
159
|
+
|
160
|
+
Paragraph2
|
161
|
+
{:ok}
|
162
|
+
{:code_show_spaces}
|
163
|
+
|
164
|
+
### For headers ###
|
165
|
+
|
166
|
+
For headers, you can put attribute lists on the same line:
|
167
|
+
|
168
|
+
### Header ### {: #myid}
|
169
|
+
|
170
|
+
Header {: #myid .myclass}
|
171
|
+
------
|
172
|
+
|
173
|
+
or, as like other block-level elements, on the line below:
|
174
|
+
|
175
|
+
### Header ###
|
176
|
+
{: #myid}
|
177
|
+
|
178
|
+
Header
|
179
|
+
------
|
180
|
+
{: #myid .myclass}
|
181
|
+
|
182
|
+
### For span-level elements ###
|
183
|
+
|
184
|
+
For span-level elements, meta-data goes immediately **after** in the
|
185
|
+
flow.
|
186
|
+
|
187
|
+
For example, in this:
|
188
|
+
|
189
|
+
This is a *chunky paragraph*{: #id1}
|
190
|
+
{: #id2}
|
191
|
+
|
192
|
+
the ID of the `em` element is set to `id1`
|
193
|
+
and the ID of the paragraph is set to `id2`.
|
194
|
+
|
195
|
+
This works also for links, like this:
|
196
|
+
|
197
|
+
This is [a link][ref]{:#myid rel=abc rev=abc}
|
198
|
+
|
199
|
+
For images, this:
|
200
|
+
|
201
|
+
This is ![Alt text](url "fresh carrots")
|
202
|
+
|
203
|
+
is equivalent to:
|
204
|
+
|
205
|
+
This is ![Alt text](url){:title="fresh carrots"}
|
206
|
+
|
207
|
+
Using attributes lists definition {#using_tags}
|
208
|
+
---------------------------------
|
209
|
+
|
210
|
+
In an attribute list, you can have:
|
211
|
+
|
212
|
+
1. `key=value` pairs,
|
213
|
+
2. id attributes (`#myid`)
|
214
|
+
3. class attributes (`.myclass`)
|
215
|
+
|
216
|
+
Everything else is interpreted as a reference to
|
217
|
+
an ALD.
|
218
|
+
|
219
|
+
# Header # {:ref}
|
220
|
+
|
221
|
+
Blah blah blah.
|
222
|
+
|
223
|
+
{:ref: #myhead .myclass lang=fr}
|
224
|
+
|
225
|
+
Of course, more than one IAL can reference the same ALD:
|
226
|
+
|
227
|
+
# Header 1 # {:1}
|
228
|
+
...
|
229
|
+
# Header 2 # {:1}
|
230
|
+
|
231
|
+
{:1: .myclass lang=fr}
|
232
|
+
|
233
|
+
|
234
|
+
The rules {:#grammar}
|
235
|
+
---------
|
236
|
+
|
237
|
+
### The issue of escaping ###
|
238
|
+
|
239
|
+
1. No escaping in code spans/blocks.
|
240
|
+
|
241
|
+
2. Everywhere else, **all** PUNCTUATION characters **can** be escaped,
|
242
|
+
and **must** be escaped when they could trigger links, tables, etc.
|
243
|
+
|
244
|
+
A punctuation character is anything not a letter, a number, or whitespace
|
245
|
+
(`[^a-zA-Z0-9\s\n]`).
|
246
|
+
|
247
|
+
3. As a rule, quotes **must** be escaped inside quoted values:
|
248
|
+
|
249
|
+
* Inside `"quoted values"`, you **must** escape `"`.
|
250
|
+
* Inside `'quoted values'`, you **must** escape `'`.
|
251
|
+
|
252
|
+
* Other examples:
|
253
|
+
|
254
|
+
`"bah 'bah' bah"` = `"bah \'bah\' bah"` = `'bah \'bah\' bah'`
|
255
|
+
|
256
|
+
`'bah "bah" bah'` = `'bah \"bah\" bah'` = `"bah \"bah\" bah"`
|
257
|
+
|
258
|
+
|
259
|
+
4. There is an exception for backward compatibility, in links/images titles:
|
260
|
+
|
261
|
+
[text](url "title"with"quotes")
|
262
|
+
|
263
|
+
The exception is not valid for attribute lists and in other
|
264
|
+
contexts, where you have to use the canonical syntax.
|
265
|
+
|
266
|
+
|
267
|
+
### Syntax for attribute lists ####
|
268
|
+
|
269
|
+
Consider the following attribute list:
|
270
|
+
|
271
|
+
{: key=value ref key2="quoted value" }
|
272
|
+
|
273
|
+
In this string, `key`, `value`, and `ref` can be substituted by any
|
274
|
+
string that does not contain whitespace, or the unescaped characters `}`,`=`,`'`,`"`.
|
275
|
+
|
276
|
+
Inside a quoted value you **must** escape the other kind of quote.
|
277
|
+
|
278
|
+
Also, you **must** escape a closing curly brace `}` inside quoted values.
|
279
|
+
This rule is for making life easier for interpreter that just want to skip
|
280
|
+
the meta-data.
|
281
|
+
|
282
|
+
If you don't implement this syntax, you can get rid of the IAL by using this
|
283
|
+
regular expression (this is written in Ruby):
|
284
|
+
|
285
|
+
r = /\{:(\\\}|[^\}])*\}/
|
286
|
+
|
287
|
+
s.gsub(r, '') # ignore metadata
|
288
|
+
{:ruby}
|
289
|
+
|
290
|
+
Basically: match everything contained in a couple of `{:` and `}`, taking care
|
291
|
+
of escaping of `}`. This `\\\}|[^\}]` means: eat either any character which
|
292
|
+
is not a `}` or an escape sequence `\}`.
|
293
|
+
|
294
|
+
For this example,
|
295
|
+
|
296
|
+
this is
|
297
|
+
{: skipped="\}" val=\} bar}
|
298
|
+
|
299
|
+
for me
|
300
|
+
{: also this}
|
301
|
+
|
302
|
+
the result is:
|
303
|
+
|
304
|
+
this is
|
305
|
+
|
306
|
+
|
307
|
+
for me
|
308
|
+
|
309
|
+
|
data/lib/maruku.rb
ADDED
@@ -0,0 +1,141 @@
|
|
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
|
+
$:.unshift File.dirname(__FILE__)
|
21
|
+
|
22
|
+
require 'rexml/document'
|
23
|
+
|
24
|
+
# :include:MaRuKu.txt
|
25
|
+
module MaRuKu
|
26
|
+
|
27
|
+
module In
|
28
|
+
module Markdown
|
29
|
+
module SpanLevelParser; end
|
30
|
+
module BlockLevelParser; end
|
31
|
+
end
|
32
|
+
# more to come?
|
33
|
+
end
|
34
|
+
|
35
|
+
module Out
|
36
|
+
# Functions for exporting to MarkDown.
|
37
|
+
module Markdown; end
|
38
|
+
# Functions for exporting to HTML.
|
39
|
+
module HTML; end
|
40
|
+
# Functions for exporting to Latex
|
41
|
+
module Latex; end
|
42
|
+
end
|
43
|
+
|
44
|
+
# These are strings utilities.
|
45
|
+
module Strings; end
|
46
|
+
|
47
|
+
module Helpers; end
|
48
|
+
|
49
|
+
module Errors; end
|
50
|
+
|
51
|
+
class MDElement
|
52
|
+
include REXML
|
53
|
+
include MaRuKu
|
54
|
+
include Out::Markdown
|
55
|
+
include Out::HTML
|
56
|
+
include Out::Latex
|
57
|
+
include Strings
|
58
|
+
include Helpers
|
59
|
+
include Errors
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
class MDDocument < MDElement
|
64
|
+
include In::Markdown
|
65
|
+
include In::Markdown::SpanLevelParser
|
66
|
+
include In::Markdown::BlockLevelParser
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# This is the public interface
|
71
|
+
class Maruku < MaRuKu::MDDocument; end
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
require 'rexml/document'
|
76
|
+
|
77
|
+
# Structures definition
|
78
|
+
require 'maruku/structures'
|
79
|
+
require 'maruku/structures_inspect'
|
80
|
+
|
81
|
+
require 'maruku/defaults'
|
82
|
+
# Less typing
|
83
|
+
require 'maruku/helpers'
|
84
|
+
|
85
|
+
# Code for parsing whole Markdown documents
|
86
|
+
require 'maruku/input/parse_doc'
|
87
|
+
|
88
|
+
# Ugly things kept in a closet
|
89
|
+
require 'maruku/string_utils'
|
90
|
+
require 'maruku/input/linesource'
|
91
|
+
require 'maruku/input/type_detection'
|
92
|
+
|
93
|
+
# A class for reading and sanitizing inline HTML
|
94
|
+
require 'maruku/input/html_helper'
|
95
|
+
|
96
|
+
# Code for parsing Markdown block-level elements
|
97
|
+
require 'maruku/input/parse_block'
|
98
|
+
|
99
|
+
# Code for parsing Markdown span-level elements
|
100
|
+
require 'maruku/input/charsource'
|
101
|
+
require 'maruku/input/parse_span_better'
|
102
|
+
require 'maruku/input/rubypants'
|
103
|
+
|
104
|
+
require 'maruku/input/extensions'
|
105
|
+
|
106
|
+
require 'maruku/attributes'
|
107
|
+
|
108
|
+
require 'maruku/structures_iterators'
|
109
|
+
|
110
|
+
require 'maruku/errors_management'
|
111
|
+
|
112
|
+
# Code for creating a table of contents
|
113
|
+
require 'maruku/toc'
|
114
|
+
|
115
|
+
# Version and URL
|
116
|
+
require 'maruku/version'
|
117
|
+
|
118
|
+
|
119
|
+
# Exporting to html
|
120
|
+
require 'maruku/output/to_html'
|
121
|
+
|
122
|
+
# Exporting to latex
|
123
|
+
require 'maruku/output/to_latex'
|
124
|
+
require 'maruku/output/to_latex_strings'
|
125
|
+
require 'maruku/output/to_latex_entities'
|
126
|
+
|
127
|
+
# Pretty print
|
128
|
+
require 'maruku/output/to_markdown'
|
129
|
+
|
130
|
+
# S5 slides
|
131
|
+
require 'maruku/output/s5/to_s5'
|
132
|
+
require 'maruku/output/s5/fancy'
|
133
|
+
|
134
|
+
# Exporting to text: strips all formatting (not complete)
|
135
|
+
require 'maruku/output/to_s'
|
136
|
+
|
137
|
+
# class Maruku is the global interface
|
138
|
+
require 'maruku/maruku'
|
139
|
+
|
140
|
+
# require the new DIV syntax, by default
|
141
|
+
require 'maruku/ext/div'
|