motion-kramdown 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -7
- data/lib/kramdown.rb +1 -1
- data/lib/kramdown/compatibility.rb +1 -1
- data/lib/kramdown/converter.rb +1 -1
- data/lib/kramdown/converter/base.rb +2 -1
- data/lib/kramdown/converter/html.rb +10 -5
- data/lib/kramdown/converter/kramdown.rb +13 -7
- data/lib/kramdown/converter/latex.rb +2 -1
- data/lib/kramdown/converter/math_engine/itex2mml.rb +1 -1
- data/lib/kramdown/converter/math_engine/mathjax.rb +18 -3
- data/lib/kramdown/converter/math_engine/ritex.rb +1 -1
- data/lib/kramdown/converter/pdf.rb +3 -2
- data/lib/kramdown/converter/remove_html_tags.rb +3 -1
- data/lib/kramdown/converter/syntax_highlighter.rb +53 -0
- data/lib/kramdown/converter/syntax_highlighter/coderay.rb +1 -1
- data/lib/kramdown/converter/syntax_highlighter/rouge.rb +2 -2
- data/lib/kramdown/converter/toc.rb +2 -2
- data/lib/kramdown/document.rb +5 -5
- data/lib/kramdown/element.rb +4 -1
- data/lib/kramdown/error.rb +1 -1
- data/lib/kramdown/options.rb +4 -3
- data/lib/kramdown/parser.rb +1 -1
- data/lib/kramdown/parser/base.rb +8 -4
- data/lib/kramdown/parser/gfm.rb +9 -1
- data/lib/kramdown/parser/html.rb +18 -3
- data/lib/kramdown/parser/kramdown.rb +8 -5
- data/lib/kramdown/parser/kramdown/abbreviation.rb +10 -2
- data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
- data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
- data/lib/kramdown/parser/kramdown/block_boundary.rb +1 -1
- data/lib/kramdown/parser/kramdown/blockquote.rb +1 -1
- data/lib/kramdown/parser/kramdown/codeblock.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/eob.rb +1 -1
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
- data/lib/kramdown/parser/kramdown/extensions.rb +8 -7
- data/lib/kramdown/parser/kramdown/footnote.rb +12 -4
- data/lib/kramdown/parser/kramdown/header.rb +1 -1
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
- data/lib/kramdown/parser/kramdown/html.rb +7 -4
- data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
- data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
- data/lib/kramdown/parser/kramdown/link.rb +8 -5
- data/lib/kramdown/parser/kramdown/list.rb +17 -5
- data/lib/kramdown/parser/kramdown/math.rb +3 -3
- data/lib/kramdown/parser/kramdown/paragraph.rb +3 -3
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
- data/lib/kramdown/parser/kramdown/table.rb +1 -1
- data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
- data/lib/kramdown/parser/markdown.rb +2 -2
- data/lib/kramdown/utils.rb +1 -1
- data/lib/kramdown/utils/configurable.rb +1 -1
- data/lib/kramdown/utils/entities.rb +1 -1
- data/lib/kramdown/utils/html.rb +3 -1
- data/lib/kramdown/utils/ordered_hash.rb +1 -1
- data/lib/kramdown/utils/string_scanner.rb +8 -0
- data/lib/kramdown/utils/unidecoder.rb +1 -1
- data/lib/kramdown/version.rb +2 -2
- data/lib/rubymotion/version.rb +1 -1
- data/spec/bench_mark.rb +43 -30
- data/spec/document_tree.rb +12 -2
- data/spec/gfm_to_html.rb +4 -1
- data/spec/html_to_html.rb +27 -9
- data/spec/html_to_kramdown_to_html.rb +4 -1
- data/spec/kramdown_to_xxx.rb +3 -1
- data/spec/text_to_kramdown_to_html.rb +4 -0
- data/spec/text_to_latex.rb +1 -1
- metadata +5 -4
data/spec/document_tree.rb
CHANGED
@@ -1,14 +1,24 @@
|
|
1
1
|
describe "asserting that converters don't modify the document tree" do
|
2
2
|
|
3
|
+
EXCLUDE_PDF_MODIFY = ['test/testcases/span/text_substitutions/entities.text',
|
4
|
+
'test/testcases/span/text_substitutions/entities_numeric.text',
|
5
|
+
'test/testcases/span/text_substitutions/entities_as_char.text',
|
6
|
+
'test/testcases/span/text_substitutions/entities_as_input.text',
|
7
|
+
'test/testcases/span/text_substitutions/entities_symbolic.text',
|
8
|
+
'test/testcases/block/04_header/with_auto_ids.text',
|
9
|
+
].compact
|
10
|
+
|
3
11
|
EXCLUDE_TREE_FILES = [
|
4
12
|
'test/testcases/block/15_math/gh_128.text', # bc no math support yet
|
5
13
|
'test/testcases/block/15_math/itex2mml.text', # bc no math support yet
|
6
14
|
'test/testcases/block/15_math/normal.text', # bc no math support yet
|
7
15
|
'test/testcases/block/15_math/ritex.text', # bc no math support yet
|
16
|
+
'test/testcases/block/15_math/mathjax_preview.text', # bc no math support yet
|
17
|
+
'test/testcases/block/15_math/mathjax_preview_simple.text', # bc no math support yet
|
8
18
|
'test/testcases/span/math/normal.text', # bc no math support yet
|
9
19
|
'test/testcases/span/math/ritex.text', # bc no math support yet
|
10
20
|
'test/testcases/span/math/itex2mml.text', # bc no math support yet
|
11
|
-
]
|
21
|
+
].compact
|
12
22
|
|
13
23
|
Dir["#{focus_files(testcase_dir)}.text"].each do |text_file|
|
14
24
|
next if EXCLUDE_TREE_FILES.any? {|f| text_file =~ /#{f}$/}
|
@@ -16,7 +26,7 @@ describe "asserting that converters don't modify the document tree" do
|
|
16
26
|
options = load_options(opts_file)
|
17
27
|
|
18
28
|
(Kramdown::Converter.constants(true).map {|c| c.to_sym} - [:Latex, :Base, :RemoveHtmlTags, :MathEngine, :SyntaxHighlighter]).each do |conv_class|
|
19
|
-
next if conv_class == :Pdf && RUBY_VERSION < '
|
29
|
+
next if conv_class == :Pdf && (RUBY_VERSION < '2.0' || EXCLUDE_PDF_MODIFY.any? {|f| text_file =~ /#{f}$/})
|
20
30
|
|
21
31
|
it "#{short_name(text_file)} --> #{conv_class} modifies tree with file?" do
|
22
32
|
options = load_options(opts_file)
|
data/spec/gfm_to_html.rb
CHANGED
@@ -67,13 +67,15 @@ describe "gfm-to-html conversion" do
|
|
67
67
|
'test/testcases/block/15_math/itex2mml.text', # bc no math support yet
|
68
68
|
'test/testcases/block/15_math/normal.text', # bc no math support yet
|
69
69
|
'test/testcases/block/15_math/ritex.text', # bc no math support yet
|
70
|
+
'test/testcases/block/15_math/mathjax_preview.text', # bc no math support yet
|
71
|
+
'test/testcases/block/15_math/mathjax_preview_simple.text', # bc no math support yet
|
70
72
|
'test/testcases/span/math/itex2mml.text', # bc no math support yet
|
71
73
|
'test/testcases/span/math/normal.text', # bc no math support yet
|
72
74
|
'test/testcases/span/math/ritex.text', # bc no math support yet
|
73
75
|
'test/testcases/span/03_codespan/highlighting-rouge.text', # bc no highlight support yet
|
74
76
|
'test/testcases/span/03_codespan/highlighting.text', # bc no highlight support yet
|
75
77
|
'test/testcases_gfm/backticks_syntax.text', # bc no highlight support yet
|
76
|
-
]
|
78
|
+
].compact
|
77
79
|
|
78
80
|
['testcases', 'testcases_gfm'].each do |item|
|
79
81
|
Dir["#{focus_files(testcase_dir(item))}.text"].each do |text_file|
|
@@ -84,6 +86,7 @@ describe "gfm-to-html conversion" do
|
|
84
86
|
html_file = [(".html.19" if RUBY_VERSION >= '1.9'), ".html"].compact.
|
85
87
|
map {|ext| basename + ext }.
|
86
88
|
detect {|file| File.exist?(file) }
|
89
|
+
next unless html_file
|
87
90
|
|
88
91
|
it "gfm #{short_name(text_file)} --> html" do
|
89
92
|
options = load_options(opts_file)
|
data/spec/html_to_html.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
describe "html-to-html conversion" do
|
1
|
+
describe "html-to-{html,kramdown} conversion" do
|
2
2
|
|
3
3
|
`tidy -v 2>&1`
|
4
4
|
if $?.exitstatus != 0
|
5
|
-
warn("Skipping html-to-html tests because tidy executable is missing")
|
5
|
+
warn("Skipping html-to-{html,kramdown} tests because tidy executable is missing")
|
6
6
|
else
|
7
7
|
EXCLUDE_HTML_FILES = [
|
8
8
|
'test/testcases/block/06_codeblock/whitespace.html', # bc of span inside pre
|
@@ -16,23 +16,41 @@ describe "html-to-html conversion" do
|
|
16
16
|
'test/testcases/span/math/ritex.html', # bc of tidy
|
17
17
|
'test/testcases/block/15_math/itex2mml.html', # bc of tidy
|
18
18
|
'test/testcases/span/math/itex2mml.html', # bc of tidy
|
19
|
-
|
19
|
+
'test/testcases/block/15_math/mathjax_preview.html', # bc of mathjax preview
|
20
|
+
'test/testcases/block/15_math/mathjax_preview_simple.html', # bc of mathjax preview
|
21
|
+
|
20
22
|
'test/testcases/block/15_math/gh_128.html', # bc no math support yet
|
21
23
|
'test/testcases/block/15_math/normal.html', # bc no math support yet
|
22
24
|
'test/testcases/span/math/normal.html', # bc no math support yet
|
23
|
-
]
|
25
|
+
].compact
|
26
|
+
|
27
|
+
EXCLUDE_HTML_TEXT_FILES = ['test/testcases/block/09_html/parse_as_span.htmlinput',
|
28
|
+
'test/testcases/block/09_html/parse_as_raw.htmlinput',
|
29
|
+
].compact
|
24
30
|
|
25
31
|
Dir["#{focus_files(testcase_dir)}.{html,html.19,htmlinput,htmlinput.19}"].each do |html_file|
|
26
32
|
next if EXCLUDE_HTML_FILES.any? {|f| html_file =~ /#{f}(\.19)?$/}
|
27
33
|
next if skip_file_ruby_19?(html_file)
|
28
34
|
|
29
|
-
out_file = (html_file =~ /\.htmlinput(\.19)?$/ ? html_file.sub(/input(\.19)?$/, '') : html_file)
|
30
35
|
opts_file = html_file.sub(/\.html(input)?(\.19)?$/, '.options')
|
36
|
+
|
37
|
+
out_files = []
|
38
|
+
out_files << [(html_file =~ /\.htmlinput(\.19)?$/ ? html_file.sub(/input(\.19)?$/, '') : html_file), :to_html]
|
39
|
+
if html_file =~ /\.htmlinput(\.19)?$/ && !EXCLUDE_HTML_TEXT_FILES.any? {|f| html_file =~ /#{f}/}
|
40
|
+
out_files << [html_file.sub(/htmlinput(\.19)?$/, 'text'), :to_kramdown]
|
41
|
+
end
|
42
|
+
|
43
|
+
out_files.select {|f, _| File.exist?(f)}.each do |out_file, out_method|
|
31
44
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
45
|
+
it "#{short_name(html_file)} --> #{File.extname(out_file)}" do
|
46
|
+
options = load_options(opts_file)
|
47
|
+
doc = Kramdown::Document.new(File.read(html_file), options.merge(:input => 'html'))
|
48
|
+
if out_method == :to_html
|
49
|
+
expect(tidy_output(File.read(out_file))).to eq tidy_output(doc.send(out_method))
|
50
|
+
else
|
51
|
+
expect(File.read(out_file)).to eq doc.send(out_method)
|
52
|
+
end
|
53
|
+
end
|
36
54
|
end
|
37
55
|
end
|
38
56
|
end
|
@@ -24,11 +24,14 @@ describe "html-to-kramdown-to-html conversion" do
|
|
24
24
|
'test/testcases/span/math/ritex.html', # bc of tidy
|
25
25
|
'test/testcases/block/15_math/itex2mml.html', # bc of tidy
|
26
26
|
'test/testcases/span/math/itex2mml.html', # bc of tidy
|
27
|
+
'test/testcases/block/15_math/mathjax_preview.html', # bc of mathjax preview
|
28
|
+
'test/testcases/block/15_math/mathjax_preview_simple.html', # bc of mathjax preview
|
29
|
+
'test/testcases/span/01_link/link_defs_with_ial.html', # bc of attribute ordering
|
27
30
|
|
28
31
|
'testcases/block/15_math/gh_128.html', # bc no math support yet
|
29
32
|
'test/testcases/block/15_math/normal.html', # bc no math support yet
|
30
33
|
'test/testcases/span/math/normal.html', # bc no math support yet
|
31
|
-
]
|
34
|
+
].compact
|
32
35
|
|
33
36
|
Dir["#{focus_files(testcase_dir)}.{html,html.19}"].each do |html_file|
|
34
37
|
next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}(\.19)?$/}
|
data/spec/kramdown_to_xxx.rb
CHANGED
@@ -10,12 +10,14 @@ describe "kramdown-to-xxx conversion" do
|
|
10
10
|
'test/testcases/block/15_math/itex2mml.text', # bc no math support yet
|
11
11
|
'test/testcases/block/15_math/normal.text', # bc no math support yet
|
12
12
|
'test/testcases/block/15_math/ritex.text', # bc no math support yet
|
13
|
+
'test/testcases/block/15_math/mathjax_preview.text', # bc no math support yet
|
14
|
+
'test/testcases/block/15_math/mathjax_preview_simple.text', # bc no math support yet
|
13
15
|
'test/testcases/span/math/itex2mml.text', # bc no math support yet
|
14
16
|
'test/testcases/span/math/normal.text', # bc no math support yet
|
15
17
|
'test/testcases/span/math/ritex.text', # bc no math support yet
|
16
18
|
'test/testcases/span/03_codespan/highlighting-rouge.text', # bc no highlight support yet
|
17
19
|
'test/testcases/span/03_codespan/highlighting.text', # bc no highlight support yet
|
18
|
-
]
|
20
|
+
].compact
|
19
21
|
|
20
22
|
Dir["#{focus_files(testcase_dir)}.text"].each do |text_file|
|
21
23
|
next if EXCLUDE_FILES.any? {|f| text_file =~ /#{f}$/}
|
@@ -24,12 +24,15 @@ describe "text-to-kramdown-to-html conversion" do
|
|
24
24
|
'test/testcases/span/math/ritex.text', # bc of tidy
|
25
25
|
'test/testcases/block/15_math/itex2mml.text', # bc of tidy
|
26
26
|
'test/testcases/span/math/itex2mml.text', # bc of tidy
|
27
|
+
'test/testcases/span/01_link/link_defs_with_ial.text', # bc of attribute ordering
|
27
28
|
|
28
29
|
'test/testcases/block/04_header/with_auto_ids.text', # bc no transliteration support yet
|
29
30
|
'test/testcases/block/06_codeblock/highlighting-opts.text', # bc no highlight support yet
|
30
31
|
'test/testcases/block/06_codeblock/highlighting.text', # bc no highlight support yet
|
31
32
|
'test/testcases/block/15_math/gh_128.text', # bc no math support yet
|
32
33
|
'test/testcases/block/15_math/normal.text', # bc no math support yet
|
34
|
+
'test/testcases/block/15_math/mathjax_preview.text', # bc no math support yet
|
35
|
+
'test/testcases/block/15_math/mathjax_preview_simple.text', # bc no math support yet
|
33
36
|
'test/testcases/span/03_codespan/highlighting.text', # bc no highlight support yet
|
34
37
|
'test/testcases/span/math/normal.text', # bc no math support yet
|
35
38
|
|
@@ -39,6 +42,7 @@ describe "text-to-kramdown-to-html conversion" do
|
|
39
42
|
next if EXCLUDE_TEXT_FILES.any? {|f| text_file =~ /#{f}$/}
|
40
43
|
html_file = text_file.sub(/\.text$/, '.html')
|
41
44
|
html_file += '.19' if RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')
|
45
|
+
next unless File.exist?(html_file)
|
42
46
|
opts_file = text_file.sub(/\.text$/, '.options')
|
43
47
|
|
44
48
|
it "#{short_name(text_file)} --> kramdown --> html" do
|
data/spec/text_to_latex.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
# 'test/testcases/span/01_link/image_in_a.text', # bc of image link
|
11
11
|
# 'test/testcases/span/01_link/imagelinks.text', # bc of image links
|
12
12
|
# 'test/testcases/span/04_footnote/markers.text', # bc of footnote in header
|
13
|
-
# ]
|
13
|
+
# ].compact
|
14
14
|
#
|
15
15
|
# Dir["#{focus_files(testcase_dir)}.text"].each do |text_file|
|
16
16
|
# next if EXCLUDE_LATEX_FILES.any? {|f| text_file =~ /#{f}$/}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-kramdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Walker
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: motion-strscan
|
@@ -39,8 +39,8 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.4'
|
42
|
-
description:
|
43
|
-
|
42
|
+
description: The kramdown parser for Markdown, for use with RubyMotion on iOS and
|
43
|
+
OS X.
|
44
44
|
email:
|
45
45
|
- github@digitalmoksha.com
|
46
46
|
- t_leitner@gmx.at
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/kramdown/converter/math_engine/ritex.rb
|
62
62
|
- lib/kramdown/converter/pdf.rb
|
63
63
|
- lib/kramdown/converter/remove_html_tags.rb
|
64
|
+
- lib/kramdown/converter/syntax_highlighter.rb
|
64
65
|
- lib/kramdown/converter/syntax_highlighter/coderay.rb
|
65
66
|
- lib/kramdown/converter/syntax_highlighter/rouge.rb
|
66
67
|
- lib/kramdown/converter/toc.rb
|