maruku 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/maruku +6 -1
- data/bin/marutest +25 -18
- data/lib/maruku.rb +3 -0
- data/lib/maruku/ext/div.rb +39 -6
- data/lib/maruku/ext/math/latex_fix.rb +1 -0
- data/lib/maruku/ext/math/mathml_engines/blahtex.rb +9 -8
- data/lib/maruku/ext/math/parsing.rb +15 -1
- data/lib/maruku/ext/math/to_html.rb +34 -17
- data/lib/maruku/ext/math/to_latex.rb +4 -0
- data/lib/maruku/helpers.rb +3 -3
- data/lib/maruku/input/charsource.rb +1 -1
- data/lib/maruku/input/parse_block.rb +1 -0
- data/lib/maruku/input/parse_doc.rb +12 -5
- data/lib/maruku/input/parse_span_better.rb +24 -10
- data/lib/maruku/output/s5/to_s5.rb +14 -1
- data/lib/maruku/output/to_html.rb +20 -1
- data/lib/maruku/output/to_latex.rb +27 -0
- data/lib/maruku/output/to_latex_entities.rb +2 -2
- data/lib/maruku/output/to_s.rb +5 -2
- data/lib/maruku/string_utils.rb +2 -2
- data/lib/maruku/structures.rb +2 -0
- data/lib/maruku/tests/new_parser.rb +5 -2
- data/lib/maruku/version.rb +1 -1
- data/tests/bugs/code_in_links.md +85 -0
- data/tests/bugs/complex_escaping.md +34 -0
- data/tests/unittest/abbreviations.md +2 -10
- data/tests/unittest/alt.md +2 -3
- data/tests/unittest/attributes/att2.md +2 -4
- data/tests/unittest/attributes/att3.md +2 -7
- data/tests/unittest/attributes/attributes.md +2 -15
- data/tests/unittest/attributes/circular.md +2 -7
- data/tests/unittest/attributes/default.md +2 -6
- data/tests/unittest/blank.md +2 -5
- data/tests/unittest/blanks_in_code.md +2 -21
- data/tests/unittest/bug_def.md +2 -3
- data/tests/unittest/bug_table.md +2 -11
- data/tests/unittest/code.md +2 -9
- data/tests/unittest/code2.md +2 -8
- data/tests/unittest/code3.md +2 -21
- data/tests/unittest/data_loss.md +2 -7
- data/tests/unittest/divs/div1.md +32 -57
- data/tests/unittest/divs/div2.md +6 -7
- data/tests/unittest/divs/div3_nest.md +8 -13
- data/tests/unittest/easy.md +2 -3
- data/tests/unittest/email.md +2 -3
- data/tests/unittest/encoding/iso-8859-1.md +2 -5
- data/tests/unittest/encoding/utf-8.md +2 -5
- data/tests/unittest/entities.md +2 -20
- data/tests/unittest/escaping.md +2 -12
- data/tests/unittest/extra_dl.md +2 -10
- data/tests/unittest/extra_header_id.md +2 -13
- data/tests/unittest/extra_table1.md +2 -8
- data/tests/unittest/footnotes.md +2 -19
- data/tests/{bugs/html.md → unittest/hang.md} +9 -9
- data/tests/unittest/headers.md +2 -7
- data/tests/unittest/hex_entities.md +2 -3
- data/tests/unittest/hrule.md +2 -11
- data/tests/unittest/html2.md +2 -6
- data/tests/unittest/html3.md +2 -6
- data/tests/unittest/html4.md +2 -7
- data/tests/unittest/html5.md +2 -5
- data/tests/unittest/ie.md +2 -23
- data/tests/unittest/images.md +2 -14
- data/tests/unittest/images2.md +2 -5
- data/tests/unittest/inline_html.md +6 -102
- data/tests/unittest/inline_html2.md +2 -5
- data/tests/unittest/links.md +17 -50
- data/tests/unittest/links2.md +2 -3
- data/tests/unittest/list1.md +2 -10
- data/tests/unittest/list12.md +2 -5
- data/tests/unittest/list2.md +2 -10
- data/tests/unittest/list3.md +2 -14
- data/tests/unittest/list4.md +2 -17
- data/tests/unittest/lists.md +2 -39
- data/tests/unittest/lists10.md +2 -7
- data/tests/unittest/lists11.md +2 -5
- data/tests/unittest/lists6.md +2 -3
- data/tests/unittest/lists9.md +2 -11
- data/tests/unittest/lists_after_paragraph.md +3 -51
- data/tests/unittest/lists_ol.md +2 -52
- data/tests/unittest/loss.md +2 -3
- data/tests/unittest/math/equations.md +54 -37
- data/tests/unittest/math/inline.md +4 -12
- data/tests/unittest/math/math2.md +4 -57
- data/tests/unittest/math/notmath.md +2 -5
- data/tests/unittest/math/table.md +5 -11
- data/tests/unittest/math/table2.md +2 -8
- data/tests/unittest/misc_sw.md +2 -80
- data/tests/unittest/notyet/escape.md +2 -5
- data/tests/unittest/notyet/header_after_par.md +2 -13
- data/tests/unittest/notyet/ticks.md +2 -3
- data/tests/unittest/notyet/triggering.md +2 -39
- data/tests/unittest/olist.md +2 -9
- data/tests/unittest/one.md +2 -3
- data/tests/unittest/paragraph.md +2 -3
- data/tests/unittest/paragraph_rules/dont_merge_ref.md +2 -5
- data/tests/unittest/paragraph_rules/tab_is_blank.md +2 -5
- data/tests/unittest/paragraphs.md +2 -10
- data/tests/unittest/pending/amps.md +2 -4
- data/tests/unittest/pending/empty_cells.md +2 -6
- data/tests/unittest/pending/link.md +2 -21
- data/tests/unittest/pending/ref.md +2 -3
- data/tests/unittest/recover/recover_links.md +7 -8
- data/tests/{bugs → unittest/red_tests}/abbrev.md +12 -103
- data/tests/unittest/{lists7.md → red_tests/lists7.md} +2 -13
- data/tests/unittest/{lists7b.md → red_tests/lists7b.md} +2 -10
- data/tests/unittest/{lists8.md → red_tests/lists8.md} +2 -9
- data/tests/unittest/red_tests/xml.md +70 -0
- data/tests/unittest/references/long_example.md +2 -7
- data/tests/unittest/references/spaces_and_numbers.md +2 -3
- data/tests/unittest/smartypants.md +2 -47
- data/tests/unittest/syntax_hl.md +2 -18
- data/tests/unittest/table_attributes.md +2 -8
- data/tests/unittest/test.md +2 -3
- data/tests/unittest/underscore_in_words.md +27 -0
- data/tests/unittest/wrapping.md +2 -11
- data/tests/unittest/xml2.md +2 -5
- data/tests/unittest/xml3.md +2 -8
- data/tests/unittest/xml_instruction.md +2 -10
- data/unit_test_span.sh +2 -1
- metadata +242 -241
- data/docs/changelog.html +0 -490
- data/docs/entity_test.html +0 -258
- data/docs/exd.html +0 -307
- data/docs/index.html +0 -332
- data/docs/markdown_syntax.html +0 -690
- data/docs/maruku.html +0 -332
- data/docs/proposal.html +0 -326
- data/docs/tmp.md +0 -2
- data/lib/sort_prof.rb +0 -22
- data/tests/bugs/links.md +0 -47
- data/tests/diagrams/diagrams.md +0 -302
- data/tests/s5/a.md +0 -13
- data/tests/s5/instiki+s5.md +0 -105
- data/tests/unittest/xml.md +0 -54
data/docs/maruku.html
DELETED
@@ -1,332 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC
|
3
|
-
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
4
|
-
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
5
|
-
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
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
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<p><img src='logo.png' id='logo' alt='MaRuKu' /></p>
|
10
|
-
|
11
|
-
<h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
|
12
|
-
|
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
|
-
|
15
|
-
<blockquote id='news'>
|
16
|
-
<p><a href='#release_notes'>Last release</a> is version 0.5.6 – 2007-05-22.</p>
|
17
|
-
|
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>
|
23
|
-
|
24
|
-
<pre><code>$ gem update maruku</code></pre>
|
25
|
-
</blockquote>
|
26
|
-
<hr />
|
27
|
-
<p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p>
|
28
|
-
|
29
|
-
<blockquote>
|
30
|
-
<p><a href='http://maruku.rubyforge.org/maruku.md'>This document in Markdown</a></p>
|
31
|
-
</blockquote>
|
32
|
-
|
33
|
-
<p>Then it can be translated to HTML:</p>
|
34
|
-
|
35
|
-
<blockquote>
|
36
|
-
<p><a href='http://maruku.rubyforge.org/maruku.html'>This document in HTML</a></p>
|
37
|
-
</blockquote>
|
38
|
-
|
39
|
-
<p>or LaTeX, which is then converted to PDF:</p>
|
40
|
-
|
41
|
-
<blockquote>
|
42
|
-
<p><a href='http://maruku.rubyforge.org/maruku.pdf'>This document in PDF</a></p>
|
43
|
-
</blockquote>
|
44
|
-
|
45
|
-
<p>Maruku implements:</p>
|
46
|
-
|
47
|
-
<ul>
|
48
|
-
<li>
|
49
|
-
<p>the original <a href='http://maruku.rubyforge.org/markdown_syntax.html'>Markdown syntax</a> (<a href='http://maruku.rubyforge.org/markdown_syntax.html'>HTML</a> or <a href='http://maruku.rubyforge.org/markdown_syntax.pdf'>PDF</a>), translated by Maruku).</p>
|
50
|
-
</li>
|
51
|
-
|
52
|
-
<li>
|
53
|
-
<p>all the improvements in <a href='http://www.michelf.com/projects/php-markdown/extra/'>PHP Markdown Extra</a>.</p>
|
54
|
-
</li>
|
55
|
-
|
56
|
-
<li>
|
57
|
-
<p>a new <a href='http://maruku.rubyforge.org/proposal.html'>meta-data syntax</a></p>
|
58
|
-
</li>
|
59
|
-
</ul>
|
60
|
-
|
61
|
-
<p><strong>Authors</strong>: Maruku has been developed so far by <a href='http://www.dis.uniroma1.it/~acensi/'>Andrea Censi</a>. Contributors are most welcome!</p>
|
62
|
-
|
63
|
-
<p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> transliteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> transliteration of “Mark”, the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable “ru” appears in Maruku.</p>
|
64
|
-
<hr />
|
65
|
-
<p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
|
66
|
-
<div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#release_notes'>Release notes</a></li><li><span class='maruku_section_number'>2. </span><a href='#download'>Download</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#bugs_report'>Bugs report</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#usage'>Usage</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#embedded_maruku'>Embedded Maruku</a></li><li><span class='maruku_section_number'>3.2. </span><a href='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>5. </span><a href='#features'>Maruku summary of features</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.1. </span><a href='#meta'>New meta-data syntax</a></li><li><span class='maruku_section_number'>5.2. </span><a href='#toc-generation'>Automatic generation of the table of contents</a></li><li><span class='maruku_section_number'>5.3. </span><a href='#entities'>Use HTML entities</a></li><li><span class='maruku_section_number'>5.4. </span><a href='#this_header_contains_emphasis_strong_text_and_'>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></a></li></ul></li><li><span class='maruku_section_number'>6. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li></ul></div><hr />
|
67
|
-
<h2 id='release_notes'><span class='maruku_section_number'>1. </span>Release notes</h2>
|
68
|
-
|
69
|
-
<p>Note: Maruku seems to be very robust, nevertheless it is still beta-level software. So if you want to use it in production environments, please check back in a month or so, while we squash the remaining bugs.</p>
|
70
|
-
|
71
|
-
<p>In the meantime, feel free to toy around, and please signal problems, request features, by <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>contacting me</a> or using the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a>. For issues about the Markdown syntax itself and improvements to it, please write to the <a href='http://six.pairlist.net/mailman/listinfo/markdown-discuss'>Markdown-discuss mailing list</a>.</p>
|
72
|
-
|
73
|
-
<p>Have fun!</p>
|
74
|
-
|
75
|
-
<p>See the <a href='http://maruku.rubyforge.org/changelog.html#stable'>changelog</a>.</p>
|
76
|
-
|
77
|
-
<h2 id='download'><span class='maruku_section_number'>2. </span>Download</h2>
|
78
|
-
|
79
|
-
<p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p>
|
80
|
-
|
81
|
-
<p>Install with:</p>
|
82
|
-
|
83
|
-
<pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ gem install maruku</code></pre>
|
84
|
-
|
85
|
-
<p>Released files can also be seen at <a href='http://rubyforge.org/frs/?group_id=2795'>http://rubyforge.org/frs/?group_id=2795</a>.</p>
|
86
|
-
|
87
|
-
<p>Anonymous access to the repository is possible with:</p>
|
88
|
-
|
89
|
-
<pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk</code></pre>
|
90
|
-
|
91
|
-
<p>If you want commit access to the repository, just create an account on Rubyforge and <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me a mail</a>.</p>
|
92
|
-
|
93
|
-
<h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3>
|
94
|
-
|
95
|
-
<p>Use the <a href='http://rubyforge.org/tracker/?group_id=2795'>tracker</a> or <a href='http://www.dis.uniroma1.it/~acensi/contact.html'>drop me an email</a>.</p>
|
96
|
-
|
97
|
-
<h2 id='usage'><span class='maruku_section_number'>3. </span>Usage</h2>
|
98
|
-
|
99
|
-
<h3 id='embedded_maruku'><span class='maruku_section_number'>3.1. </span>Embedded Maruku</h3>
|
100
|
-
|
101
|
-
<p>This is the basic usage:</p>
|
102
|
-
|
103
|
-
<pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>require</span> <span class='punct'>'</span><span class='string'>rubygems</span><span class='punct'>'</span>
|
104
|
-
<span class='ident'>require</span> <span class='punct'>'</span><span class='string'>maruku</span><span class='punct'>'</span>
|
105
|
-
|
106
|
-
<span class='ident'>doc</span> <span class='punct'>=</span> <span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>markdown_string</span><span class='punct'>)</span>
|
107
|
-
<span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span></code></pre>
|
108
|
-
|
109
|
-
<p>The method <code>to_html</code> outputs only an HTML fragment, while the method <code>to_html_document</code> outputs a complete XHTML 1.0 document:</p>
|
110
|
-
|
111
|
-
<pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document</span></code></pre>
|
112
|
-
|
113
|
-
<p>You can have the REXML document tree with:</p>
|
114
|
-
|
115
|
-
<pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>tree</span> <span class='punct'>=</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html_document_tree</span></code></pre>
|
116
|
-
|
117
|
-
<h3 id='from_the_command_line'><span class='maruku_section_number'>3.2. </span>From the command line</h3>
|
118
|
-
|
119
|
-
<p>There is one command-line program installed: <code>maruku</code>.</p>
|
120
|
-
|
121
|
-
<p>Without arguments, it converts Markdown to HTML:</p>
|
122
|
-
|
123
|
-
<pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ maruku file.md # creates file.html</code></pre>
|
124
|
-
|
125
|
-
<p>With the <code>--pdf</code> arguments, it converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p>
|
126
|
-
|
127
|
-
<pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ maruku --pdf file.md # creates file.tex and file.pdf</code></pre>
|
128
|
-
|
129
|
-
<h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>4. </span>Maruku and Bluecloth</h2>
|
130
|
-
|
131
|
-
<p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p>
|
132
|
-
|
133
|
-
<p>Maruku is much different in philosophy from Bluecloth: the biggest difference is that <em>parsing</em> is separated from <em>rendering</em>. In Maruku, an in-memory representation of the Markdown document is created. Instead, Bluecloth mantains the document in memory as a String at all times, and does a series of <code>gsub</code> to transform to HTML.</p>
|
134
|
-
|
135
|
-
<p>Maruku is usually faster than Bluecloth. Bluecloth is faster for very small documents. Bluecloth sometimes chokes on very big documents (it is reported that the blame should be on Ruby’s regexp implementation).</p>
|
136
|
-
|
137
|
-
<p>This is the canonical benchmark (the Markdown specification), executed with Ruby 1.8.5 on a Powerbook 1.5GhZ:</p>
|
138
|
-
|
139
|
-
<pre><code>BlueCloth (to_html): parsing 0.01 sec + rendering 1.87 sec = 1.88 sec (1.00x)
|
140
|
-
Maruku (to_html): parsing 0.66 sec + rendering 0.43 sec = 1.09 sec (1.73x)
|
141
|
-
Maruku (to_latex): parsing 0.67 sec + rendering 0.23 sec = 0.90 sec (2.10x)</code></pre>
|
142
|
-
|
143
|
-
<p>Please note that Maruku has a lot more features and therefore is looking for much more patterns in the file.</p>
|
144
|
-
|
145
|
-
<h2 id='features'><span class='maruku_section_number'>5. </span>Maruku summary of features</h2>
|
146
|
-
|
147
|
-
<ul>
|
148
|
-
<li>
|
149
|
-
<p>Supported syntax</p>
|
150
|
-
|
151
|
-
<ul>
|
152
|
-
<li><a href='http://daringfireball.net/projects/markdown/syntax'>Basic Markdown</a></li>
|
153
|
-
|
154
|
-
<li><a href='#extra'>Markdown Extra</a></li>
|
155
|
-
|
156
|
-
<li><a href='#meta'>Meta-data syntax</a></li>
|
157
|
-
</ul>
|
158
|
-
</li>
|
159
|
-
|
160
|
-
<li>
|
161
|
-
<p>Output</p>
|
162
|
-
|
163
|
-
<ul>
|
164
|
-
<li>
|
165
|
-
<p>XHTML</p>
|
166
|
-
|
167
|
-
<ul>
|
168
|
-
<li>Syntax highlighting via the <a href='http://syntax.rubyforge.org/'><code>syntax</code></a> library.</li>
|
169
|
-
</ul>
|
170
|
-
</li>
|
171
|
-
|
172
|
-
<li>
|
173
|
-
<p>LaTeX</p>
|
174
|
-
|
175
|
-
<ul>
|
176
|
-
<li><a href='#entities'>Translation of HTML entities to LaTeX</a></li>
|
177
|
-
|
178
|
-
<li>Syntax highlighting via the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code></a> package.</li>
|
179
|
-
</ul>
|
180
|
-
</li>
|
181
|
-
</ul>
|
182
|
-
</li>
|
183
|
-
|
184
|
-
<li>
|
185
|
-
<p>Misc</p>
|
186
|
-
|
187
|
-
<ul>
|
188
|
-
<li>
|
189
|
-
<p><a href='exd.html'>Documentation for supported attributes</a></p>
|
190
|
-
</li>
|
191
|
-
|
192
|
-
<li>
|
193
|
-
<p><a href='#toc-generation'>Automatic generation of the TOC</a></p>
|
194
|
-
</li>
|
195
|
-
</ul>
|
196
|
-
</li>
|
197
|
-
</ul>
|
198
|
-
|
199
|
-
<p><strong>Experimental features (not released yet)</strong></p>
|
200
|
-
|
201
|
-
<ul>
|
202
|
-
<li><a href='http://maruku.rubyforge.org/math.xhtml'>LaTeX Math syntax</a> (not enabled by default)</li>
|
203
|
-
|
204
|
-
<li>An extension system for adding new syntax is available, but the API is bound to change in the future, so please don’t use it.</li>
|
205
|
-
|
206
|
-
<li>LaTeX to MathML using either one of <a href='http://ritex.rubyforge.org'><code>ritex</code></a>, <a href='http://golem.ph.utexas.edu/~distler/code/itexToMML/'><code>itex2mml</code></a>, <a href='http://www.blahtex.org'><code>blahtex</code></a>.</li>
|
207
|
-
|
208
|
-
<li>LaTeX to PNG using <a href='http://www.blahtex.org'><code>blahtex</code></a>.</li>
|
209
|
-
</ul>
|
210
|
-
|
211
|
-
<h3 id='meta'><span class='maruku_section_number'>5.1. </span>New meta-data syntax</h3>
|
212
|
-
|
213
|
-
<p>Maruku implements a syntax that allows to attach “meta” information to objects.</p>
|
214
|
-
|
215
|
-
<p>See <a href='http://maruku.rubyforge.org/proposal.html'>this proposal</a> for how to attach metadata to the elements.</p>
|
216
|
-
|
217
|
-
<p>See the <a href='exd.html'>documentation for supported attributes</a>.</p>
|
218
|
-
|
219
|
-
<p>Meta-data for the document itself is specified through the use of email headers:</p>
|
220
|
-
|
221
|
-
<pre style='background-color: #ffefef;'><code>Title: A simple document containing meta-headers
|
222
|
-
CSS: style.css
|
223
|
-
|
224
|
-
Content of the document</code></pre>
|
225
|
-
|
226
|
-
<p>When creating the document through</p>
|
227
|
-
|
228
|
-
<pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='constant'>Maruku</span><span class='punct'>.</span><span class='ident'>new</span><span class='punct'>(</span><span class='ident'>s</span><span class='punct'>).</span><span class='ident'>to_html_document</span></code></pre>
|
229
|
-
|
230
|
-
<p>the title and stylesheet are added as expected.</p>
|
231
|
-
|
232
|
-
<p>Meta-data keys are assumed to be case-insensitive.</p>
|
233
|
-
|
234
|
-
<h3 id='toc-generation'><span class='maruku_section_number'>5.2. </span>Automatic generation of the table of contents</h3>
|
235
|
-
|
236
|
-
<p>If you create a list, and then set the <code>toc</code> attribute, when rendering Maruku will create an auto-generated table of contents.</p>
|
237
|
-
|
238
|
-
<pre><code>* This will become a table of contents (this text will be scraped).
|
239
|
-
{:toc}</code></pre>
|
240
|
-
|
241
|
-
<p>You can see an example of this at the beginning of this document.</p>
|
242
|
-
|
243
|
-
<h3 id='entities'><span class='maruku_section_number'>5.3. </span>Use HTML entities</h3>
|
244
|
-
|
245
|
-
<p>If you want to use HTML entities, go on! We will take care of the translation to LaTeX:</p>
|
246
|
-
<table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td style='text-align: left;'><code>&copy;</code></td><td style='text-align: left;'>©</td>
|
247
|
-
</tr><tr><td style='text-align: left;'><code>&pound;</code></td><td style='text-align: left;'>£</td>
|
248
|
-
</tr><tr><td style='text-align: left;'><code>&lambda;</code></td><td style='text-align: left;'>λ</td>
|
249
|
-
</tr><tr><td style='text-align: left;'><code>&mdash;</code></td><td style='text-align: left;'>—</td>
|
250
|
-
</tr></tbody></table>
|
251
|
-
<p>See the <a href='http://maruku.rubyforge.org/entity_test.html'>list of supported entities</a> (<a href='http://maruku.rubyforge.org/entity_test.pdf'>pdf</a>).</p>
|
252
|
-
|
253
|
-
<h3 id='this_header_contains_emphasis_strong_text_and_'><span class='maruku_section_number'>5.4. </span>This header contains <em>emphasis</em> <strong>strong text</strong> and <code>code</code></h3>
|
254
|
-
|
255
|
-
<p>Note that this header contains formatting and it still works, also in the table of contents.</p>
|
256
|
-
|
257
|
-
<p>And <a href='#features'>This is a <em>link</em> with <strong>all</strong> <strong><em>sort</em></strong> of <code>weird stuff</code></a> in the text.</p>
|
258
|
-
|
259
|
-
<h2 id='extra'><span class='maruku_section_number'>6. </span>Examples of PHP Markdown Extra syntax</h2>
|
260
|
-
|
261
|
-
<ul>
|
262
|
-
<li>
|
263
|
-
<p>tables</p>
|
264
|
-
|
265
|
-
<pre style='background-color: #ffefef;'><code>Col1 | Very very long head | Very very long head|
|
266
|
-
-----|:-------------------:|-------------------:|
|
267
|
-
cell | center-align | right-align |</code></pre>
|
268
|
-
<table><thead><tr><th>Col1</th><th>Very very long head</th><th>Very very long head</th></tr></thead><tbody><tr><td style='text-align: left;'>cell</td><td style='text-align: center;'>center-align</td><td style='text-align: right;'>right-align</td>
|
269
|
-
</tr></tbody></table></li>
|
270
|
-
|
271
|
-
<li>
|
272
|
-
<p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>
|
273
|
-
|
274
|
-
<pre style='background-color: #ffefef;'><code>* footnotes [^foot]
|
275
|
-
|
276
|
-
[^foot]: I really was missing those.</code></pre>
|
277
|
-
</li>
|
278
|
-
</ul>
|
279
|
-
|
280
|
-
<ul>
|
281
|
-
<li>
|
282
|
-
<p>Markdown inside HTML elements</p>
|
283
|
-
|
284
|
-
<pre><code class='xml' lang='xml'><span class='punct'><</span><span class='tag'>div</span> <span class='attribute'>markdown</span><span class='punct'>="</span><span class='string'>1</span><span class='punct'>"</span> <span class='attribute'>style</span><span class='punct'>="</span><span class='string'>border: solid 1px black</span><span class='punct'>"></span>
|
285
|
-
This is a div with Markdown **strong text**
|
286
|
-
<span class='punct'></</span><span class='tag'>div</span><span class='punct'>></span></code></pre>
|
287
|
-
<div style='border: solid 1px black'>
|
288
|
-
<p>This is a div with Markdown <strong>strong text</strong></p>
|
289
|
-
</div></li>
|
290
|
-
|
291
|
-
<li>
|
292
|
-
<p>header ids</p>
|
293
|
-
|
294
|
-
<pre style='background-color: #ffefef;'><code>## Download ## {#download}</code></pre>
|
295
|
-
|
296
|
-
<p>For example, <a href='#download'>a link to the download</a> header.</p>
|
297
|
-
</li>
|
298
|
-
|
299
|
-
<li>
|
300
|
-
<p>definition lists</p>
|
301
|
-
|
302
|
-
<pre style='background-color: #ffefef;'><code>Definition list
|
303
|
-
: something very hard to parse</code></pre>
|
304
|
-
|
305
|
-
<dl>
|
306
|
-
<dt>Definition list</dt>
|
307
|
-
|
308
|
-
<dd>something very hard to parse</dd>
|
309
|
-
</dl>
|
310
|
-
</li>
|
311
|
-
|
312
|
-
<li>
|
313
|
-
<p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
|
314
|
-
</li>
|
315
|
-
</ul>
|
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><!--
|
321
|
-
Future developments {#future}
|
322
|
-
|
323
|
-
I think that [Pandoc] and [MultiMarkdown] are very cool projects.
|
324
|
-
However, they are written in Haskell and Perl, respectively.
|
325
|
-
I would love to have an equivalent in Ruby.
|
326
|
-
|
327
|
-
[Pandoc]: http://sophos.berkeley.edu/macfarlane/pandoc/
|
328
|
-
[MultiMarkdown]: http://fletcher.freeshell.org/wiki/MultiMarkdown
|
329
|
-
|
330
|
-
--><div class='footnotes'><hr /><ol><li id='fn:1'>
|
331
|
-
<p>I really was missing those.</p>
|
332
|
-
<a href='#fnref:1' rev='footnote'>↩</a></li></ol></div></body></html>
|
data/docs/proposal.html
DELETED
@@ -1,326 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC
|
3
|
-
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
4
|
-
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
5
|
-
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
6
|
-
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Proposal for adding a meta-data syntax to Markdown</title><link href='style.css' rel='stylesheet' type='text/css' />
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<h1 id='proposal_for_adding_a_metadata_syntax_to_markdown'>Proposal for adding a meta-data syntax to Markdown</h1>
|
10
|
-
|
11
|
-
<p>This document describes a syntax for attaching meta-data to block-level elements (headers, paragraphs, code blocks,…), and to span-level elements (links, images,…).</p>
|
12
|
-
|
13
|
-
<p><strong><em>Note: this is an evolving proposal</em></strong></p>
|
14
|
-
|
15
|
-
<p>Last updated <strong>January 10th, 2007</strong>:</p>
|
16
|
-
|
17
|
-
<ul>
|
18
|
-
<li>
|
19
|
-
<p>Changed the syntax for compatibility with a future extension mechanism.</p>
|
20
|
-
|
21
|
-
<p>The first character in the curly braces must be a colon, optionally followed by a space:</p>
|
22
|
-
|
23
|
-
<pre><code>{: ref .class #id}</code></pre>
|
24
|
-
|
25
|
-
<p>The old syntax was <code>{ref .class #id}</code>.</p>
|
26
|
-
|
27
|
-
<p>For ALDs, the new syntax is:</p>
|
28
|
-
|
29
|
-
<pre><code>{:ref_id: key=val .class #id }</code></pre>
|
30
|
-
|
31
|
-
<p>instead of:</p>
|
32
|
-
|
33
|
-
<pre><code>{ref_id}: key=val .class #id </code></pre>
|
34
|
-
|
35
|
-
<p>Converters that don’t use this syntax may just ignore everything which is in curly braces and starts with ”:”.</p>
|
36
|
-
</li>
|
37
|
-
|
38
|
-
<li>
|
39
|
-
<p>IAL can be put both <em>before</em> and <em>after</em> the element. There is no ambiguity as a blank line is needed between elements:</p>
|
40
|
-
|
41
|
-
<pre><code>Paragraph 1
|
42
|
-
|
43
|
-
{:par2}
|
44
|
-
Paragraph 2</code></pre>
|
45
|
-
|
46
|
-
<p>is equivalent to:</p>
|
47
|
-
|
48
|
-
<pre><code>Paragraph 1
|
49
|
-
|
50
|
-
Paragraph 2
|
51
|
-
{:par2}</code></pre>
|
52
|
-
</li>
|
53
|
-
|
54
|
-
<li>
|
55
|
-
<p>Simplified rules for escaping.</p>
|
56
|
-
</li>
|
57
|
-
</ul>
|
58
|
-
|
59
|
-
<p><em>Table of contents:</em></p>
|
60
|
-
|
61
|
-
<blockquote><div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#overview'>Overview</a></li><li><span class='maruku_section_number'>2. </span><a href='#attribute_lists'>Attribute lists</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#class_id'><code>id</code> and <code>class</code> are special</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#where_to_put_inline_attribute_lists'>Where to put inline attribute lists</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#for_blocklevel_elements'>For block-level elements</a></li><li><span class='maruku_section_number'>3.2. </span><a href='#for_headers'>For headers</a></li><li><span class='maruku_section_number'>3.3. </span><a href='#for_spanlevel_elements'>For span-level elements</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#using_tags'>Using attributes lists definition</a></li><li><span class='maruku_section_number'>5. </span><a href='#the_rules'>The rules</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.1. </span><a href='#the_issue_of_escaping'>The issue of escaping</a></li><li><span class='maruku_section_number'>5.2. </span><a href='#syntax_for_attribute_lists'>Syntax for attribute lists</a></li></ul></li></ul></div></blockquote>
|
62
|
-
|
63
|
-
<h2 id='overview'><span class='maruku_section_number'>1. </span>Overview</h2>
|
64
|
-
|
65
|
-
<p>This proposal describes two additions to the Markdown syntax:</p>
|
66
|
-
|
67
|
-
<ol>
|
68
|
-
<li>
|
69
|
-
<p>inline attribute lists (IAL)</p>
|
70
|
-
|
71
|
-
<pre><code>## Header ## {: key=val .class #id ref_id}</code></pre>
|
72
|
-
</li>
|
73
|
-
|
74
|
-
<li>
|
75
|
-
<p>attribute lists definitions (ALD)</p>
|
76
|
-
|
77
|
-
<pre><code>{:ref_id: key=val .class #id}</code></pre>
|
78
|
-
</li>
|
79
|
-
</ol>
|
80
|
-
|
81
|
-
<p>Every span-level or block-level element can be followed by an IAL:</p>
|
82
|
-
|
83
|
-
<pre><code>### Header ### {: #header1 class=c1}
|
84
|
-
|
85
|
-
Paragraph *with emphasis*{: class=c1}
|
86
|
-
second line of paragraph
|
87
|
-
{: class=c1}</code></pre>
|
88
|
-
|
89
|
-
<p>In this example, the three IALs refer to the header, the emphasis span, and the entire paragraph, respectively.</p>
|
90
|
-
|
91
|
-
<p>IALs can reference ALDs. The result of the following example is the same as the previous one:</p>
|
92
|
-
|
93
|
-
<pre><code>### Header ### {: #header1 c1}
|
94
|
-
|
95
|
-
Paragraph *with emphasis*{:c1}
|
96
|
-
second line of paragraph
|
97
|
-
{:c1}
|
98
|
-
|
99
|
-
{:c1: class=c1}</code></pre>
|
100
|
-
|
101
|
-
<h2 id='attribute_lists'><span class='maruku_section_number'>2. </span>Attribute lists</h2>
|
102
|
-
|
103
|
-
<p>This is an example attribute list, which shows everything you can put inside:</p>
|
104
|
-
|
105
|
-
<pre><code>{: key1=val key2="long val" #myid .class1 .class2 ref1 ref2}</code></pre>
|
106
|
-
|
107
|
-
<p>More in particular, an attribute list is a whitespace-separated list of elements of 4 different kinds:</p>
|
108
|
-
|
109
|
-
<ol>
|
110
|
-
<li>key/value pairs (quoted if necessary)</li>
|
111
|
-
|
112
|
-
<li><a href='#using_tags'>references to ALD</a> (<code>ref1</code>,<code>ref2</code>)</li>
|
113
|
-
|
114
|
-
<li><a href='#class_id'>id specifiers</a> (<code>#myid</code>)</li>
|
115
|
-
|
116
|
-
<li><a href='#class_id'>class specifiers</a> (<code>.myclass</code>)</li>
|
117
|
-
</ol>
|
118
|
-
|
119
|
-
<h3 id='class_id'><span class='maruku_section_number'>2.1. </span><code>id</code> and <code>class</code> are special</h3>
|
120
|
-
|
121
|
-
<p>For ID and classes there are special shortcuts:</p>
|
122
|
-
|
123
|
-
<ul>
|
124
|
-
<li>
|
125
|
-
<p><code>#myid</code> is a shortcut for <code>id=myid</code></p>
|
126
|
-
</li>
|
127
|
-
|
128
|
-
<li>
|
129
|
-
<p><code>.myclass</code> means “add <code>myclass</code> to the current <code>class</code> attribute”.</p>
|
130
|
-
|
131
|
-
<p>So these are equivalent:</p>
|
132
|
-
|
133
|
-
<pre><code>{: .class1 .class2}
|
134
|
-
{: class="class1 class2"}</code></pre>
|
135
|
-
</li>
|
136
|
-
</ul>
|
137
|
-
|
138
|
-
<p>The following attribute lists are equivalent:</p>
|
139
|
-
|
140
|
-
<pre><code>{: #myid .class1 .class2}
|
141
|
-
{: id=myid class=class1 .class2}
|
142
|
-
{: id=myid class="class1 class2"}
|
143
|
-
{: id=myid class="will be overridden" class=class1 .class2}</code></pre>
|
144
|
-
|
145
|
-
<h2 id='where_to_put_inline_attribute_lists'><span class='maruku_section_number'>3. </span>Where to put inline attribute lists</h2>
|
146
|
-
|
147
|
-
<h3 id='for_blocklevel_elements'><span class='maruku_section_number'>3.1. </span>For block-level elements</h3>
|
148
|
-
|
149
|
-
<p>For paragraphs and other block-level elements, IAL go <strong>after</strong> the element:</p>
|
150
|
-
|
151
|
-
<pre><code>This is a paragraph.
|
152
|
-
Line 2 of the paragraph.
|
153
|
-
{: #myid .myclass}
|
154
|
-
|
155
|
-
A quote with a citation url:
|
156
|
-
> Who said that?
|
157
|
-
{: cite=google.com}</code></pre>
|
158
|
-
|
159
|
-
<p>Note: empty lines between the block and the IAL are not tolerated. So this is not legal:</p>
|
160
|
-
|
161
|
-
<pre><code>This is a paragraph.
|
162
|
-
Line 2 of the paragraph.
|
163
|
-
|
164
|
-
{: #myid .myclass}</code></pre>
|
165
|
-
|
166
|
-
<p>Attribute lists may be indented up to 3 spaces:</p>
|
167
|
-
|
168
|
-
<pre><code>Paragraph1
|
169
|
-
¬{:ok}
|
170
|
-
|
171
|
-
Paragraph2
|
172
|
-
¬¬{:ok}
|
173
|
-
|
174
|
-
Paragraph2
|
175
|
-
¬¬¬{:ok}</code></pre>
|
176
|
-
|
177
|
-
<h3 id='for_headers'><span class='maruku_section_number'>3.2. </span>For headers</h3>
|
178
|
-
|
179
|
-
<p>For headers, you can put attribute lists on the same line:</p>
|
180
|
-
|
181
|
-
<pre><code>### Header ### {: #myid}
|
182
|
-
|
183
|
-
Header {: #myid .myclass}
|
184
|
-
------</code></pre>
|
185
|
-
|
186
|
-
<p>or, as like other block-level elements, on the line below:</p>
|
187
|
-
|
188
|
-
<pre><code>### Header ###
|
189
|
-
{: #myid}
|
190
|
-
|
191
|
-
Header
|
192
|
-
------
|
193
|
-
{: #myid .myclass}</code></pre>
|
194
|
-
|
195
|
-
<h3 id='for_spanlevel_elements'><span class='maruku_section_number'>3.3. </span>For span-level elements</h3>
|
196
|
-
|
197
|
-
<p>For span-level elements, meta-data goes immediately <strong>after</strong> in the flow.</p>
|
198
|
-
|
199
|
-
<p>For example, in this:</p>
|
200
|
-
|
201
|
-
<pre><code>This is a *chunky paragraph*{: #id1}
|
202
|
-
{: #id2}</code></pre>
|
203
|
-
|
204
|
-
<p>the ID of the <code>em</code> element is set to <code>id1</code> and the ID of the paragraph is set to <code>id2</code>.</p>
|
205
|
-
|
206
|
-
<p>This works also for links, like this:</p>
|
207
|
-
|
208
|
-
<pre><code>This is [a link][ref]{:#myid rel=abc rev=abc}</code></pre>
|
209
|
-
|
210
|
-
<p>For images, this:</p>
|
211
|
-
|
212
|
-
<pre><code>This is ![Alt text](url "fresh carrots")</code></pre>
|
213
|
-
|
214
|
-
<p>is equivalent to:</p>
|
215
|
-
|
216
|
-
<pre><code>This is ![Alt text](url){:title="fresh carrots"}</code></pre>
|
217
|
-
|
218
|
-
<h2 id='using_tags'><span class='maruku_section_number'>4. </span>Using attributes lists definition</h2>
|
219
|
-
|
220
|
-
<p>In an attribute list, you can have:</p>
|
221
|
-
|
222
|
-
<ol>
|
223
|
-
<li><code>key=value</code> pairs,</li>
|
224
|
-
|
225
|
-
<li>id attributes (<code>#myid</code>)</li>
|
226
|
-
|
227
|
-
<li>class attributes (<code>.myclass</code>)</li>
|
228
|
-
</ol>
|
229
|
-
|
230
|
-
<p>Everything else is interpreted as a reference to an ALD.</p>
|
231
|
-
|
232
|
-
<pre><code># Header # {:ref}
|
233
|
-
|
234
|
-
Blah blah blah.
|
235
|
-
|
236
|
-
{:ref: #myhead .myclass lang=fr}</code></pre>
|
237
|
-
|
238
|
-
<p>Of course, more than one IAL can reference the same ALD:</p>
|
239
|
-
|
240
|
-
<pre><code># Header 1 # {:1}
|
241
|
-
...
|
242
|
-
# Header 2 # {:1}
|
243
|
-
|
244
|
-
{:1: .myclass lang=fr}</code></pre>
|
245
|
-
|
246
|
-
<h2 id='the_rules'><span class='maruku_section_number'>5. </span>The rules</h2>
|
247
|
-
|
248
|
-
<h3 id='the_issue_of_escaping'><span class='maruku_section_number'>5.1. </span>The issue of escaping</h3>
|
249
|
-
|
250
|
-
<ol>
|
251
|
-
<li>
|
252
|
-
<p>No escaping in code spans/blocks.</p>
|
253
|
-
</li>
|
254
|
-
|
255
|
-
<li>
|
256
|
-
<p>Everywhere else, <strong>all</strong> PUNCTUATION characters <strong>can</strong> be escaped, and <strong>must</strong> be escaped when they could trigger links, tables, etc.</p>
|
257
|
-
|
258
|
-
<p>A punctuation character is anything not a letter, a number, or whitespace (<code>[^a-zA-Z0-9\s\n]</code>).</p>
|
259
|
-
</li>
|
260
|
-
|
261
|
-
<li>
|
262
|
-
<p>As a rule, quotes <strong>must</strong> be escaped inside quoted values:</p>
|
263
|
-
|
264
|
-
<ul>
|
265
|
-
<li>
|
266
|
-
<p>Inside <code>"quoted values"</code>, you <strong>must</strong> escape <code>"</code>.</p>
|
267
|
-
</li>
|
268
|
-
|
269
|
-
<li>
|
270
|
-
<p>Inside <code>'quoted values'</code>, you <strong>must</strong> escape <code>'</code>.</p>
|
271
|
-
</li>
|
272
|
-
|
273
|
-
<li>
|
274
|
-
<p>Other examples:</p>
|
275
|
-
</li>
|
276
|
-
</ul>
|
277
|
-
|
278
|
-
<p><code>"bah 'bah' bah"</code> = <code>"bah \'bah\' bah"</code> = <code>'bah \'bah\' bah'</code></p>
|
279
|
-
|
280
|
-
<p><code>'bah "bah" bah'</code> = <code>'bah \"bah\" bah'</code> = <code>"bah \"bah\" bah"</code></p>
|
281
|
-
</li>
|
282
|
-
|
283
|
-
<li>
|
284
|
-
<p>There is an exception for backward compatibility, in links/images titles:</p>
|
285
|
-
|
286
|
-
<pre><code>[text](url "title"with"quotes")</code></pre>
|
287
|
-
|
288
|
-
<p>The exception is not valid for attribute lists and in other contexts, where you have to use the canonical syntax.</p>
|
289
|
-
</li>
|
290
|
-
</ol>
|
291
|
-
|
292
|
-
<h3 id='syntax_for_attribute_lists'><span class='maruku_section_number'>5.2. </span>Syntax for attribute lists</h3>
|
293
|
-
|
294
|
-
<p>Consider the following attribute list:</p>
|
295
|
-
|
296
|
-
<pre><code>{: key=value ref key2="quoted value" }</code></pre>
|
297
|
-
|
298
|
-
<p>In this string, <code>key</code>, <code>value</code>, and <code>ref</code> can be substituted by any string that does not contain whitespace, or the unescaped characters <code>}</code>,<code>=</code>,<code>'</code>,<code>"</code>.</p>
|
299
|
-
|
300
|
-
<p>Inside a quoted value you <strong>must</strong> escape the other kind of quote.</p>
|
301
|
-
|
302
|
-
<p>Also, you <strong>must</strong> escape a closing curly brace <code>}</code> inside quoted values. This rule is for making life easier for interpreter that just want to skip the meta-data.</p>
|
303
|
-
|
304
|
-
<p>If you don’t implement this syntax, you can get rid of the IAL by using this regular expression (this is written in Ruby):</p>
|
305
|
-
|
306
|
-
<pre><code>r = /\{:(\\\}|[^\}])*\}/
|
307
|
-
|
308
|
-
s.gsub(r, '') # ignore metadata</code></pre>
|
309
|
-
|
310
|
-
<p>Basically: match everything contained in a couple of <code>{:</code> and <code>}</code>, taking care of escaping of <code>}</code>. This <code>\\\}|[^\}]</code> means: eat either any character which is not a <code>}</code> or an escape sequence <code>\}</code>.</p>
|
311
|
-
|
312
|
-
<p>For this example,</p>
|
313
|
-
|
314
|
-
<pre><code>this is
|
315
|
-
{: skipped="\}" val=\} bar}
|
316
|
-
|
317
|
-
for me
|
318
|
-
{: also this} </code></pre>
|
319
|
-
|
320
|
-
<p>the result is:</p>
|
321
|
-
|
322
|
-
<pre><code>this is
|
323
|
-
|
324
|
-
|
325
|
-
for me </code></pre>
|
326
|
-
<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>
|