kramdown 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kramdown might be problematic. Click here for more details.
- data/ChangeLog +276 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/benchmark/benchmark.rb +1 -1
- data/benchmark/historic-jruby-1.4.0.dat +7 -7
- data/benchmark/historic-ruby-1.8.6.dat +7 -7
- data/benchmark/historic-ruby-1.8.7.dat +7 -7
- data/benchmark/historic-ruby-1.9.1p243.dat +7 -7
- data/benchmark/historic-ruby-1.9.2dev.dat +7 -7
- data/bin/kramdown +46 -1
- data/doc/index.page +2 -2
- data/doc/syntax.page +7 -3
- data/lib/kramdown/converter.rb +6 -285
- data/lib/kramdown/converter/base.rb +75 -0
- data/lib/kramdown/converter/html.rb +325 -0
- data/lib/kramdown/converter/latex.rb +516 -0
- data/lib/kramdown/document.rb +36 -66
- data/lib/kramdown/options.rb +262 -0
- data/lib/kramdown/parser/kramdown.rb +36 -17
- data/lib/kramdown/parser/kramdown/attribute_list.rb +1 -1
- data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
- data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
- data/lib/kramdown/parser/kramdown/emphasis.rb +2 -2
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +2 -2
- data/lib/kramdown/parser/kramdown/extension.rb +46 -2
- data/lib/kramdown/parser/kramdown/footnote.rb +1 -1
- data/lib/kramdown/parser/kramdown/html.rb +2 -2
- data/lib/kramdown/parser/kramdown/html_entity.rb +4 -5
- data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
- data/lib/kramdown/parser/kramdown/link.rb +2 -2
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +213 -0
- data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
- data/lib/kramdown/version.rb +1 -1
- data/test/testcases/encoding.html +46 -0
- data/test/testcases/encoding.text +28 -0
- data/test/testcases/span/01_link/inline.html +1 -1
- data/test/testcases/span/01_link/reference.html +2 -2
- data/test/testcases/span/escaped_chars/normal.html +4 -0
- data/test/testcases/span/escaped_chars/normal.text +4 -0
- data/test/testcases/span/text_substitutions/entities.html +1 -1
- data/test/testcases/span/text_substitutions/typography.html +12 -0
- data/test/testcases/span/text_substitutions/typography.text +12 -0
- metadata +9 -3
- data/lib/kramdown/extension.rb +0 -98
@@ -0,0 +1,46 @@
|
|
1
|
+
<p>Das ist gewöhnlich <em>ein</em> <a href="http://example.org">Über-Problem</a> mit manchen<br />
|
2
|
+
Sälen <a href="http://example.org">http://example.org</a> und <span id="test">anderen Dinge</span>. Siehe
|
3
|
+
<img alt="Über mich" src="http://example.org" />!</p>
|
4
|
+
|
5
|
+
<blockquote class="test">
|
6
|
+
<p>Vielleicht <em class="red">höre</em> ich nicht richtig?</p>
|
7
|
+
</blockquote>
|
8
|
+
|
9
|
+
<ul>
|
10
|
+
<li>Sollten wir uns das überl<em>egen</em>? <em>Verhöhne</em> mich nicht!</li>
|
11
|
+
<li>Ho ho höher! Sind *wir* da?</li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<h1>Titel sind urschön</h1>
|
15
|
+
|
16
|
+
<h2 id="hot">Manche mögens <em>ärmer</em></h2>
|
17
|
+
|
18
|
+
<pre><code>öha
|
19
|
+
was nun?
|
20
|
+
</code></pre>
|
21
|
+
|
22
|
+
<dl>
|
23
|
+
<dt>Töne</dt>
|
24
|
+
<dd>Laute Geräusche</dd>
|
25
|
+
<dd>vielleicht noch was ä<em>hnliches</em></dd>
|
26
|
+
</dl>
|
27
|
+
|
28
|
+
<table>
|
29
|
+
<thead>
|
30
|
+
<tr>
|
31
|
+
<th>hoch</th>
|
32
|
+
<th>höher</th>
|
33
|
+
<th>am höchsten</th>
|
34
|
+
</tr>
|
35
|
+
</thead>
|
36
|
+
<tbody>
|
37
|
+
<tr>
|
38
|
+
<td>über</td>
|
39
|
+
<td>drüber</td>
|
40
|
+
<td>müde</td>
|
41
|
+
</tr>
|
42
|
+
</tbody>
|
43
|
+
</table>
|
44
|
+
|
45
|
+
<p>Das ist schön
|
46
|
+
gemacht</p>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Das ist gewöhnlich *ein* [Über-Problem](http://example.org) mit manchen
|
2
|
+
Sälen <http://example.org> und <span id='test'>anderen Dinge</span>. Siehe
|
3
|
+
![Über mich](http://example.org)!
|
4
|
+
|
5
|
+
> Vielleicht *höre*{:.red} ich nicht richtig?
|
6
|
+
{:.test}
|
7
|
+
|
8
|
+
* Sollten wir uns das überl*egen*? *Verhöhne* mich nicht!
|
9
|
+
* Ho ho höher! Sind \*wir\* da?
|
10
|
+
|
11
|
+
Titel sind urschön
|
12
|
+
==================
|
13
|
+
|
14
|
+
## Manche mögens *ärmer* {#hot}
|
15
|
+
|
16
|
+
öha
|
17
|
+
was nun?
|
18
|
+
|
19
|
+
Töne
|
20
|
+
: Laute Geräusche
|
21
|
+
: vielleicht noch was ä*hnliches*
|
22
|
+
|
23
|
+
| hoch | höher | am höchsten |
|
24
|
+
|----------------------------|
|
25
|
+
| über | drüber | müde |
|
26
|
+
|
27
|
+
<p markdown='1'>Das ist schön
|
28
|
+
gemacht</p>
|
@@ -24,9 +24,9 @@ the text</a></p>
|
|
24
24
|
[no url] invalid.html
|
25
25
|
[no url]:</p>
|
26
26
|
|
27
|
-
<p>&
|
27
|
+
<p>“title”</p>
|
28
28
|
|
29
29
|
<p>test <a href="invalid.html">url but no title</a>
|
30
30
|
test [urldef]</p>
|
31
31
|
|
32
|
-
<p>[urldef]: some.url
|
32
|
+
<p>[urldef]: some.url ‘title”</p>
|
@@ -1,3 +1,15 @@
|
|
1
1
|
<p>This is… something—this too–!</p>
|
2
2
|
|
3
3
|
<p>This «is» some text, « this » too!</p>
|
4
|
+
|
5
|
+
<p>“Fancy quotes” are ‘cool’, even in the ’80s!
|
6
|
+
Je t’ aime. You’re a funny one! Thomas’ name
|
7
|
+
Mark’s name. “…you”
|
8
|
+
“‘Nested’ quotes are ‘possible’”, too!
|
9
|
+
‘“Otherway” is “round”’!</p>
|
10
|
+
|
11
|
+
<p>‘Opening now!’</p>
|
12
|
+
|
13
|
+
<p>’80s are really cool.</p>
|
14
|
+
|
15
|
+
<p><i>Cluster</i>’s Last Stand.</p>
|
@@ -1,3 +1,15 @@
|
|
1
1
|
This is... something---this too--!
|
2
2
|
|
3
3
|
This <<is>> some text, << this >> too!
|
4
|
+
|
5
|
+
"Fancy quotes" are 'cool', even in the '80s!
|
6
|
+
Je t' aime. You're a funny one! Thomas' name
|
7
|
+
Mark's name. "...you"
|
8
|
+
"'Nested' quotes are 'possible'", too!
|
9
|
+
'"Otherway" is "round"'!
|
10
|
+
|
11
|
+
'Opening now!'
|
12
|
+
|
13
|
+
'80s are really cool.
|
14
|
+
|
15
|
+
<i>Cluster</i>'s Last Stand.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-15 00:00:00 +01:00
|
13
13
|
default_executable: kramdown
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -51,10 +51,13 @@ files:
|
|
51
51
|
- benchmark/testing.sh
|
52
52
|
- benchmark/timing.sh
|
53
53
|
- lib/kramdown/compatibility.rb
|
54
|
+
- lib/kramdown/converter/base.rb
|
55
|
+
- lib/kramdown/converter/html.rb
|
56
|
+
- lib/kramdown/converter/latex.rb
|
54
57
|
- lib/kramdown/converter.rb
|
55
58
|
- lib/kramdown/document.rb
|
56
59
|
- lib/kramdown/error.rb
|
57
|
-
- lib/kramdown/
|
60
|
+
- lib/kramdown/options.rb
|
58
61
|
- lib/kramdown/parser/kramdown/attribute_list.rb
|
59
62
|
- lib/kramdown/parser/kramdown/autolink.rb
|
60
63
|
- lib/kramdown/parser/kramdown/blank_line.rb
|
@@ -74,6 +77,7 @@ files:
|
|
74
77
|
- lib/kramdown/parser/kramdown/link.rb
|
75
78
|
- lib/kramdown/parser/kramdown/list.rb
|
76
79
|
- lib/kramdown/parser/kramdown/paragraph.rb
|
80
|
+
- lib/kramdown/parser/kramdown/smart_quotes.rb
|
77
81
|
- lib/kramdown/parser/kramdown/table.rb
|
78
82
|
- lib/kramdown/parser/kramdown/typographic_symbol.rb
|
79
83
|
- lib/kramdown/parser/kramdown.rb
|
@@ -256,6 +260,8 @@ files:
|
|
256
260
|
- test/testcases/block/14_table/no_table.text
|
257
261
|
- test/testcases/block/14_table/simple.html
|
258
262
|
- test/testcases/block/14_table/simple.text
|
263
|
+
- test/testcases/encoding.html
|
264
|
+
- test/testcases/encoding.text
|
259
265
|
- test/testcases/span/01_link/empty.html
|
260
266
|
- test/testcases/span/01_link/empty.text
|
261
267
|
- test/testcases/span/01_link/image_in_a.html
|
data/lib/kramdown/extension.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
#--
|
4
|
-
# Copyright (C) 2009 Thomas Leitner <t_leitner@gmx.at>
|
5
|
-
#
|
6
|
-
# This file is part of kramdown.
|
7
|
-
#
|
8
|
-
# kramdown is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
#
|
22
|
-
|
23
|
-
module Kramdown
|
24
|
-
|
25
|
-
# The base extension class.
|
26
|
-
#
|
27
|
-
# This class provides implementations for the default extensions defined in the kramdown
|
28
|
-
# specification.
|
29
|
-
#
|
30
|
-
# An extension is a method called <tt>parse_EXTNAME</tt> where +EXTNAME+ is the extension name.
|
31
|
-
# These methods are called with three parameters:
|
32
|
-
#
|
33
|
-
# [+parser+]
|
34
|
-
# The parser instance from which the extension method is called.
|
35
|
-
# [+opts+]
|
36
|
-
# A hash containing the options set in the extension.
|
37
|
-
# [+body+]
|
38
|
-
# A string containing the body of the extension. If no body is available, this is +nil+.
|
39
|
-
class Extension
|
40
|
-
|
41
|
-
# Just ignore everything and do nothing.
|
42
|
-
def parse_comment(parser, opts, body)
|
43
|
-
nil
|
44
|
-
end
|
45
|
-
|
46
|
-
# Add the body (if available) as <tt>:raw</tt> Element to the +parser.tree+.
|
47
|
-
def parse_nomarkdown(parser, opts, body)
|
48
|
-
parser.tree.children << Element.new(:raw, body) if body.kind_of?(String)
|
49
|
-
end
|
50
|
-
|
51
|
-
# Update the document options with the options set in +opts+.
|
52
|
-
def parse_options(parser, opts, body)
|
53
|
-
if val = opts.delete('auto_ids')
|
54
|
-
parser.doc.options[:auto_ids] = boolean_value(val)
|
55
|
-
end
|
56
|
-
if val = opts.delete('filter_html')
|
57
|
-
parser.doc.options[:filter_html] = val.split(/\s+/)
|
58
|
-
end
|
59
|
-
if val = opts.delete('footnote_nr')
|
60
|
-
parser.doc.options[:footnote_nr] = Integer(val) rescue parser.doc.options[:footnote_nr]
|
61
|
-
end
|
62
|
-
if val = opts.delete('parse_block_html')
|
63
|
-
parser.doc.options[:parse_block_html] = boolean_value(val)
|
64
|
-
end
|
65
|
-
if val = opts.delete('parse_span_html')
|
66
|
-
parser.doc.options[:parse_span_html] = boolean_value(val)
|
67
|
-
end
|
68
|
-
if val = opts.delete('coderay_wrap')
|
69
|
-
(parser.doc.options[:coderay] ||= {})[:wrap] = (val.empty? ? nil : val.to_sym)
|
70
|
-
end
|
71
|
-
if val = opts.delete('coderay_css')
|
72
|
-
(parser.doc.options[:coderay] ||= {})[:css] = val.to_sym
|
73
|
-
end
|
74
|
-
if val = opts.delete('coderay_tab_width')
|
75
|
-
(parser.doc.options[:coderay] ||= {})[:tab_width] = val.to_i
|
76
|
-
end
|
77
|
-
if val = opts.delete('coderay_line_numbers')
|
78
|
-
(parser.doc.options[:coderay] ||= {})[:line_numbers] = (val.empty? ? nil : val.to_sym)
|
79
|
-
end
|
80
|
-
if val = opts.delete('coderay_line_number_start')
|
81
|
-
(parser.doc.options[:coderay] ||= {})[:line_number_start] = val.to_i
|
82
|
-
end
|
83
|
-
if val = opts.delete('coderay_bold_every')
|
84
|
-
(parser.doc.options[:coderay] ||= {})[:bold_every] = val.to_i
|
85
|
-
end
|
86
|
-
|
87
|
-
opts.each {|k,v| parser.warning("Unknown kramdown options '#{k}'")}
|
88
|
-
end
|
89
|
-
|
90
|
-
def boolean_value(val)
|
91
|
-
val.downcase.strip != 'false' && !val.empty?
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
|