kramdown 0.1.0 → 0.2.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/COPYING +1 -1
- data/ChangeLog +423 -1
- data/Rakefile +5 -5
- data/VERSION +1 -1
- data/doc/default.template +4 -4
- data/doc/index.page +5 -4
- data/doc/news.feed +1 -1
- data/doc/quickref.page +72 -25
- data/doc/syntax.page +238 -66
- data/doc/tests.page +2 -3
- data/lib/kramdown/converter.rb +41 -10
- data/lib/kramdown/deprecated.rb +41 -0
- data/lib/kramdown/document.rb +17 -8
- data/lib/kramdown/extension.rb +13 -7
- data/lib/kramdown/parser.rb +263 -95
- data/lib/kramdown/version.rb +28 -0
- data/test/run_tests.rb +1 -1
- data/test/test_files.rb +1 -1
- data/test/testcases/block/02_eob/middle.html +1 -0
- data/test/testcases/block/04_header/atx_header.html +8 -0
- data/test/testcases/block/04_header/atx_header.text +8 -0
- data/test/testcases/block/04_header/setext_header.html +6 -0
- data/test/testcases/block/04_header/setext_header.text +9 -0
- data/test/testcases/block/07_horizontal_rule/sepspaces.html +3 -0
- data/test/testcases/block/07_horizontal_rule/sepspaces.text +3 -0
- data/test/testcases/block/07_horizontal_rule/septabs.html +3 -0
- data/test/testcases/block/07_horizontal_rule/septabs.text +3 -0
- data/test/testcases/block/09_html/content_model/deflists.html +6 -0
- data/test/testcases/block/09_html/content_model/deflists.options +1 -0
- data/test/testcases/block/09_html/content_model/deflists.text +6 -0
- data/test/testcases/block/09_html/content_model/tables.html +14 -0
- data/test/testcases/block/09_html/content_model/tables.options +1 -0
- data/test/testcases/block/09_html/content_model/tables.text +14 -0
- data/test/testcases/block/09_html/html_and_codeblocks.options +1 -1
- data/test/testcases/block/09_html/invalid_html_1.html +0 -2
- data/test/testcases/block/09_html/invalid_html_2.html +2 -3
- data/test/testcases/block/09_html/markdown_attr.html +38 -0
- data/test/testcases/block/09_html/markdown_attr.text +38 -0
- data/test/testcases/block/09_html/not_parsed.html +14 -0
- data/test/testcases/block/09_html/not_parsed.text +15 -0
- data/test/testcases/block/09_html/parse_as_raw.html +16 -14
- data/test/testcases/block/09_html/parse_as_raw.options +1 -0
- data/test/testcases/block/09_html/parse_as_raw.text +13 -1
- data/test/testcases/block/09_html/parse_as_span.html +2 -5
- data/test/testcases/block/09_html/parse_as_span.options +1 -0
- data/test/testcases/block/09_html/{auto_parse_block_html.html → parse_block_html.html} +0 -0
- data/test/testcases/block/09_html/parse_block_html.options +1 -0
- data/test/testcases/block/09_html/{auto_parse_block_html.text → parse_block_html.text} +0 -0
- data/test/testcases/block/09_html/simple.html +21 -30
- data/test/testcases/block/09_html/simple.options +1 -0
- data/test/testcases/block/09_html/simple.text +13 -2
- data/test/testcases/block/11_ial/auto_id_and_ial.html +1 -0
- data/test/testcases/block/11_ial/auto_id_and_ial.options +1 -0
- data/test/testcases/block/11_ial/auto_id_and_ial.text +2 -0
- data/test/testcases/block/12_extension/{nokramdown.html → nomarkdown.html} +0 -0
- data/test/testcases/block/12_extension/{nokramdown.text → nomarkdown.text} +4 -4
- data/test/testcases/block/12_extension/{kdoptions.html → options.html} +9 -0
- data/test/testcases/block/12_extension/options.text +28 -0
- data/test/testcases/block/12_extension/{kdoptions2.html → options2.html} +0 -0
- data/test/testcases/block/12_extension/{kdoptions2.text → options2.text} +1 -1
- data/test/testcases/block/13_definition_list/definition_at_beginning.html +1 -0
- data/test/testcases/block/13_definition_list/definition_at_beginning.text +1 -0
- data/test/testcases/block/13_definition_list/multiple_terms.html +13 -0
- data/test/testcases/block/13_definition_list/multiple_terms.text +10 -0
- data/test/testcases/block/13_definition_list/para_wrapping.html +10 -0
- data/test/testcases/block/13_definition_list/para_wrapping.text +6 -0
- data/test/testcases/block/13_definition_list/separated_by_eob.html +8 -0
- data/test/testcases/block/13_definition_list/separated_by_eob.text +5 -0
- data/test/testcases/block/13_definition_list/simple.html +8 -0
- data/test/testcases/block/13_definition_list/simple.text +7 -0
- data/test/testcases/block/13_definition_list/styled_terms.html +4 -0
- data/test/testcases/block/13_definition_list/styled_terms.text +2 -0
- data/test/testcases/block/13_definition_list/too_much_space.html +3 -0
- data/test/testcases/block/13_definition_list/too_much_space.text +4 -0
- data/test/testcases/block/13_definition_list/with_blocks.html +38 -0
- data/test/testcases/block/13_definition_list/with_blocks.text +24 -0
- data/test/testcases/span/05_html/across_lines.html +1 -0
- data/test/testcases/span/05_html/across_lines.text +2 -0
- data/test/testcases/span/05_html/link_with_mailto.html +1 -0
- data/test/testcases/span/05_html/link_with_mailto.text +1 -0
- data/test/testcases/span/05_html/markdown_attr.html +5 -0
- data/test/testcases/span/05_html/markdown_attr.text +5 -0
- data/test/testcases/span/05_html/normal.html +7 -0
- data/test/testcases/span/05_html/normal.text +7 -0
- metadata +56 -12
- data/test/testcases/block/09_html/auto_parse_block_html.options +0 -1
- data/test/testcases/block/12_extension/kdoptions.text +0 -18
@@ -0,0 +1,28 @@
|
|
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 kramdown version.
|
26
|
+
VERSION = '0.2.0'
|
27
|
+
|
28
|
+
end
|
data/test/run_tests.rb
CHANGED
@@ -44,7 +44,7 @@ Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].max }.each do |file|
|
|
44
44
|
|
45
45
|
html_file = file.sub('.text', '.html')
|
46
46
|
opts_file = file.sub('.text', '.options')
|
47
|
-
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {}
|
47
|
+
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :filter_html => [], :footnote_nr => 1}
|
48
48
|
doc = Kramdown::Document.new(File.read(file), options)
|
49
49
|
begin
|
50
50
|
assert_equal(File.read(html_file), doc.to_html)
|
data/test/test_files.rb
CHANGED
@@ -30,7 +30,7 @@ class TestFiles < Test::Unit::TestCase
|
|
30
30
|
define_method('test_' + file.tr('.', '_')) do
|
31
31
|
html_file = file.sub('.text', '.html')
|
32
32
|
opts_file = file.sub('.text', '.options')
|
33
|
-
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {}
|
33
|
+
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :filter_html => [], :footnote_nr => 1}
|
34
34
|
doc = Kramdown::Document.new(File.read(file), options)
|
35
35
|
assert_equal(File.read(html_file), doc.to_html, "Failed test #{file}")
|
36
36
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
:parse_block_html: true
|
@@ -0,0 +1 @@
|
|
1
|
+
:parse_block_html: true
|
@@ -1 +1 @@
|
|
1
|
-
:
|
1
|
+
:parse_block_html: true
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div>
|
2
|
+
<p><em>para</em></p>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div>
|
6
|
+
<em>para</em>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div>
|
10
|
+
<p><em>para</em></p>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div>
|
14
|
+
*para*
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<p>
|
18
|
+
<p><em>para</em></p>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<em>para</em>
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
<em>para</em>
|
27
|
+
</p>
|
28
|
+
|
29
|
+
<p>
|
30
|
+
*para*
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<dl>
|
34
|
+
<dt><em>emphasize</em></dt>
|
35
|
+
<dd>
|
36
|
+
<p>para</p>
|
37
|
+
</dd>
|
38
|
+
</dl>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div markdown="block">
|
2
|
+
*para*
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div markdown="span">
|
6
|
+
*para*
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div markdown="1">
|
10
|
+
*para*
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div markdown="0">
|
14
|
+
*para*
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<p markdown="block">
|
18
|
+
*para*
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p markdown="span">
|
22
|
+
*para*
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p markdown="1">
|
26
|
+
*para*
|
27
|
+
</p>
|
28
|
+
|
29
|
+
<p markdown="0">
|
30
|
+
*para*
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<dl>
|
34
|
+
<dt markdown="1">*emphasize*</dt>
|
35
|
+
<dd markdown="1">
|
36
|
+
para
|
37
|
+
</dd>
|
38
|
+
</dl>
|
@@ -1,26 +1,28 @@
|
|
1
1
|
<p>This is some para.</p>
|
2
2
|
<script type="javascript">
|
3
3
|
This *text* must not be converted.
|
4
|
-
</script>
|
4
|
+
</script>
|
5
5
|
|
6
|
-
<script>
|
7
|
-
Not *parsed* here
|
8
|
-
</script>
|
6
|
+
<script>Not *parsed* here</script>
|
9
7
|
|
10
|
-
<script>
|
11
|
-
|
12
|
-
</script>
|
13
|
-
<p>
|
14
|
-
<em>parsed</em>
|
8
|
+
<script>*not*</script>
|
9
|
+
<p><em>parsed</em>
|
15
10
|
This too
|
16
11
|
</p>
|
17
12
|
|
18
|
-
<script
|
19
|
-
*not*<p>*parsed*
|
13
|
+
<script>*not*<p>*parsed*
|
20
14
|
This too
|
21
|
-
</p>
|
22
|
-
|
15
|
+
</p></script>
|
16
|
+
|
17
|
+
<script>something<p>*not*</p></script>
|
23
18
|
|
19
|
+
<script></script>
|
20
|
+
|
21
|
+
<script>
|
22
|
+
This should be output
|
23
|
+
<p> *as* is
|
24
|
+
</p> and nothing should be done
|
25
|
+
about it
|
24
26
|
<script>
|
25
|
-
|
27
|
+
</script>
|
26
28
|
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
:parse_block_html: true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
This is some para.
|
2
2
|
<script type="javascript">
|
3
3
|
This *text* must not be converted.
|
4
|
-
</script>
|
4
|
+
</script>
|
5
5
|
|
6
6
|
<script>Not *parsed* here</script>
|
7
7
|
|
@@ -14,3 +14,15 @@ This too
|
|
14
14
|
</p></script>
|
15
15
|
|
16
16
|
<script>something<p>*not*</p></script>
|
17
|
+
|
18
|
+
<script></script>
|
19
|
+
|
20
|
+
<script>
|
21
|
+
This should be output
|
22
|
+
<p> *as* is
|
23
|
+
</p> and nothing should be done
|
24
|
+
about it
|
25
|
+
<script>
|
26
|
+
</not>
|
27
|
+
</p>
|
28
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
:parse_block_html: true
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
:parse_block_html: true
|
File without changes
|
@@ -7,14 +7,11 @@ para2
|
|
7
7
|
</p>
|
8
8
|
|
9
9
|
<div id="test">
|
10
|
-
<p>
|
11
|
-
tes
|
12
|
-
</p>
|
10
|
+
<p>tes</p>
|
13
11
|
|
14
|
-
<p>
|
15
|
-
test
|
12
|
+
<p>test
|
16
13
|
weiter
|
17
|
-
|
14
|
+
</p>
|
18
15
|
</div>
|
19
16
|
|
20
17
|
<p>para4</p>
|
@@ -26,37 +23,25 @@ weiter
|
|
26
23
|
</div>
|
27
24
|
<div style=" "></div>
|
28
25
|
</div>
|
29
|
-
<div>
|
30
|
-
bar
|
31
|
-
</div>
|
26
|
+
<div>bar </div>
|
32
27
|
</div>
|
33
28
|
|
34
29
|
<p>para5</p>
|
35
30
|
|
36
|
-
<div>
|
37
|
-
id
|
38
|
-
</div>
|
31
|
+
<div>id</div>
|
39
32
|
|
40
|
-
<div>
|
41
|
-
id
|
33
|
+
<div>id
|
42
34
|
</div>
|
35
|
+
test
|
43
36
|
|
44
|
-
<div>
|
45
|
-
hallo</p>
|
46
|
-
<div>
|
47
|
-
test
|
48
|
-
</div>
|
37
|
+
<div>hallo<div>test</div>
|
49
38
|
<p>hallo</p>
|
50
39
|
</div>
|
51
40
|
|
52
|
-
<div>
|
53
|
-
hallo
|
54
|
-
<div>
|
55
|
-
test
|
41
|
+
<div>hallo<div>test
|
42
|
+
<p>hallo</p>
|
56
43
|
</div>
|
57
|
-
<p>hallo</p>
|
58
44
|
</div>
|
59
|
-
</p>
|
60
45
|
|
61
46
|
<div>
|
62
47
|
<p>hallo</p>
|
@@ -65,14 +50,20 @@ test
|
|
65
50
|
<p>hallo</p>
|
66
51
|
</div>
|
67
52
|
|
53
|
+
<p>para6</p>
|
54
|
+
|
55
|
+
<div><div class="clear"></div>
|
56
|
+
<p>Another para.</p>
|
57
|
+
</div>
|
58
|
+
|
68
59
|
<webgen:block name="test" />
|
69
60
|
|
70
|
-
<some:url name:spac="hallo">
|
71
|
-
doit
|
72
|
-
</some:url>
|
61
|
+
<some:url name:spac="hallo">doit</some:url>
|
73
62
|
|
74
63
|
<p><em>Test</em></p>
|
75
64
|
|
76
|
-
<p>
|
77
|
-
|
65
|
+
<p><em>Test</em></p>
|
66
|
+
|
67
|
+
<p><em>Test
|
68
|
+
</em>
|
78
69
|
</p>
|