maruku 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/maruku +74 -22
- data/bin/marutest +15 -3
- data/docs/{changelog-0.3.md → changelog.md} +47 -18
- data/docs/entity_test.html +253 -0
- data/docs/entity_test.md +21 -0
- data/docs/index.html +124 -31
- data/docs/markdown_syntax.html +46 -46
- data/docs/maruku.html +124 -31
- data/docs/maruku.md +47 -9
- data/docs/proposal.html +4 -4
- data/lib/maruku.rb +1 -0
- data/lib/maruku/defaults.rb +1 -1
- data/lib/maruku/helpers.rb +4 -4
- data/lib/maruku/input/parse_block.rb +39 -33
- data/lib/maruku/input/parse_doc.rb +57 -3
- data/lib/maruku/input/parse_span_better.rb +28 -8
- data/lib/maruku/input/rubypants.rb +225 -0
- data/lib/maruku/input/type_detection.rb +1 -0
- data/lib/maruku/output/to_html.rb +46 -47
- data/lib/maruku/output/to_latex.rb +166 -45
- data/lib/maruku/output/to_latex_entities.rb +75 -43
- data/lib/maruku/string_utils.rb +21 -19
- data/lib/maruku/structures.rb +21 -12
- data/lib/maruku/structures_inspect.rb +12 -3
- data/lib/maruku/tests/new_parser.rb +2 -1
- data/lib/maruku/version.rb +1 -1
- data/tests/unittest/abbreviations.md +8 -8
- data/tests/unittest/attributes/attributes.md +10 -10
- data/tests/unittest/attributes/circular.md +4 -4
- data/tests/unittest/attributes/default.md +3 -3
- data/tests/unittest/blank.md +2 -2
- data/tests/unittest/blanks_in_code.md +12 -12
- data/tests/unittest/code.md +4 -4
- data/tests/unittest/code2.md +7 -6
- data/tests/unittest/code3.md +16 -16
- data/tests/unittest/easy.md +4 -4
- data/tests/unittest/email.md +4 -4
- data/tests/unittest/encoding/iso-8859-1.md +2 -2
- data/tests/unittest/encoding/utf-8.md +2 -2
- data/tests/unittest/entities.md +20 -20
- data/tests/unittest/escaping.md +16 -16
- data/tests/unittest/extra_dl.md +17 -7
- data/tests/unittest/extra_header_id.md +11 -11
- data/tests/unittest/extra_table1.md +4 -4
- data/tests/unittest/footnotes.md +38 -28
- data/tests/unittest/headers.md +6 -6
- data/tests/unittest/hrule.md +6 -6
- data/tests/unittest/images.md +18 -16
- data/tests/unittest/inline_html.md +7 -29
- data/tests/unittest/inline_html2.md +3 -3
- data/tests/unittest/links.md +7 -27
- data/tests/unittest/list1.md +9 -8
- data/tests/unittest/list2.md +15 -12
- data/tests/unittest/list3.md +16 -14
- data/tests/unittest/list4.md +4 -4
- data/tests/unittest/lists.md +33 -29
- data/tests/unittest/lists_after_paragraph.md +36 -36
- data/tests/unittest/lists_ol.md +43 -38
- data/tests/unittest/misc_sw.md +172 -156
- data/tests/unittest/notyet/escape.md +8 -8
- data/tests/unittest/notyet/header_after_par.md +6 -6
- data/tests/unittest/notyet/ticks.md +4 -4
- data/tests/unittest/notyet/triggering.md +21 -21
- data/tests/unittest/olist.md +5 -5
- data/tests/unittest/one.md +1 -1
- data/tests/unittest/paragraph.md +1 -1
- data/tests/unittest/paragraph_rules/dont_merge_ref.md +1 -1
- data/tests/unittest/paragraph_rules/tab_is_blank.md +2 -2
- data/tests/unittest/paragraphs.md +5 -5
- data/tests/unittest/recover/recover_links.md +2 -2
- data/tests/unittest/references/long_example.md +27 -19
- data/tests/unittest/smartypants.md +148 -0
- data/tests/unittest/syntax_hl.md +14 -14
- data/tests/unittest/test.md +2 -2
- data/tests/unittest/wrapping.md +8 -8
- data/tests/unittest/xml_instruction.md +82 -0
- metadata +149 -160
- data/docs/TOFIX.html +0 -22
- data/docs/TOFIX.md +0 -3
- data/docs/changelog-0.2.13.html +0 -30
- data/docs/changelog-0.2.13.md +0 -6
- data/docs/changelog-0.3.html +0 -113
- data/docs/faq.html +0 -57
- data/docs/faq.md +0 -32
- data/docs/hidden_o_n_squared.md +0 -10
- data/docs/todo.html +0 -40
- data/docs/todo.md +0 -9
data/docs/maruku.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='Content-type' /><title>Maruku: a Markdown-superset interpreter</title><link href='style.css' rel='stylesheet' type='text/css' /></head><body>
|
5
5
|
<h1 id='maruku_a_markdownsuperset_interpreter'>Mar<strong>u</strong>k<strong>u</strong>: a Markdown-superset interpreter</h1>
|
6
6
|
|
7
|
-
<p><a href='http://maruku.rubyforge.org
|
7
|
+
<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>
|
8
8
|
|
9
9
|
<p>Maruku allows you to write in an easy-to-read-and-write syntax, like this:</p>
|
10
10
|
|
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
<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>
|
44
44
|
|
45
|
-
<p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> translitteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> translitteration of &
|
45
|
+
<p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a> translitteration of the <a href='http://en.wikipedia.org/wiki/Katakana'>katakana</a> translitteration of “Mark”, the first word in Markdown. I chose this name because Ruby is Japanese, and also the sillable “ru” appears in Maruku.</p>
|
46
46
|
<hr />
|
47
47
|
<p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
|
48
48
|
<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='#from_the_command_line'>From the command line</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#extra'>Examples of PHP Markdown Extra syntax</a></li><li><span class='maruku_section_number'>5. </span><a href='#maruku-and-bluecloth'>Maruku and Bluecloth</a></li><li><span class='maruku_section_number'>6. </span><a href='#meta'>New meta-data syntax</a><ul style='list-style: none;'><li><span class='maruku_section_number'>6.1. </span><a href='#metadata_for_blocklevel_and_spanlevel_elements'>Meta-data for block-level and span-level elements</a></li><li><span class='maruku_section_number'>6.2. </span><a href='#metadata_for_the_document'>Meta-data for the document</a></li><li><span class='maruku_section_number'>6.3. </span><a href='#metalist'>List of meta-data</a></li><li><span class='maruku_section_number'>6.4. </span><a href='#examples'>Examples</a></li></ul></li><li><span class='maruku_section_number'>7. </span><a href='#features'>Other Features</a><ul style='list-style: none;'><li><span class='maruku_section_number'>7.1. </span><a href='#automatic_generation_of_the_table_of_contents'>Automatic generation of the table of contents</a></li><li><span class='maruku_section_number'>7.2. </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><li><span class='maruku_section_number'>7.3. </span><a href='#use_html_entities'>Use HTML entities</a></li></ul></li><li><span class='maruku_section_number'>8. </span><a href='#future'>Future developments</a><ul style='list-style: none;'><li><span class='maruku_section_number'>8.1. </span><a href='#a_syntax_for_adding_math'>A syntax for adding math</a></li></ul></li></ul></div><hr />
|
@@ -54,6 +54,54 @@
|
|
54
54
|
|
55
55
|
<p>Have fun!</p>
|
56
56
|
|
57
|
+
<h4 id='changes_in_041_aka_typographer'>Changes in 0.4.1 aka “Typographer”</h4>
|
58
|
+
|
59
|
+
<ul>
|
60
|
+
<li>
|
61
|
+
<p>Implemented SmartyPants support:</p>
|
62
|
+
<pre><code>'Twas a "test" to 'remember' -- in the '90s
|
63
|
+
--- while I was <<ok>>. She was 6\"12\'.</code></pre>
|
64
|
+
<blockquote>
|
65
|
+
<p>‘Twas a “test” to ‘remember’ – in the ’90s — while I was «ok». She was 6"12'.</p>
|
66
|
+
</blockquote>
|
67
|
+
|
68
|
+
<p>I adapted the code from RubyPants.</p>
|
69
|
+
</li>
|
70
|
+
|
71
|
+
<li>
|
72
|
+
<p>Server directives between <code><? ?></code> are properly preserved.</p>
|
73
|
+
</li>
|
74
|
+
|
75
|
+
<li>
|
76
|
+
<p>Changes in LaTeX export:</p>
|
77
|
+
|
78
|
+
<ul>
|
79
|
+
<li>
|
80
|
+
<p>Now Japanese text rendering sort of works, using the following packages:</p>
|
81
|
+
<pre><code>\usepackage[C40]{fontenc}
|
82
|
+
\usepackage[cjkjis]{ucs}
|
83
|
+
\usepackage[utf8x]{inputenc}
|
84
|
+
</code></pre>
|
85
|
+
<p>Nevertheless, I could only get bitmap fonts working – probably it’s a problem with my setup.</p>
|
86
|
+
|
87
|
+
<p>A quick test: 日本、中国、ひらがな、カタカナ。</p>
|
88
|
+
</li>
|
89
|
+
|
90
|
+
<li>
|
91
|
+
<p>Fixed bugs in rendering of immediate links.</p>
|
92
|
+
</li>
|
93
|
+
|
94
|
+
<li>
|
95
|
+
<p>External packages are <code>require</code>d only if needed.</p>
|
96
|
+
</li>
|
97
|
+
|
98
|
+
<li>
|
99
|
+
<p>More symbols supported. See the symbol list <a href='http://maruku.rubyforge.org/entity_test.html'>in HTML</a> and <a href='http://maruku.rubyforge.org/entity_test.pdf'>in PDF</a>.</p>
|
100
|
+
</li>
|
101
|
+
</ul>
|
102
|
+
</li>
|
103
|
+
</ul>
|
104
|
+
|
57
105
|
<h4 id='changes_in_04'>Changes in 0.4</h4>
|
58
106
|
|
59
107
|
<ul>
|
@@ -63,7 +111,7 @@
|
|
63
111
|
|
64
112
|
<li>Created <a href='http://maruku.rubyforge.org/rdoc/'>the RDOC documentation</a>.</li>
|
65
113
|
|
66
|
-
<li>The <code>add_whitespace</code> method took too much time
|
114
|
+
<li>The <code>add_whitespace</code> method took too much time – it was O(n^2).</li>
|
67
115
|
|
68
116
|
<li>Added unit-tests for block-level elements.</li>
|
69
117
|
</ul>
|
@@ -125,7 +173,7 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
|
|
125
173
|
<p>(日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください).</p>
|
126
174
|
</blockquote>
|
127
175
|
|
128
|
-
<p>In the LaTeX version, these do not appear. I know how to do LaTeX with ISO-8859-1 encoding (European characters), but I&
|
176
|
+
<p>In the LaTeX version, these do not appear. I know how to do LaTeX with ISO-8859-1 encoding (European characters), but I’m struggling with half-baked solutions for UTF-8 encoded documents.</p>
|
129
177
|
</li>
|
130
178
|
|
131
179
|
<li>
|
@@ -154,11 +202,11 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
|
|
154
202
|
<p>The development site is <a href='http://rubyforge.org/projects/maruku/'>http://rubyforge.org/projects/maruku/</a>.</p>
|
155
203
|
|
156
204
|
<p>Install with:</p>
|
157
|
-
<pre class='
|
205
|
+
<pre class='sh' style='background-color: #efefff;'>$ gem install maruku</pre>
|
158
206
|
<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>
|
159
207
|
|
160
208
|
<p>Anonymous access to the repository is possible with:</p>
|
161
|
-
<pre class='
|
209
|
+
<pre class='sh' style='background-color: #efefff;'>$ svn checkout svn://rubyforge.org/var/svn/maruku</pre>
|
162
210
|
<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>
|
163
211
|
|
164
212
|
<h3 id='bugs_report'><span class='maruku_section_number'>2.1. </span>Bugs report</h3>
|
@@ -184,11 +232,11 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
|
|
184
232
|
<ul>
|
185
233
|
<li>
|
186
234
|
<p><code>maruku</code> converts Markdown to HTML:</p>
|
187
|
-
<pre class='
|
235
|
+
<pre class='sh' style='background-color: #efefff;'>$ maruku file.md # creates file.html</pre></li>
|
188
236
|
|
189
237
|
<li>
|
190
238
|
<p><code>marutex</code> converts Markdown to LaTeX, then calls <code>pdflatex</code> to transform to PDF:</p>
|
191
|
-
<pre class='
|
239
|
+
<pre class='sh' style='background-color: #efefff;'>$ marutex file.md # creates file.tex and file.pdf</pre></li>
|
192
240
|
</ul>
|
193
241
|
|
194
242
|
<h2 id='extra'><span class='maruku_section_number'>4. </span>Examples of PHP Markdown Extra syntax</h2>
|
@@ -196,15 +244,15 @@ Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pr
|
|
196
244
|
<ul>
|
197
245
|
<li>
|
198
246
|
<p>tables</p>
|
199
|
-
<pre
|
247
|
+
<pre style='background-color: #ffefef;'><code>Col1 | Very very long head | Very very long head|
|
200
248
|
-----|:-------------------:|-------------------:|
|
201
|
-
cell | center-align | right-align |</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></tr></tbody></table></li>
|
249
|
+
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></tr></tbody></table></li>
|
202
250
|
|
203
251
|
<li>
|
204
252
|
<p>footnotes <sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>
|
205
|
-
<pre
|
253
|
+
<pre style='background-color: #ffefef;'><code>* footnotes [^foot]
|
206
254
|
|
207
|
-
[^foot]: I really was missing those.</pre></li>
|
255
|
+
[^foot]: I really was missing those.</code></pre></li>
|
208
256
|
</ul>
|
209
257
|
|
210
258
|
<ul>
|
@@ -218,14 +266,20 @@ cell | center-align | right-align |</pre><table><thead><tr><th>Col
|
|
218
266
|
|
219
267
|
<li>
|
220
268
|
<p>header ids</p>
|
221
|
-
<pre
|
269
|
+
<pre style='background-color: #ffefef;'><code>## Download ## {#download}</code></pre>
|
222
270
|
<p>For example, <a href='#download'>a link to the download</a> header.</p>
|
223
271
|
</li>
|
224
272
|
|
225
273
|
<li>
|
226
274
|
<p>definition lists</p>
|
227
|
-
<pre
|
228
|
-
: something very hard to parse</pre
|
275
|
+
<pre style='background-color: #ffefef;'><code>Definition list
|
276
|
+
: something very hard to parse</code></pre>
|
277
|
+
<dl>
|
278
|
+
<dt>Definition list</dt>
|
279
|
+
|
280
|
+
<dd>something very hard to parse</dd>
|
281
|
+
</dl>
|
282
|
+
</li>
|
229
283
|
|
230
284
|
<li>
|
231
285
|
<p>abbreviations or <abbr title='Simply an abbreviation'>ABB</abbr> for short.</p>
|
@@ -254,7 +308,7 @@ cell | center-align | right-align |</pre><table><thead><tr><th>Col
|
|
254
308
|
|
255
309
|
<h2 id='meta'><span class='maruku_section_number'>6. </span>New meta-data syntax</h2>
|
256
310
|
|
257
|
-
<p>Maruku implements a syntax that allows to attach &
|
311
|
+
<p>Maruku implements a syntax that allows to attach “meta” information to objects.</p>
|
258
312
|
|
259
313
|
<h3 id='metadata_for_blocklevel_and_spanlevel_elements'><span class='maruku_section_number'>6.1. </span>Meta-data for block-level and span-level elements</h3>
|
260
314
|
|
@@ -263,10 +317,11 @@ cell | center-align | right-align |</pre><table><thead><tr><th>Col
|
|
263
317
|
<h3 id='metadata_for_the_document'><span class='maruku_section_number'>6.2. </span>Meta-data for the document</h3>
|
264
318
|
|
265
319
|
<p>Meta-data for the document itself is specified through the use of email headers:</p>
|
266
|
-
<pre
|
320
|
+
<pre style='background-color: #ffefef;'><code>Title: A simple document containing meta-headers
|
267
321
|
CSS: style.css
|
268
322
|
|
269
|
-
Content of the document
|
323
|
+
Content of the document
|
324
|
+
</code></pre>
|
270
325
|
<p>When creating the document through</p>
|
271
326
|
<pre class='ruby' style='background-color: #efffef;'><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></pre>
|
272
327
|
<p>the title and stylesheet are added as expected.</p>
|
@@ -274,29 +329,65 @@ Content of the document</pre>
|
|
274
329
|
<p>Meta-data keys are assumed to be case-insensitive.</p>
|
275
330
|
<hr />
|
276
331
|
<h3 id='metalist'><span class='maruku_section_number'>6.3. </span>List of meta-data</h3>
|
277
|
-
|
332
|
+
|
333
|
+
<dl>
|
334
|
+
<dt><strong><code>title</code>, <code>subject</code></strong></dt>
|
335
|
+
|
336
|
+
<dd>
|
278
337
|
<p>(document) Sets the title of the document (HTML: used in the <code>TITLE</code> element).</p>
|
279
|
-
</dd
|
338
|
+
</dd>
|
339
|
+
|
340
|
+
<dt><strong><code>use_numbered_headers</code></strong></dt>
|
341
|
+
|
342
|
+
<dd>
|
280
343
|
<p>(document) If <code>true</code>, headers are numbered (just like this document). Default is <code>false</code>.</p>
|
281
|
-
</dd
|
344
|
+
</dd>
|
345
|
+
|
346
|
+
<dt><strong><code>css</code></strong></dt>
|
347
|
+
|
348
|
+
<dd>
|
282
349
|
<p>(document, HTML) Url of stylesheet.</p>
|
283
|
-
</dd
|
350
|
+
</dd>
|
351
|
+
|
352
|
+
<dt><strong><code>html_use_syntax</code></strong></dt>
|
353
|
+
|
354
|
+
<dd>
|
284
355
|
<p>(document, HTML) If set, use the <a href='http://syntax.rubyforge.org/'>Ruby <code>syntax</code> library</a> to add source highlighting.</p>
|
285
|
-
</dd
|
356
|
+
</dd>
|
357
|
+
|
358
|
+
<dt><strong><code>latex_use_listings</code></strong></dt>
|
359
|
+
|
360
|
+
<dd>
|
286
361
|
<p>(document, LaTeX) If set, use the fancy <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code> package</a> for better displaying code blocks.</p>
|
287
362
|
|
288
363
|
<p>If not set, use standard <code>verbatim</code> environment.</p>
|
289
|
-
</dd
|
364
|
+
</dd>
|
365
|
+
|
366
|
+
<dt><strong><code>style</code>, <code>id</code>, <code>class</code></strong></dt>
|
367
|
+
|
368
|
+
<dd>
|
290
369
|
<p>(any block object, HTML) Standard CSS attributes are copied.</p>
|
291
|
-
</dd
|
370
|
+
</dd>
|
371
|
+
|
372
|
+
<dt><strong><code>lang</code></strong></dt>
|
373
|
+
|
374
|
+
<dd>
|
292
375
|
<p>(code blocks) Name of programming language (<code>ruby</code>) for syntax highlighting.</p>
|
293
376
|
|
294
377
|
<p>Default for this is <code>code_lang</code> in document.</p>
|
295
378
|
|
296
379
|
<p>Syntax highlighting is delegated to the <a href='http://syntax.rubyforge.org/'><code>syntax</code> library</a> for HTML output and to the <a href='http://www.ctan.org/tex-archive/macros/latex/contrib/listings/'><code>listings</code> package</a> for LaTeX output.</p>
|
297
|
-
</dd
|
380
|
+
</dd>
|
381
|
+
|
382
|
+
<dt><strong><code>code_show_spaces</code></strong></dt>
|
383
|
+
|
384
|
+
<dd>
|
298
385
|
<p>Shows tabs and newlines (default is read in the document object).</p>
|
299
|
-
</dd
|
386
|
+
</dd>
|
387
|
+
|
388
|
+
<dt><strong><code>code_background_color</code></strong></dt>
|
389
|
+
|
390
|
+
<dd>
|
300
391
|
<p>Background color for code blocks. (default is read in the document object).</p>
|
301
392
|
|
302
393
|
<p>The format is either a named color (<code>green</code>, <code>red</code>) or a CSS color of the form <code>#ff00ff</code>.</p>
|
@@ -312,15 +403,17 @@ Content of the document</pre>
|
|
312
403
|
<p>For example, for <code>#0000ff</code>, the macro is called as: <code>\color[rgb]{0,0,1}</code>.</p>
|
313
404
|
</li>
|
314
405
|
</ul>
|
315
|
-
</dd
|
406
|
+
</dd>
|
407
|
+
</dl>
|
408
|
+
|
316
409
|
<h3 id='examples'><span class='maruku_section_number'>6.4. </span>Examples</h3>
|
317
410
|
|
318
411
|
<p>An example of this is the following:</p>
|
319
|
-
<pre
|
412
|
+
<pre style='background-color: #ffefef;'><code> One space
|
320
413
|
Two spaces
|
321
414
|
Tab, space, tab
|
322
415
|
Tab, tab, tab and all is green!
|
323
|
-
{code_show_spaces code_background_color=#ffeedd}</pre>
|
416
|
+
{code_show_spaces code_background_color=#ffeedd}</code></pre>
|
324
417
|
<p>That will produce:</p>
|
325
418
|
<pre style='background-color: #ffeedd;'><code>¬One¬space
|
326
419
|
¬¬Two¬spaces
|
@@ -368,4 +461,4 @@ $ \alpha = \beta + \gamma $ (eq:1)
|
|
368
461
|
|
369
462
|
This is a reference to equation: please see (eq:1)</code></pre><div class='footnotes'><hr /><ol><li id='fn:1'>
|
370
463
|
<p>I really was missing those.</p>
|
371
|
-
<a href='#fnref:1' rev='footnote'>↩</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 interpreter'>Maruku</a> at
|
464
|
+
<a href='#fnref:1' rev='footnote'>↩</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 interpreter for Ruby'>Maruku</a> at 23:50 on Monday, January 08th, 2007.</span></div></body></html>
|
data/docs/maruku.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
CSS: style.css
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
Use numbered headers: true
|
3
|
+
HTML use syntax: true
|
4
|
+
LaTeX use listings: true
|
5
|
+
LaTeX CJK: true
|
5
6
|
|
6
|
-
{ruby}: lang=ruby code_background_color='#efffef'
|
7
|
-
{shell}: lang=shell code_background_color='#efefff'
|
8
|
-
{markdown}: lang=markdown code_background_color='#ffefef'
|
9
7
|
|
10
8
|
|
11
9
|
Mar**u**k**u**: a Markdown-superset interpreter
|
@@ -27,8 +25,8 @@ or LaTeX, which is then converted to PDF:
|
|
27
25
|
|
28
26
|
Maruku implements:
|
29
27
|
|
30
|
-
* the original [Markdown syntax][markdown_html]
|
31
|
-
[PDF][markdown_pdf]), translated by Maruku).
|
28
|
+
* the original [Markdown syntax][markdown_html]
|
29
|
+
([HTML][markdown_html] or [PDF][markdown_pdf]), translated by Maruku).
|
32
30
|
|
33
31
|
* all the improvements in [PHP Markdown Extra][].
|
34
32
|
|
@@ -43,11 +41,12 @@ the [katakana][] translitteration
|
|
43
41
|
of "Mark", the first word in Markdown. I chose this name because Ruby
|
44
42
|
is Japanese, and also the sillable "ru" appears in Maruku.
|
45
43
|
|
44
|
+
|
46
45
|
[romaji]: http://en.wikipedia.org/wiki/Romaji
|
47
46
|
[katakana]: http://en.wikipedia.org/wiki/Katakana
|
48
47
|
|
49
48
|
[tests]: http://maruku.rubyforge.org/tests/
|
50
|
-
[maruku]:
|
49
|
+
[maruku]: http://maruku.rubyforge.org/
|
51
50
|
[markdown_html]: http://maruku.rubyforge.org/markdown_syntax.html
|
52
51
|
[markdown_pdf]: http://maruku.rubyforge.org/markdown_syntax.pdf
|
53
52
|
[this_md]: http://maruku.rubyforge.org/maruku.md
|
@@ -64,6 +63,12 @@ Table of contents: (**auto-generated by Maruku!**)
|
|
64
63
|
|
65
64
|
* * *
|
66
65
|
|
66
|
+
{ruby}: lang=ruby code_background_color='#efffef'
|
67
|
+
{shell}: lang=sh code_background_color='#efefff'
|
68
|
+
{markdown}: code_background_color='#ffefef'
|
69
|
+
|
70
|
+
|
71
|
+
|
67
72
|
Release notes {#release_notes}
|
68
73
|
--------------
|
69
74
|
|
@@ -78,6 +83,39 @@ please write to the [Markdown-discuss mailing list][markdown-discuss].
|
|
78
83
|
|
79
84
|
Have fun!
|
80
85
|
|
86
|
+
#### Changes in 0.4.1 aka "Typographer" ####
|
87
|
+
|
88
|
+
* Implemented SmartyPants support:
|
89
|
+
|
90
|
+
'Twas a "test" to 'remember' -- in the '90s
|
91
|
+
--- while I was <<ok>>. She was 6\"12\'.
|
92
|
+
> 'Twas a "test" to 'remember' -- in the '90s --- while I was <<ok>>.
|
93
|
+
> She was 6\"12\'.
|
94
|
+
|
95
|
+
I adapted the code from RubyPants.
|
96
|
+
|
97
|
+
* Server directives between `<? ?>` are properly preserved.
|
98
|
+
* Changes in LaTeX export:
|
99
|
+
|
100
|
+
* Now Japanese text rendering sort of works, using the following packages:
|
101
|
+
|
102
|
+
\usepackage[C40]{fontenc}
|
103
|
+
\usepackage[cjkjis]{ucs}
|
104
|
+
\usepackage[utf8x]{inputenc}
|
105
|
+
|
106
|
+
Nevertheless, I could only get bitmap fonts working -- probably it's a problem
|
107
|
+
with my setup.
|
108
|
+
|
109
|
+
A quick test: 日本、中国、ひらがな、カタカナ。
|
110
|
+
|
111
|
+
* Fixed bugs in rendering of immediate links.
|
112
|
+
* External packages are `require`d only if needed.
|
113
|
+
* More symbols supported.
|
114
|
+
See the symbol list
|
115
|
+
[in HTML](http://maruku.rubyforge.org/entity_test.html) and
|
116
|
+
[in PDF](http://maruku.rubyforge.org/entity_test.pdf).
|
117
|
+
|
118
|
+
|
81
119
|
#### Changes in 0.4 ####
|
82
120
|
|
83
121
|
* First implementation of [the new meta-data syntax][meta].
|
data/docs/proposal.html
CHANGED
@@ -71,7 +71,7 @@ second line of paragraph
|
|
71
71
|
</li>
|
72
72
|
|
73
73
|
<li>
|
74
|
-
<p><code>.myclass</code> means &
|
74
|
+
<p><code>.myclass</code> means “add <code>myclass</code> to the current <code>class</code> attribute”.</p>
|
75
75
|
|
76
76
|
<p>So these are equivalent:</p>
|
77
77
|
<pre><code>{.class1 .class2}
|
@@ -252,7 +252,7 @@ highlight
|
|
252
252
|
|
253
253
|
<li>
|
254
254
|
<blockquote>
|
255
|
-
<p>Another question: does it makes sense to define <code><span></code> within Markdown when you can&
|
255
|
+
<p>Another question: does it makes sense to define <code><span></code> within Markdown when you can’t have <code><b></code> and <code><i></code>, or the more meaningful <code><cite></code>, <code><q></code>, <code><dfn></code>, and <code><var></code>? We have to draw the line somewhere, where should it be? Another good question for the list.</p>
|
256
256
|
</blockquote>
|
257
257
|
|
258
258
|
<p>Any opinion?</p>
|
@@ -297,8 +297,8 @@ Paragraph..
|
|
297
297
|
<p>Question: should <code>:</code> be a synonym for <code>=</code> in attributes list?</p>
|
298
298
|
|
299
299
|
<blockquote>
|
300
|
-
<p>No, because &
|
300
|
+
<p>No, because ’:’ is used for XML namespaces (<code>xml:lang=en</code>)</p>
|
301
301
|
</blockquote>
|
302
302
|
</li>
|
303
303
|
</ul>
|
304
|
-
<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 interpreter'>Maruku</a> at
|
304
|
+
<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 interpreter for Ruby'>Maruku</a> at 23:18 on Monday, January 08th, 2007.</span></div></body></html>
|
data/lib/maruku.rb
CHANGED
data/lib/maruku/defaults.rb
CHANGED
data/lib/maruku/helpers.rb
CHANGED
@@ -32,7 +32,7 @@ module Helpers
|
|
32
32
|
|
33
33
|
def md_el(node_type, children=[], meta={}, al=nil)
|
34
34
|
e = MDElement.new(node_type, children, meta, al)
|
35
|
-
e.doc =
|
35
|
+
e.doc = @doc
|
36
36
|
return e
|
37
37
|
end
|
38
38
|
|
@@ -169,9 +169,9 @@ module Helpers
|
|
169
169
|
md_el(:ald, [], {:ald_id=>id,:ald=>al})
|
170
170
|
end
|
171
171
|
|
172
|
-
# Server directive <? code ?>
|
173
|
-
def
|
174
|
-
md_el(:
|
172
|
+
# Server directive <?target code... ?>
|
173
|
+
def md_xml_instr(target, code)
|
174
|
+
md_el(:xml_instr, [], {:target=>target, :code=>code})
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
@@ -43,39 +43,38 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|
43
43
|
when :empty;
|
44
44
|
src.ignore_line
|
45
45
|
when :ial
|
46
|
-
|
47
|
-
al =
|
48
|
-
|
49
|
-
|
50
|
-
output.last.al = al
|
46
|
+
m = /\s*\{([^\}]*)\}\s*/.match src.shift_line
|
47
|
+
al = read_attribute_list(CharSource.new(m[1]), context=nil, break_on=[nil])
|
48
|
+
if last = output.last
|
49
|
+
last.al = al
|
51
50
|
else
|
52
|
-
maruku_error "An attribute list at beginning of context {#{al.to_md}}"
|
53
|
-
|
51
|
+
maruku_error "An attribute list at beginning of context {#{al.to_md}}", src
|
52
|
+
maruku_recover "I will ignore this AL: {#{al.to_md}}", src
|
54
53
|
end
|
55
54
|
when :ald
|
56
|
-
output
|
55
|
+
output.push read_ald(src)
|
57
56
|
when :text
|
58
57
|
if src.cur_line =~ MightBeTableHeader and
|
59
58
|
(src.next_line && src.next_line =~ TableSeparator)
|
60
|
-
output
|
59
|
+
output.push read_table(src)
|
61
60
|
elsif [:header1,:header2].include? src.next_line.md_type
|
62
|
-
output
|
61
|
+
output.push read_header12(src)
|
63
62
|
elsif eventually_comes_a_def_list(src)
|
64
63
|
definition = read_definition(src)
|
65
64
|
if output.last && output.last.node_type == :definition_list
|
66
65
|
output.last.children << definition
|
67
66
|
else
|
68
|
-
output
|
67
|
+
output.push md_el(:definition_list, [definition])
|
69
68
|
end
|
70
69
|
else # Start of a paragraph
|
71
|
-
output
|
70
|
+
output.push read_paragraph(src)
|
72
71
|
end
|
73
72
|
when :header2, :hrule
|
74
73
|
# hrule
|
75
74
|
src.shift_line
|
76
|
-
output
|
75
|
+
output.push md_hrule()
|
77
76
|
when :header3
|
78
|
-
output
|
77
|
+
output.push read_header3(src)
|
79
78
|
when :ulist, :olist
|
80
79
|
list_type = src.cur_line.md_type == :ulist ? :ul : :ol
|
81
80
|
li = read_list_item(src)
|
@@ -83,37 +82,27 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|
83
82
|
if output.last && output.last.node_type == list_type
|
84
83
|
output.last.children << li
|
85
84
|
else
|
86
|
-
output
|
85
|
+
output.push md_el(list_type, [li])
|
87
86
|
end
|
88
|
-
when :quote; output
|
87
|
+
when :quote; output.push read_quote(src)
|
89
88
|
when :code; e = read_code(src); output << e if e
|
90
89
|
when :raw_html; e = read_raw_html(src); output << e if e
|
91
90
|
|
92
|
-
when :footnote_text; output
|
93
|
-
when :ref_definition; output
|
94
|
-
when :abbreviation; output
|
95
|
-
|
91
|
+
when :footnote_text; output.push read_footnote_text(src)
|
92
|
+
when :ref_definition; output.push read_ref_definition(src)
|
93
|
+
when :abbreviation; output.push read_abbreviation(src)
|
94
|
+
when :xml_instr; output.push read_xml_instruction(src)
|
96
95
|
# # these do not produce output
|
97
96
|
when :metadata;
|
98
97
|
maruku_error "Please use the new meta-data syntax: \n"+
|
99
98
|
" http://maruku.rubyforge.org/proposal.html\n", src
|
100
99
|
src.ignore_line
|
101
|
-
# warn if we forgot something
|
102
|
-
else
|
100
|
+
else # warn if we forgot something
|
103
101
|
md_type = src.cur_line.md_type
|
104
102
|
line = src.cur_line
|
105
103
|
maruku_error "Ignoring line '#{line}' type = #{md_type}", src
|
106
104
|
src.shift_line
|
107
105
|
end
|
108
|
-
|
109
|
-
# FIXME
|
110
|
-
# if current_metadata and output.last
|
111
|
-
# output.last.meta.merge! current_metadata
|
112
|
-
# current_metadata = nil
|
113
|
-
# puts "meta for #{output.last.node_type}\n #{output.last.meta.inspect}"
|
114
|
-
# end
|
115
|
-
# current_metadata = just_read_metadata
|
116
|
-
# just_read_metadata = nil
|
117
106
|
end
|
118
107
|
|
119
108
|
# See for each list if we can omit the paragraphs and use li_span
|
@@ -186,7 +175,24 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|
186
175
|
return md_header(level, text, al)
|
187
176
|
end
|
188
177
|
|
189
|
-
|
178
|
+
def read_xml_instruction(src)
|
179
|
+
m = /^\s*<\?((\w+)\s*)?(.*)$/.match src.shift_line
|
180
|
+
raise "BugBug" if not m
|
181
|
+
target = m[2] || ''
|
182
|
+
code = m[3]
|
183
|
+
until code =~ /\?>/
|
184
|
+
code += "\n"+src.shift_line
|
185
|
+
end
|
186
|
+
if not code =~ (/\?>\s*$/)
|
187
|
+
garbage = (/\?>(.*)$/.match(code))[1]
|
188
|
+
maruku_error "Trailing garbage on last line: #{garbage.inspect}:\n"+
|
189
|
+
add_tabs(code, 1, '|'), src
|
190
|
+
end
|
191
|
+
code.gsub!(/\?>\s*$/, '')
|
192
|
+
|
193
|
+
return md_xml_instr(target, code)
|
194
|
+
end
|
195
|
+
|
190
196
|
def read_raw_html(src)
|
191
197
|
h = HTMLHelper.new
|
192
198
|
begin
|
@@ -210,7 +216,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
|
210
216
|
while src.cur_line
|
211
217
|
# :olist does not break
|
212
218
|
case t = src.cur_line.md_type
|
213
|
-
when :quote,:header3,:empty,:raw_html,:ref_definition,:ial
|
219
|
+
when :quote,:header3,:empty,:raw_html,:ref_definition,:ial,:xml_instr
|
214
220
|
break
|
215
221
|
when :olist,:ulist
|
216
222
|
break if src.next_line.md_type == t
|