maruku 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/docs/maruku.html CHANGED
@@ -13,10 +13,12 @@
13
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
14
 
15
15
  <blockquote id='news'>
16
- <p><a href='#release_notes'>Last release</a> is version 0.5.0 &#8211; 2007-01-23.</p>
16
+ <p><a href='#release_notes'>Last release</a> is version 0.5.1 &#8211; 2007-01-24.</p>
17
17
 
18
18
  <p>Use this command to update:</p>
19
- <pre><code>$ gem update maruku</code></pre></blockquote>
19
+
20
+ <pre><code>$ gem update maruku</code></pre>
21
+ </blockquote>
20
22
  <hr />
21
23
  <p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p>
22
24
 
@@ -73,13 +75,15 @@
73
75
  <p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p>
74
76
 
75
77
  <p>Install with:</p>
76
- <pre><code>$ gem install maruku
77
- </code></pre>
78
+
79
+ <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ gem install maruku</code></pre>
80
+
78
81
  <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>
79
82
 
80
83
  <p>Anonymous access to the repository is possible with:</p>
81
- <pre><code>$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk
82
- </code></pre>
84
+
85
+ <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ svn checkout svn://rubyforge.org/var/svn/maruku/trunk</code></pre>
86
+
83
87
  <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>
84
88
 
85
89
  <h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3>
@@ -91,26 +95,33 @@
91
95
  <h3 id='embedded_maruku'><span class='maruku_section_number'>3.1. </span>Embedded Maruku</h3>
92
96
 
93
97
  <p>This is the basic usage:</p>
94
- <pre><code>require &#39;rubygems&#39;
95
- require &#39;maruku&#39;
96
98
 
97
- doc = Maruku.new(markdown_string)
98
- puts doc.to_html
99
- </code></pre>
99
+ <pre style='background-color: #efffef;'><code class='ruby' lang='ruby'><span class='ident'>require</span> <span class='punct'>&#39;</span><span class='string'>rubygems</span><span class='punct'>&#39;</span>
100
+ <span class='ident'>require</span> <span class='punct'>&#39;</span><span class='string'>maruku</span><span class='punct'>&#39;</span>
101
+
102
+ <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>
103
+ <span class='ident'>puts</span> <span class='ident'>doc</span><span class='punct'>.</span><span class='ident'>to_html</span></code></pre>
104
+
100
105
  <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>
101
- <pre><code>puts doc.to_html_document
102
- </code></pre>
106
+
107
+ <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>
108
+
103
109
  <p>You can have the REXML document tree with:</p>
104
- <pre><code>tree = doc.to_html_document_tree
105
- </code></pre>
110
+
111
+ <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>
112
+
106
113
  <h3 id='from_the_command_line'><span class='maruku_section_number'>3.2. </span>From the command line</h3>
107
114
 
108
115
  <p>There is one command-line program installed: <code>maruku</code>.</p>
109
116
 
110
117
  <p>Without arguments, it converts Markdown to HTML:</p>
111
- <pre><code>$ maruku file.md # creates file.html</code></pre>
118
+
119
+ <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ maruku file.md # creates file.html</code></pre>
120
+
112
121
  <p>With the <code>--pdf</code> arguments, it converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p>
113
- <pre><code>$ maruku --pdf file.md # creates file.tex and file.pdf</code></pre>
122
+
123
+ <pre style='background-color: #efefff;'><code class='sh' lang='sh'>$ maruku --pdf file.md # creates file.tex and file.pdf</code></pre>
124
+
114
125
  <h2 id='maruku-and-bluecloth'><span class='maruku_section_number'>4. </span>Maruku and Bluecloth</h2>
115
126
 
116
127
  <p>The other Ruby implementation of Markdown is <a href='http://www.deveiate.org/projects/BlueCloth'>Bluecloth</a>.</p>
@@ -120,10 +131,12 @@ puts doc.to_html
120
131
  <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&#8217;s regexp implementation).</p>
