maruku 0.4.2 → 0.4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/docs/a.html +6 -0
- data/docs/a.md +4 -0
- data/docs/changelog.html +159 -0
- data/docs/maruku.html +2 -2
- data/docs/maruku.md +2 -2
- data/lib/maruku/defaults.rb +18 -1
- data/lib/maruku/output/to_html.rb +4 -1
- data/lib/maruku/output/to_latex.rb +5 -2
- data/lib/maruku/version.rb +1 -1
- metadata +4 -1
data/docs/a.html
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version='1.0' encoding='utf-8'?>
|
2
|
+
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
3
|
+
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
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></title></head><body>
|
5
|
+
<p>Caio</p>
|
6
|
+
<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 20:25 on Thursday, January 11th, 2007.</span></div></body></html>
|
data/docs/a.md
ADDED
data/docs/changelog.html
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
<?xml version='1.0' encoding='utf-8'?>
|
2
|
+
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
3
|
+
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
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></title></head><body>
|
5
|
+
<h4 id='changes_in_041_aka_typographer'>Changes in 0.4.1 aka “Typographer”</h4>
|
6
|
+
|
7
|
+
<ul>
|
8
|
+
<li>
|
9
|
+
<p>Implemented SmartyPants support:</p>
|
10
|
+
<pre><code>'Twas a "test" to 'remember' -- in the '90s
|
11
|
+
--- while I was <<ok>>. She was 6\"12\'.</code></pre>
|
12
|
+
<blockquote>
|
13
|
+
<p>‘Twas a “test” to ‘remember’ – in the ’90s — while I was «ok». She was 6"12'.</p>
|
14
|
+
</blockquote>
|
15
|
+
|
16
|
+
<p>I adapted the code from RubyPants.</p>
|
17
|
+
</li>
|
18
|
+
|
19
|
+
<li>
|
20
|
+
<p>Server directives between <code><? ?></code> are properly preserved.</p>
|
21
|
+
</li>
|
22
|
+
|
23
|
+
<li>
|
24
|
+
<p>Changes in LaTeX export:</p>
|
25
|
+
|
26
|
+
<ul>
|
27
|
+
<li>
|
28
|
+
<p>Now Japanese text rendering sort of works, using the following packages:</p>
|
29
|
+
<pre><code>\usepackage[C40]{fontenc}
|
30
|
+
\usepackage[cjkjis]{ucs}
|
31
|
+
\usepackage[utf8x]{inputenc}
|
32
|
+
</code></pre>
|
33
|
+
<p>Nevertheless, I could only get bitmap fonts working – probably it’s a problem with my setup.</p>
|
34
|
+
|
35
|
+
<p>A quick test: 日本、中国、ひらがな、カタカナ。</p>
|
36
|
+
</li>
|
37
|
+
|
38
|
+
<li>
|
39
|
+
<p>Fixed bugs in rendering of immediate links.</p>
|
40
|
+
</li>
|
41
|
+
|
42
|
+
<li>
|
43
|
+
<p>External packages are <code>require</code>d only if needed.</p>
|
44
|
+
</li>
|
45
|
+
|
46
|
+
<li>
|
47
|
+
<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>
|
48
|
+
</li>
|
49
|
+
</ul>
|
50
|
+
</li>
|
51
|
+
</ul>
|
52
|
+
|
53
|
+
<h4 id='changes_in_04'>Changes in 0.4</h4>
|
54
|
+
|
55
|
+
<ul>
|
56
|
+
<li>First implementation of <a href='http://maruku.rubyforge.org/proposal.html'>the new meta-data syntax</a>.</li>
|
57
|
+
|
58
|
+
<li>General refactorization of the code and much cleaner error reporting.</li>
|
59
|
+
|
60
|
+
<li>Created <a href='http://maruku.rubyforge.org/rdoc/'>the RDOC documentation</a>.</li>
|
61
|
+
|
62
|
+
<li>The <code>add_whitespace</code> method took too much time – it was O(n^2).</li>
|
63
|
+
|
64
|
+
<li>Added unit-tests for block-level elements.</li>
|
65
|
+
</ul>
|
66
|
+
|
67
|
+
<h4 id='changes_in_03'>Changes in 0.3</h4>
|
68
|
+
|
69
|
+
<ul>
|
70
|
+
<li>
|
71
|
+
<p>A real parser is used instead of a regexp-based system, also for span-level elements.</p>
|
72
|
+
|
73
|
+
<p>Now Maruku is almost 2x faster than Bluecloth, while having more features.</p>
|
74
|
+
|
75
|
+
<p>Here are some benchmarks:</p>
|
76
|
+
<pre><code>BlueCloth (to_html): parsing 0.00 sec + rendering 1.54 sec = 1.55 sec
|
77
|
+
Maruku (to_html): parsing 0.47 sec + rendering 0.38 sec = 0.85 sec
|
78
|
+
Maruku (to_latex): parsing 0.49 sec + rendering 0.25 sec = 0.73 sec</code></pre>
|
79
|
+
<p>This is the result of running <code>lib/maruku/tests/benchmark.rb</code> on the Markdown specification.</p>
|
80
|
+
</li>
|
81
|
+
|
82
|
+
<li>
|
83
|
+
<p>Prettier HTML output by adding whitespace.</p>
|
84
|
+
</li>
|
85
|
+
|
86
|
+
<li>
|
87
|
+
<p>Added a full suite of unit-tests for the span-level parser.</p>
|
88
|
+
</li>
|
89
|
+
|
90
|
+
<li>
|
91
|
+
<p>Error management: Having a real parser, Maruku warns you about syntax issues.</p>
|
92
|
+
|
93
|
+
<p>The default action is to warn and try to continue. If you do this:</p>
|
94
|
+
<pre><code>Maruku.new(string, {:on_error => :raise})
|
95
|
+
</code></pre>
|
96
|
+
<p>then syntax errors will cause an exception to be raised (you can catch this and retry).</p>
|
97
|
+
</li>
|
98
|
+
|
99
|
+
<li>
|
100
|
+
<p>Fixed a series of bugs in handling inline HTML code.</p>
|
101
|
+
</li>
|
102
|
+
</ul>
|
103
|
+
|
104
|
+
<p>Immediate TODO-list:</p>
|
105
|
+
|
106
|
+
<ul>
|
107
|
+
<li>
|
108
|
+
<p>UTF-8 input/output works OK for HTML, however I am having pain trying to export to LaTeX. I want at least Japanese characters support, so if you know how to do this you are very welcome to give me an hand.</p>
|
109
|
+
|
110
|
+
<p>For example: in the HTML version, you should see accented characters in this parenthesis:</p>
|
111
|
+
|
112
|
+
<blockquote>
|
113
|
+
<p>(àèìòù)</p>
|
114
|
+
</blockquote>
|
115
|
+
|
116
|
+
<p>and Japanese text in these other parentheses:</p>
|
117
|
+
|
118
|
+
<blockquote>
|
119
|
+
<p>(カタカナで 私の 名前は アンドレア チェンシ です).</p>
|
120
|
+
|
121
|
+
<p>(日本のガルは 大好き、でも、日本語は難しですから、そうぞ 英語話すガルを おしえてください).</p>
|
122
|
+
</blockquote>
|
123
|
+
|
124
|
+
<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>
|
125
|
+
</li>
|
126
|
+
|
127
|
+
<li>
|
128
|
+
<p>Implement the <span>new meta-data proposal</span>.</p>
|
129
|
+
</li>
|
130
|
+
|
131
|
+
<li>
|
132
|
+
<p>Exporting to Markdown (pretty printing).</p>
|
133
|
+
</li>
|
134
|
+
|
135
|
+
<li>
|
136
|
+
<p>Exporting to HTML splitting in multiple files.</p>
|
137
|
+
</li>
|
138
|
+
|
139
|
+
<li>
|
140
|
+
<p>RubyPants.</p>
|
141
|
+
</li>
|
142
|
+
|
143
|
+
<li>
|
144
|
+
<p>Support for images in PDF.</p>
|
145
|
+
</li>
|
146
|
+
</ul>
|
147
|
+
|
148
|
+
<h4 id='changes_in_0213'>Changes in 0.2.13</h4>
|
149
|
+
|
150
|
+
<ul>
|
151
|
+
<li>better handling of inline HTML code.</li>
|
152
|
+
|
153
|
+
<li>Handle HTML comments.</li>
|
154
|
+
|
155
|
+
<li>Sanitizes HR and IMG tags if you don’t close them.</li>
|
156
|
+
|
157
|
+
<li>documentation included in HTML format</li>
|
158
|
+
</ul>
|
159
|
+
<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 20:19 on Thursday, January 11st, 2007.</span></div></body></html>
|
data/docs/maruku.html
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
<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>
|
52
52
|
|
53
|
-
<p><strong>The name of the game</strong>: Maruku is the <a href='http://en.wikipedia.org/wiki/Romaji'>romaji</a>
|
53
|
+
<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>
|
54
54
|
<hr />
|
55
55
|
<p>Table of contents: (<strong>auto-generated by Maruku!</strong>)</p>
|
56
56
|
<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 />
|
@@ -515,4 +515,4 @@ $ \alpha = \beta + \gamma $ (eq:1)
|
|
515
515
|
|
516
516
|
This is a reference to equation: please see (eq:1)</code></pre><div class='footnotes'><hr /><ol><li id='fn:1'>
|
517
517
|
<p>I really was missing those.</p>
|
518
|
-
<a href='#fnref:1' rev='footnote'>↩</a></li></ol></div
|
518
|
+
<a href='#fnref:1' rev='footnote'>↩</a></li></ol></div></body></html>
|
data/docs/maruku.md
CHANGED
@@ -45,8 +45,8 @@ Maruku implements:
|
|
45
45
|
__Authors__: Maruku has been developed so far by [Andrea Censi][].
|
46
46
|
Contributors are most welcome!
|
47
47
|
|
48
|
-
__The name of the game__: Maruku is the [romaji][]
|
49
|
-
the [katakana][]
|
48
|
+
__The name of the game__: Maruku is the [romaji][] transliteration of
|
49
|
+
the [katakana][] transliteration
|
50
50
|
of "Mark", the first word in Markdown. I chose this name because Ruby
|
51
51
|
is Japanese, and also the sillable "ru" appears in Maruku.
|
52
52
|
|
data/lib/maruku/defaults.rb
CHANGED
@@ -24,7 +24,9 @@ module MaRuKu
|
|
24
24
|
Globals = {
|
25
25
|
:unsafe_features => false,
|
26
26
|
|
27
|
-
:debug_keep_ials => false
|
27
|
+
:debug_keep_ials => false,
|
28
|
+
|
29
|
+
:maruku_signature => true
|
28
30
|
}
|
29
31
|
|
30
32
|
module Defaults
|
@@ -45,4 +47,19 @@ module Defaults
|
|
45
47
|
EOF
|
46
48
|
|
47
49
|
end
|
50
|
+
|
51
|
+
|
52
|
+
class MDElement
|
53
|
+
def get_boolean_setting(sym)
|
54
|
+
if self.doc.attributes.has_key?(sym) then
|
55
|
+
return !!self.doc.attributes[sym]
|
56
|
+
elsif Globals.has_key?(sym)
|
57
|
+
return !!Globals[sym]
|
58
|
+
else
|
59
|
+
puts "Bug: no default for #{sym.inspect}"
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
48
65
|
end
|
@@ -135,7 +135,9 @@ module MaRuKu; module Out; module HTML
|
|
135
135
|
|
136
136
|
# When we are rendering a whole document, we add a signature
|
137
137
|
# at the bottom.
|
138
|
-
|
138
|
+
if get_boolean_setting(:maruku_signature)
|
139
|
+
body << maruku_html_signature
|
140
|
+
end
|
139
141
|
|
140
142
|
root << body
|
141
143
|
|
@@ -162,6 +164,7 @@ module MaRuKu; module Out; module HTML
|
|
162
164
|
|
163
165
|
# returns "st","nd","rd" or "th" as appropriate
|
164
166
|
def day_suffix(day)
|
167
|
+
return 'th' if day == 11
|
165
168
|
case day%10
|
166
169
|
when 1; 'st'
|
167
170
|
when 2; 'nd'
|
@@ -42,12 +42,15 @@ class MDDocument
|
|
42
42
|
children_to_latex
|
43
43
|
end
|
44
44
|
|
45
|
+
|
45
46
|
# Render as a complete LaTeX document
|
46
47
|
def to_latex_document
|
47
48
|
body = to_latex
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
if get_boolean_setting(:maruku_signature)
|
51
|
+
body += render_latex_signature
|
52
|
+
end
|
53
|
+
|
51
54
|
required =
|
52
55
|
self.latex_required_packages.map {|p|
|
53
56
|
"\\usepackage{#{p}}\n"
|
data/lib/maruku/version.rb
CHANGED
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: maruku
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.2
|
6
|
+
version: 0.4.2.1
|
7
7
|
date: 2007-01-11
|
8
8
|
summary: A Markdown interpreter in Ruby
|
9
9
|
require_paths:
|
@@ -57,11 +57,14 @@ files:
|
|
57
57
|
- lib/maruku/tests/new_parser.rb
|
58
58
|
- lib/maruku/tests/tests.rb
|
59
59
|
- lib/maruku/usage/example1.rb
|
60
|
+
- docs/a.md
|
60
61
|
- docs/changelog.md
|
61
62
|
- docs/entity_test.md
|
62
63
|
- docs/markdown_syntax.md
|
63
64
|
- docs/maruku.md
|
64
65
|
- docs/proposal.md
|
66
|
+
- docs/a.html
|
67
|
+
- docs/changelog.html
|
65
68
|
- docs/char.html
|
66
69
|
- docs/entity_test.html
|
67
70
|
- docs/exd.html
|