121
132
 
122
133
  <p>This is the canonical benchmark (the Markdown specification), executed with Ruby 1.8.5 on a Powerbook 1.5GhZ:</p>
134
+
123
135
  <pre><code>BlueCloth (to_html): parsing 0.01 sec + rendering 1.87 sec = 1.88 sec (1.00x)
124
136
  Maruku (to_html): parsing 0.66 sec + rendering 0.43 sec = 1.09 sec (1.73x)
125
137
  Maruku (to_latex): parsing 0.67 sec + rendering 0.23 sec = 0.90 sec (2.10x)
126
138
  </code></pre>
139
+
127
140
  <p>Please note that Maruku has a lot more features and therefore is looking for much more patterns in the file.</p>
128
141
 
129
142
  <h2 id='maruku_summary_of_features'><span class='maruku_section_number'>5. </span>Maruku summary of features</h2>
@@ -201,14 +214,16 @@ puts doc.to_html
201
214
  <p>See the <a href='exd.html'>documentation for supported attributes</a>.</p>
202
215
 
203
216
  <p>Meta-data for the document itself is specified through the use of email headers:</p>
204
- <pre><code>Title: A simple document containing meta-headers
217
+
218
+ <pre style='background-color: #ffefef;'><code>Title: A simple document containing meta-headers
205
219
  CSS: style.css
206
220
 
207
- Content of the document
208
- </code></pre>
221
+ Content of the document</code></pre>
222
+
209
223
  <p>When creating the document through</p>
210
- <pre><code>Maruku.new(s).to_html_document
211
- </code></pre>
224
+
225
+ <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>
226
+
212
227
  <p>the title and stylesheet are added as expected.</p>
213
228
 
214
229
  <p>Meta-data keys are assumed to be case-insensitive.</p>
@@ -216,9 +231,11 @@ Content of the document
216
231
  <h3 id='toc-generation'><span class='maruku_section_number'>5.2. </span>Automatic generation of the table of contents</h3>
217
232
 
218
233
  <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>
234
+
219
235
  <pre><code>* This will become a table of contents (this text will be scraped).
220
236
  {:toc}
221
237
  </code></pre>
238
+
222
239
  <p>You can see an example of this at the beginning of this document.</p>
223
240
 
224
241
  <h3 id='entities'><span class='maruku_section_number'>5.3. </span>Use HTML entities</h3>
@@ -242,37 +259,47 @@ Content of the document
242
259
  <ul>
243
260
  <li>
244
261
  <p>tables</p>
245
- <pre><code>Col1 | Very very long head | Very very long head|
262
+
263
+ <pre style='background-color: #ffefef;'><code>Col1 | Very very long head | Very very long head|
246
264
  -----|:-------------------:|-------------------:|
247
- cell | center-align | right-align |</code></pre><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>
265
+ cell | center-align | right-align |</code></pre>
266
+ <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>
248
267
  </tr></tbody></table></li>
249
268
 
250
269
  <li>
251
270
  <p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>
252
- <pre><code>* footnotes [^foot]
253
271
 
254
- [^foot]: I really was missing those.</code></pre></li>
272
+ <pre style='background-color: #ffefef;'><code>* footnotes [^foot]
273
+
274
+ [^foot]: I really was missing those.</code></pre>
275
+ </li>
255
276
  </ul>
256
277
 
257
278
  <ul>
258
279
  <li>
259
280
  <p>Markdown inside HTML elements</p>
260
- <pre><code>&lt;div markdown=&quot;1&quot; style=&quot;border: solid 1px black&quot;&gt;
281
+
282
+ <pre><code class='xml' lang='xml'><span class='punct'>&lt;</span><span class='tag'>div</span> <span class='attribute'>markdown</span><span class='punct'>=&quot;</span><span class='string'>1</span><span class='punct'>&quot;</span> <span class='attribute'>style</span><span class='punct'>=&quot;</span><span class='string'>border: solid 1px black</span><span class='punct'>&quot;&gt;</span>
261
283
  This is a div with Markdown **strong text**
262
- &lt;/div&gt;</code></pre><div style='border: solid 1px black'>
284
+ <span class='punct'>&lt;/</span><span class='tag'>div</span><span class='punct'>&gt;</span></code></pre>
285
+ <div style='border: solid 1px black'>
263
286
  <p>This is a div with Markdown <strong>strong text</strong></p>
264
287
  </div></li>
265
288
 
266
289
  <li>
267
290
  <p>header ids</p>
268
- <pre><code>## Download ## {#download}</code></pre>
291
+
292
+ <pre style='background-color: #ffefef;'><code>## Download ## {#download}</code></pre>
293
+
269
294
  <p>For example, <a href='#download'>a link to the download</a> header.</p>
270
295
  </li>
271
296
 
272
297
  <li>
273
298
  <p>definition lists</p>
274
- <pre><code>Definition list
299
+
300
+ <pre style='background-color: #ffefef;'><code>Definition list
275
301
  : something very hard to parse</code></pre>
302
+
276
303
  <dl>
277
304
  <dt>Definition list</dt>
278
305
 
@@ -296,4 +323,4 @@ I would love to have an equivalent in Ruby.
296
323
 
297
324
  --><div class='footnotes'><hr /><ol><li id='fn:1'>
298
325
  <p>I really was missing those.</p>
299
- <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div><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 14:11 on Tuesday, January 23rd, 2007.</span></div></body></html>
326
+ <a href='#fnref:1' rev='footnote'>&#8617;</a></li></ol></div><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:51 on Wednesday, January 24th, 2007.</span></div></body></html>
data/docs/maruku.md CHANGED
@@ -11,7 +11,7 @@ Mar**u**k**u**: a Markdown-superset interpreter
11
11
 
12
12
  [Maruku] is a Markdown interpreter written in [Ruby].
13
13
 
14
- > [Last release](#release_notes) is version 0.5.0 -- 2007-01-23.
14
+ > [Last release](#release_notes) is version 0.5.1 -- 2007-01-24.
15
15
  >
16
16
  > Use this command to update:
17
17
  >
@@ -94,7 +94,7 @@ Table of contents: (**auto-generated by Maruku!**)
94
94
  {:ruby: lang=ruby code_background_color='#efffef'}
95
95
  {:shell: lang=sh code_background_color='#efefff'}
96
96
  {:markdown: code_background_color='#ffefef'}
97
- {:html: lang=html}
97
+ {:html: lang=xml}
98
98
 
99
99
 
100
100
  Release notes {#release_notes}
@@ -121,16 +121,14 @@ The development site is <http://rubyforge.org/projects/maruku/>.
121
121
  Install with:
122
122
 
123
123
  $ gem install maruku
124
-
125
- {:shell}
124
+ {:shell}
126
125
 
127
126
  Released files can also be seen at <http://rubyforge.org/frs/?group_id=2795>.
128
127
 
129
128
  Anonymous access to the repository is possible with:
130
129
 
131
130
  $ svn checkout svn://rubyforge.org/var/svn/maruku/trunk
132
-
133
- {:shell}
131
+ {:shell}
134
132
 
135
133
  If you want commit access to the repository, just create an account on Rubyforge and [drop me a mail][contact].
136
134
 
@@ -151,20 +149,17 @@ This is the basic usage:
151
149
 
152
150
  doc = Maruku.new(markdown_string)
153
151
  puts doc.to_html
154
-
155
- {:ruby}
152
+ {:ruby}
156
153
 
157
154
  The method `to_html` outputs only an HTML fragment, while the method `to_html_document` outputs a complete XHTML 1.0 document:
158
155
 
159
156
  puts doc.to_html_document
160
-
161
- {:ruby}
157
+ {:ruby}
162
158
 
163
159
  You can have the REXML document tree with:
164
160
 
165
161
  tree = doc.to_html_document_tree
166
-
167
- {:ruby}
162
+ {:ruby}
168
163
 
169
164
  ### From the command line ###
170
165
 
@@ -267,14 +262,12 @@ of email headers:
267
262
  CSS: style.css
268
263
 
269
264
  Content of the document
270
-
271
- {:markdown}
265
+ {:markdown}
272
266
 
273
267
  When creating the document through
274
268
 
275
269
  Maruku.new(s).to_html_document
276
-
277
- {:ruby}
270
+ {:ruby}
278
271
 
279
272
  the title and stylesheet are added as expected.
280
273
 
data/docs/math.md CHANGED
@@ -1,12 +1,22 @@
1
+ Title: Math support in Maruku
1
2
  LaTeX preamble: math_preamble.tex
2
3
  LaTeX use listings: true
3
4
  CSS: math.css style.css
5
+ use numbered headers: true
4
6
 
5
7
  Math support in Maruku
6
8
  ======================
7
9
 
10
+ This document describes Maruku's support of inline LaTeX-style math.
8
11
 
9
- Introduction...
12
+ At the moment, **these features are experimental**, are probably
13
+ buggy and the syntax and implementation are bound to change in
14
+ the near future.
15
+
16
+ Also, there are many subtleties of which one must care for
17
+ correctly serving the XHTML+MathML document to browsers.
18
+ In fact, *this documentation is __not__ enough to get you started*,
19
+ unless you feel very adventurous.
10
20
 
11
21
  * toc
12
22
  {:toc}
@@ -16,9 +26,9 @@ Syntax
16
26
 
17
27
  ### Inline math
18
28
 
19
- Inline math are comprised inside couples of `$`.
29
+ Inline math is contained inside couples of `$`.
20
30
 
21
- Everything inside `$` will be passed as-is to LaTeX: no Markdown
31
+ Everything inside will be passed as-is to LaTeX: no Markdown
22
32
  interpretation will take place.
23
33
 
24
34
  Example: $x^{n}+y^{n} \neq z^{n}$ for $n \geq 3$
@@ -53,7 +63,7 @@ $$ \beth \Subset \bigtriangleup \bumpeq \ggg \pitchfork $$
53
63
 
54
64
  Create a label for an equation in two ways:
55
65
 
56
- * LaTeX style
66
+ * LaTeX style:
57
67
 
58
68
  Consider \eqref{a}:
59
69
 
@@ -94,50 +104,91 @@ Enabling the extension
94
104
 
95
105
  Use the `-m` option to choose the kind of output. Possible choices are:
96
106
 
97
- * `-m itex2mml`
107
+ `--math-engine itex2mml` : Outputs MathML using [itex2mml](#using_itex2mml).
108
+ `--math-engine ritex` : Outputs MathML using [ritex](#using_ritex).
109
+ `--math-engine blahtex` : Outputs MathML using [blahtex](#using_blahtex).
110
+ `--math-images blahtex` : Outputs PNGs using [blahtex](#using_blahtex).
98
111
 
99
- [Instructions for itex2mml][itex2mml].
112
+ ### With embedded Maruku
100
113
 
101
- * `-m ritex`
102
- * `-m blahtex`
114
+ You have to enable the math extension like this:
103
115
 
104
- * `-mi blahtex`
116
+ require 'maruku' # loads maruku
117
+ require 'maruku/ext/math' # loads the math extension
105
118
 
119
+ Use the following to choose the engine:
106
120
 
107
- [itex2mml]: http://golem.ph.utexas.edu/~distler/code/itexToMML/
121
+ MaRuKu::Globals[:html_math_engine] = 'ritex'
122
+ MaRuKu::Globals[:html_png_engine] = 'blahtex'
123
+
124
+ Available MathML engines are 'none', 'itex2mml', 'blahtex'.
125
+ 'blahtex' is the only PNG engine available.
126
+
127
+ External libraries needed
128
+ -------------------------
108
129
 
109
- ### With embedded Maruku
130
+ To output MathML or PNGs, it is needed to install one of the following libraries
110
131
 
111
- First, you have to enable the math extension.
132
+ ### Using `ritex` ### {#using_ritex}
112
133
 
113
- require 'maruku' # loads maruku
114
- require 'maruku/ext/math' # loads the math extension
115
-
134
+ Install with
116
135
 
117
- ### MathML output
136
+ $ gem install ritex
118
137
 
119
- ...
138
+ ritex's abilities are very limited, but it is the easiest to install.
120
139
 
121
- ### PNG output ###
140
+ ### Using `itex2mml` ### {#using_itex2mml}
122
141
 
123
- Other parameters of interests are:
142
+ itex2mml supports much more LaTeX commands/environments than ritex.
124
143
 
125
- * `Globals[:math_png_dir]`
126
- * `Globals[:math_png_dir_url]`
144
+ Install itex2mml using the instructions at:
127
145
 
146
+ > <http://golem.ph.utexas.edu/~distler/blog/itex2MML.html>
128
147
 
129
- Advanced topics
130
- ---------------
148
+ This is a summary of the available LaTeX commands:
131
149
 
132
- ### Styling equations ####
150
+ > <http://golem.ph.utexas.edu/~distler/blog/itex2MMLcommands.html>
151
+
152
+ Moreover, [Jacques Distler] is integrating Maruku+itex2mml+[Instiki].
153
+ You can find more information here:
154
+
155
+ > <http://golem.ph.utexas.edu/~distler/blog/archives/001111.html>
156
+
157
+ [Jacques Distler]: http://golem.ph.utexas.edu/~distler
158
+ [instiki]: http://www.instiki.org
159
+
160
+ ### Using `blahtex` ### {#using_blahtex}
161
+
162
+ Download from <http://www.blahtex.org>. Make sure you have
163
+ the command-line `blahtex` in your path.
164
+
165
+
166
+ Subtleties
167
+ ----------
168
+
169
+ ### Serving the right content/type ###
170
+
171
+
172
+ * Mozilla wants files to have the `.xhtml` extension.
133
173
 
134
174
  ...
135
175
 
136
- ### Aligning PNGs ####
176
+ ### Where PNGS are put ###
177
+
178
+ * `Globals[:math_png_dir]`
179
+
180
+ * `Globals[:math_png_dir_url]`
181
+
182
+
183
+ ### Styling equations ####
137
184
 
138
185
  ...
139
186
 
187
+ ### Aligning PNGs ####
140
188
 
141
189
 
190
+ * using `ex`
142
191
 
192
+ * **IE7 bug**
143
193
 
194
+ ...
data/docs/proposal.html CHANGED
@@ -19,31 +19,41 @@
19
19
  <p>Changed the syntax for compatibility with a future extension mechanism.</p>
20
20
 
21
21
  <p>The first character in the curly braces must be a colon, optionally followed by a space:</p>
22
+
22
23
  <pre><code>{: ref .class #id}
23
24
  </code></pre>
25
+
24
26
  <p>The old syntax was <code>{ref .class #id}</code>.</p>
25
27
 
26
28
  <p>For ALDs, the new syntax is:</p>
29
+
27
30
  <pre><code>{:ref_id: key=val .class #id }
28
31
  </code></pre>
32
+
29
33
  <p>instead of:</p>
34
+
30
35
  <pre><code>{ref_id}: key=val .class #id
31
36
  </code></pre>
37
+
32
38
  <p>Converters that don&#8217;t use this syntax may just ignore everything which is in curly braces and starts with &#8221;:&#8221;.</p>
33
39
  </li>
34
40
 
35
41
  <li>
36
42
  <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>
43
+
37
44
  <pre><code>Paragraph 1
38
45
 
39
46
  {:par2}
40
47
  Paragraph 2
41
48
  </code></pre>
49
+
42
50
  <p>is equivalent to:</p>
51
+
43
52
  <pre><code>Paragraph 1
44
53
 
45
54
  Paragraph 2
46
- {:par2}</code></pre></li>
55
+ {:par2}</code></pre>
56
+ </li>
47
57
 
48
58
  <li>
49
59
  <p>Simplified rules for escaping.</p>
@@ -61,23 +71,30 @@ Paragraph 2
61
71
  <ol>
62
72
  <li>
63
73
  <p>inline attribute lists (IAL)</p>
64
- <pre><code>## Header ## {: key=val .class #id ref_id}</code></pre></li>
74
+
75
+ <pre><code>## Header ## {: key=val .class #id ref_id}</code></pre>
76
+ </li>
65
77
 
66
78
  <li>
67
79
  <p>attribute lists definitions (ALD)</p>
68
- <pre><code>{:ref_id: key=val .class #id}</code></pre></li>
80
+
81
+ <pre><code>{:ref_id: key=val .class #id}</code></pre>
82
+ </li>
69
83
  </ol>
70
84
 
71
85
  <p>Every span-level or block-level element can be followed by an IAL:</p>
86
+
72
87
  <pre><code>### Header ### {: #header1 class=c1}
73
88
 
74
89
  Paragraph *with emphasis*{: class=c1}
75
90
  second line of paragraph
76
91
  {: class=c1}
77
92
  </code></pre>
93
+
78
94
  <p>In this example, the three IALs refer to the header, the emphasis span, and the entire paragraph, respectively.</p>
79
95
 
80
96
  <p>IALs can reference ALDs. The result of the following example is the same as the previous one:</p>
97
+
81
98
  <pre><code>### Header ### {: #header1 c1}
82
99
 
83
100
  Paragraph *with emphasis*{:c1}
@@ -86,11 +103,14 @@ second line of paragraph
86
103
 
87
104
  {:c1: class=c1}
88
105
  </code></pre>
106
+
89
107
  <h2 id='attribute_lists'><span class='maruku_section_number'>2. </span>Attribute lists</h2>
90
108
 
91
109
  <p>This is an example attribute list, which shows everything you can put inside:</p>
110
+
92
111
  <pre><code>{: key1=val key2=&quot;long val&quot; #myid .class1 .class2 ref1 ref2}
93
112
  </code></pre>
113
+
94
114
  <p>More in particular, an attribute list is a whitespace-separated list of elements of 4 different kinds:</p>
95
115
 
96
116
  <ol>
@@ -116,21 +136,26 @@ second line of paragraph
116
136
  <p><code>.myclass</code> means &#8220;add <code>myclass</code> to the current <code>class</code> attribute&#8221;.</p>
117
137
 
118
138
  <p>So these are equivalent:</p>
139
+
119
140
  <pre><code>{: .class1 .class2}
120
- {: class=&quot;class1 class2&quot;}</code></pre></li>
141
+ {: class=&quot;class1 class2&quot;}</code></pre>
142
+ </li>
121
143
  </ul>
122
144
 
123
145
  <p>The following attribute lists are equivalent:</p>
146
+
124
147
  <pre><code>{: #myid .class1 .class2}
125
148
  {: id=myid class=class1 .class2}
126
149
  {: id=myid class=&quot;class1 class2&quot;}
127
150
  {: id=myid class=&quot;will be overridden&quot; class=class1 .class2}
128
151
  </code></pre>
152
+
129
153
  <h2 id='where_to_put_inline_attribute_lists'><span class='maruku_section_number'>3. </span>Where to put inline attribute lists</h2>
130
154
 
131
155
  <h3 id='for_blocklevel_elements'><span class='maruku_section_number'>3.1. </span>For block-level elements</h3>
132
156
 
133
157
  <p>For paragraphs and other block-level elements, IAL go <strong>after</strong> the element:</p>
158
+
134
159
  <pre><code>This is a paragraph.
135
160
  Line 2 of the paragraph.
136
161
  {: #myid .myclass}
@@ -139,13 +164,17 @@ A quote with a citation url:
139
164
  &gt; Who said that?
140
165
  {: cite=google.com}
141
166
  </code></pre>
167
+
142
168
  <p>Note: empty lines between the block and the IAL are not tolerated. So this is not legal:</p>
169
+
143
170
  <pre><code>This is a paragraph.
144
171
  Line 2 of the paragraph.
145
172
 
146
173
  {: #myid .myclass}
147
174
  </code></pre>
175
+
148
176
  <p>Attribute lists may be indented up to 3 spaces:</p>
177
+
149
178
  <pre><code>Paragraph1
150
179
  &#172;{:ok}
151
180
 
@@ -154,15 +183,19 @@ Paragraph2
154
183
 
155
184
  Paragraph2
156
185
  &#172;&#172;&#172;{:ok}</code></pre>
186
+
157
187
  <h3 id='for_headers'><span class='maruku_section_number'>3.2. </span>For headers</h3>
158
188
 
159
189
  <p>For headers, you can put attribute lists on the same line:</p>
190
+
160
191
  <pre><code>### Header ### {: #myid}
161
192
 
162
193
  Header {: #myid .myclass}
163
194
  ------
164
195
  </code></pre>
196
+
165
197
  <p>or, as like other block-level elements, on the line below:</p>
198
+
166
199
  <pre><code>### Header ###
167
200
  {: #myid}
168
201
 
@@ -170,24 +203,33 @@ Header
170
203
  ------
171
204
  {: #myid .myclass}
172
205
  </code></pre>
206
+
173
207
  <h3 id='for_spanlevel_elements'><span class='maruku_section_number'>3.3. </span>For span-level elements</h3>
174
208
 
175
209
  <p>For span-level elements, meta-data goes immediately <strong>after</strong> in the flow.</p>
176
210
 
177
211
  <p>For example, in this:</p>
212
+
178
213
  <pre><code>This is a *chunky paragraph*{: #id1}
179
214
  {: #id2}</code></pre>
215
+
180
216
  <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>
181
217
 
182
218
  <p>This works also for links, like this:</p>
219
+
183
220
  <pre><code>This is [a link][ref]{:#myid rel=abc rev=abc}
184
221
  </code></pre>
222
+
185
223
  <p>For images, this:</p>
224
+
186
225
  <pre><code>This is ![Alt text](url &quot;fresh carrots&quot;)
187
226
  </code></pre>
227
+
188
228
  <p>is equivalent to:</p>
229
+
189
230
  <pre><code>This is ![Alt text](url){:title=&quot;fresh carrots&quot;}
190
231
  </code></pre>
232
+
191
233
  <h2 id='using_tags'><span class='maruku_section_number'>4. </span>Using attributes lists definition</h2>
192
234
 
193
235
  <p>In an attribute list, you can have:</p>
@@ -201,13 +243,16 @@ Header
201
243
  </ol>
202
244
 
203
245
  <p>Everything else is interpreted as a reference to an ALD.</p>
246
+
204
247
  <pre><code># Header # {:ref}
205
248
 
206
249
  Blah blah blah.
207
250
 
208
251
  {:ref: #myhead .myclass lang=fr}
209
252
  </code></pre>
253
+
210
254
  <p>Of course, more than one IAL can reference the same ALD:</p>
255
+
211
256
  <pre><code># Header 1 # {:1}
212
257
  ...
213
258
  # Header 2 # {:1}
@@ -215,6 +260,7 @@ Blah blah blah.
215
260
  {:1: .myclass lang=fr}
216
261
 
217
262
  </code></pre>
263
+
218
264
  <h2 id='the_rules'><span class='maruku_section_number'>5. </span>The rules</h2>
219
265
 
220
266
  <h3 id='the_issue_of_escaping'><span class='maruku_section_number'>5.1. </span>The issue of escaping</h3>
@@ -239,7 +285,7 @@ Blah blah blah.
239
285
  </li>
240
286
 
241
287
  <li>
242
- <p>Inside <code>&apos;quoted values&apos;</code>, you <strong>must</strong> escape <code>&apos;</code>.</p>
288
+ <p>Inside <code>&#39;quoted values&#39;</code>, you <strong>must</strong> escape <code>&#39;</code>.</p>
243
289
  </li>
244
290
 
245
291
  <li>
@@ -247,15 +293,17 @@ Blah blah blah.
247
293
  </li>
248
294
  </ul>
249
295
 
250
- <p><code>&quot;bah &apos;bah&apos; bah&quot;</code> = <code>&quot;bah \&apos;bah\&apos; bah&quot;</code> = <code>&apos;bah \&apos;bah\&apos; bah&apos;</code></p>
296
+ <p><code>&quot;bah &#39;bah&#39; bah&quot;</code> = <code>&quot;bah \&#39;bah\&#39; bah&quot;</code> = <code>&#39;bah \&#39;bah\&#39; bah&#39;</code></p>
251
297
 
252
- <p><code>&apos;bah &quot;bah&quot; bah&apos;</code> = <code>&apos;bah \&quot;bah\&quot; bah&apos;</code> = <code>&quot;bah \&quot;bah\&quot; bah&quot;</code></p>
298
+ <p><code>&#39;bah &quot;bah&quot; bah&#39;</code> = <code>&#39;bah \&quot;bah\&quot; bah&#39;</code> = <code>&quot;bah \&quot;bah\&quot; bah&quot;</code></p>
253
299
  </li>
254
300
 
255
301
  <li>
256
302
  <p>There is an exception for backward compatibility, in links/images titles:</p>
303
+
257
304
  <pre><code>[text](url &quot;title&quot;with&quot;quotes&quot;)
258
305
  </code></pre>
306
+
259
307
  <p>The exception is not valid for attribute lists and in other contexts, where you have to use the canonical syntax.</p>
260
308
  </li>
261
309
  </ol>
@@ -263,28 +311,36 @@ Blah blah blah.
263
311
  <h3 id='syntax_for_attribute_lists'><span class='maruku_section_number'>5.2. </span>Syntax for attribute lists</h3>
264
312
 
265
313
  <p>Consider the following attribute list:</p>
314
+
266
315
  <pre><code>{: key=value ref key2=&quot;quoted value&quot; }</code></pre>
267
- <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>&apos;</code>,<code>&quot;</code>.</p>
316
+
317
+ <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>&#39;</code>,<code>&quot;</code>.</p>
268
318
 
269
319
  <p>Inside a quoted value you <strong>must</strong> escape the other kind of quote.</p>
270
320
 
271
321
  <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>
272
322
 
273
323
  <p>If you don&#8217;t implement this syntax, you can get rid of the IAL by using this regular expression (this is written in Ruby):</p>
324
+
274
325
  <pre><code>r = /\{:(\\\}|[^\}])*\}/
275
326
 
276
327
  s.gsub(r, &#39;&#39;) # ignore metadata</code></pre>
328
+
277
329
  <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>
278
330
 
279
331
  <p>For this example,</p>
332
+
280
333
  <pre><code>this is
281
334
  {: skipped=&quot;\}&quot; val=\} bar}
282
335
 
283
336
  for me
284
337
  {: also this}
285
338
  </code></pre>
339
+
286
340
  <p>the result is:</p>
341
+
287
342
  <pre><code>this is
288
343
 
289
344
 
290
- for me </code></pre><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 14:11 on Tuesday, January 23rd, 2007.</span></div></body></html>
345
+ for me </code></pre>
346
+ <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:49 on Wednesday, January 24th, 2007.</span></div></body></html>