motion-kramdown 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +84 -0
- data/lib/kramdown/compatibility.rb +36 -0
- data/lib/kramdown/converter/base.rb +259 -0
- data/lib/kramdown/converter/html.rb +461 -0
- data/lib/kramdown/converter/kramdown.rb +423 -0
- data/lib/kramdown/converter/latex.rb +600 -0
- data/lib/kramdown/converter/math_engine/itex2mml.rb +39 -0
- data/lib/kramdown/converter/math_engine/mathjax.rb +33 -0
- data/lib/kramdown/converter/math_engine/ritex.rb +38 -0
- data/lib/kramdown/converter/pdf.rb +624 -0
- data/lib/kramdown/converter/remove_html_tags.rb +53 -0
- data/lib/kramdown/converter/syntax_highlighter/coderay.rb +78 -0
- data/lib/kramdown/converter/syntax_highlighter/rouge.rb +37 -0
- data/lib/kramdown/converter/toc.rb +69 -0
- data/lib/kramdown/converter.rb +69 -0
- data/lib/kramdown/document.rb +144 -0
- data/lib/kramdown/element.rb +515 -0
- data/lib/kramdown/error.rb +17 -0
- data/lib/kramdown/options.rb +584 -0
- data/lib/kramdown/parser/base.rb +130 -0
- data/lib/kramdown/parser/gfm.rb +55 -0
- data/lib/kramdown/parser/html.rb +575 -0
- data/lib/kramdown/parser/kramdown/abbreviation.rb +67 -0
- data/lib/kramdown/parser/kramdown/autolink.rb +37 -0
- data/lib/kramdown/parser/kramdown/blank_line.rb +30 -0
- data/lib/kramdown/parser/kramdown/block_boundary.rb +33 -0
- data/lib/kramdown/parser/kramdown/blockquote.rb +39 -0
- data/lib/kramdown/parser/kramdown/codeblock.rb +56 -0
- data/lib/kramdown/parser/kramdown/codespan.rb +44 -0
- data/lib/kramdown/parser/kramdown/emphasis.rb +61 -0
- data/lib/kramdown/parser/kramdown/eob.rb +26 -0
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +25 -0
- data/lib/kramdown/parser/kramdown/extensions.rb +201 -0
- data/lib/kramdown/parser/kramdown/footnote.rb +56 -0
- data/lib/kramdown/parser/kramdown/header.rb +59 -0
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +27 -0
- data/lib/kramdown/parser/kramdown/html.rb +160 -0
- data/lib/kramdown/parser/kramdown/html_entity.rb +33 -0
- data/lib/kramdown/parser/kramdown/line_break.rb +25 -0
- data/lib/kramdown/parser/kramdown/link.rb +139 -0
- data/lib/kramdown/parser/kramdown/list.rb +256 -0
- data/lib/kramdown/parser/kramdown/math.rb +54 -0
- data/lib/kramdown/parser/kramdown/paragraph.rb +54 -0
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +174 -0
- data/lib/kramdown/parser/kramdown/table.rb +171 -0
- data/lib/kramdown/parser/kramdown/typographic_symbol.rb +44 -0
- data/lib/kramdown/parser/kramdown.rb +359 -0
- data/lib/kramdown/parser/markdown.rb +56 -0
- data/lib/kramdown/parser.rb +27 -0
- data/lib/kramdown/utils/configurable.rb +44 -0
- data/lib/kramdown/utils/entities.rb +347 -0
- data/lib/kramdown/utils/html.rb +75 -0
- data/lib/kramdown/utils/ordered_hash.rb +87 -0
- data/lib/kramdown/utils/string_scanner.rb +74 -0
- data/lib/kramdown/utils/unidecoder.rb +51 -0
- data/lib/kramdown/utils.rb +58 -0
- data/lib/kramdown/version.rb +15 -0
- data/lib/kramdown.rb +10 -0
- data/lib/motion-kramdown.rb +47 -0
- data/lib/rubymotion/encodings.rb +37 -0
- data/lib/rubymotion/rexml_shim.rb +25 -0
- data/lib/rubymotion/set.rb +1349 -0
- data/lib/rubymotion/version.rb +6 -0
- data/spec/document_tree.rb +48 -0
- data/spec/gfm_to_html.rb +95 -0
- data/spec/helpers/it_behaves_like.rb +27 -0
- data/spec/helpers/option_file.rb +46 -0
- data/spec/helpers/spec_options.rb +37 -0
- data/spec/helpers/tidy.rb +12 -0
- data/spec/html_to_html.rb +40 -0
- data/spec/html_to_kramdown_to_html.rb +46 -0
- data/spec/kramdown_to_xxx.rb +40 -0
- data/spec/test_location.rb +203 -0
- data/spec/test_string_scanner_kramdown.rb +19 -0
- data/spec/text_to_kramdown_to_html.rb +52 -0
- data/spec/text_to_latex.rb +33 -0
- metadata +164 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
describe "text-to-kramdown-to-html conversion" do
|
2
|
+
|
3
|
+
`tidy -v 2>&1`
|
4
|
+
if $?.exitstatus != 0
|
5
|
+
warn("Skipping text->kramdown->html tests because tidy executable is missing")
|
6
|
+
else
|
7
|
+
EXCLUDE_TEXT_FILES = [
|
8
|
+
'test/testcases/span/05_html/markdown_attr.text', # bc of markdown attr
|
9
|
+
'test/testcases/block/09_html/markdown_attr.text', # bc of markdown attr
|
10
|
+
'test/testcases/span/extension/options.text', # bc of parse_span_html option
|
11
|
+
'test/testcases/block/12_extension/options.text', # bc of options option
|
12
|
+
'test/testcases/block/12_extension/options3.text', # bc of options option
|
13
|
+
'test/testcases/block/09_html/content_model/tables.text', # bc of parse_block_html option
|
14
|
+
'test/testcases/block/09_html/html_to_native/header.text', # bc of auto_ids option that interferes
|
15
|
+
'test/testcases/block/09_html/html_to_native/table_simple.text', # bc of tr style attr getting removed
|
16
|
+
'test/testcases/block/09_html/simple.text', # bc of webgen:block elements
|
17
|
+
'test/testcases/block/11_ial/simple.text', # bc of change of ordering of attributes in header
|
18
|
+
'test/testcases/span/extension/comment.text', # bc of comment text modifications (can this be avoided?)
|
19
|
+
'test/testcases/block/04_header/header_type_offset.text', # bc of header_offset being applied twice
|
20
|
+
('test/testcases/block/04_header/with_auto_ids.text' if RUBY_VERSION <= '1.8.6'), # bc of dep stringex not working
|
21
|
+
('test/testcases/span/03_codespan/highlighting-rouge.text' if RUBY_VERSION < '2.0'),
|
22
|
+
('test/testcases/block/06_codeblock/highlighting-rouge.text' if RUBY_VERSION < '2.0'), #bc of rouge
|
23
|
+
'test/testcases/block/15_math/ritex.text', # bc of tidy
|
24
|
+
'test/testcases/span/math/ritex.text', # bc of tidy
|
25
|
+
'test/testcases/block/15_math/itex2mml.text', # bc of tidy
|
26
|
+
'test/testcases/span/math/itex2mml.text', # bc of tidy
|
27
|
+
|
28
|
+
'test/testcases/block/04_header/with_auto_ids.text', # bc no transliteration support yet
|
29
|
+
'test/testcases/block/06_codeblock/highlighting-opts.text', # bc no highlight support yet
|
30
|
+
'test/testcases/block/06_codeblock/highlighting.text', # bc no highlight support yet
|
31
|
+
'test/testcases/block/15_math/gh_128.text', # bc no math support yet
|
32
|
+
'test/testcases/block/15_math/normal.text', # bc no math support yet
|
33
|
+
'test/testcases/span/03_codespan/highlighting.text', # bc no highlight support yet
|
34
|
+
'test/testcases/span/math/normal.text', # bc no math support yet
|
35
|
+
|
36
|
+
].compact
|
37
|
+
|
38
|
+
Dir["#{focus_files(testcase_dir)}.text"].each do |text_file|
|
39
|
+
next if EXCLUDE_TEXT_FILES.any? {|f| text_file =~ /#{f}$/}
|
40
|
+
html_file = text_file.sub(/\.text$/, '.html')
|
41
|
+
html_file += '.19' if RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')
|
42
|
+
opts_file = text_file.sub(/\.text$/, '.options')
|
43
|
+
|
44
|
+
it "#{short_name(text_file)} --> kramdown --> html" do
|
45
|
+
options = load_options(opts_file)
|
46
|
+
kdtext = Kramdown::Document.new(File.read(text_file), options).to_kramdown
|
47
|
+
html = Kramdown::Document.new(kdtext, options).to_html
|
48
|
+
expect(tidy_output(File.read(html_file))).to eq tidy_output(html)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#--- Latex conversion is currently not supported
|
2
|
+
|
3
|
+
# describe "text-to-latex conversion" do
|
4
|
+
#
|
5
|
+
# `latex -v 2>&1`
|
6
|
+
# if $?.exitstatus != 0
|
7
|
+
# warn("Skipping latex compilation tests because latex executable is missing")
|
8
|
+
# else
|
9
|
+
# EXCLUDE_LATEX_FILES = [
|
10
|
+
# 'test/testcases/span/01_link/image_in_a.text', # bc of image link
|
11
|
+
# 'test/testcases/span/01_link/imagelinks.text', # bc of image links
|
12
|
+
# 'test/testcases/span/04_footnote/markers.text', # bc of footnote in header
|
13
|
+
# ]
|
14
|
+
#
|
15
|
+
# Dir["#{focus_files(testcase_dir)}.text"].each do |text_file|
|
16
|
+
# next if EXCLUDE_LATEX_FILES.any? {|f| text_file =~ /#{f}$/}
|
17
|
+
#
|
18
|
+
# it "#{short_name(text_file)} --> latex compilation" do
|
19
|
+
# latex = Kramdown::Document.new(File.read(text_file),
|
20
|
+
# :auto_ids => false, :footnote_nr => 1,
|
21
|
+
# :template => 'document').to_latex
|
22
|
+
# Dir.mktmpdir do |tmpdir|
|
23
|
+
# result = IO.popen("latex -output-directory='#{tmpdir}' 2>/dev/null", 'r+') do |io|
|
24
|
+
# io.write(latex)
|
25
|
+
# io.close_write
|
26
|
+
# io.read
|
27
|
+
# end
|
28
|
+
# expect($?.exitstatus == 0).to eq result.scan(/^!(.*\n.*)/).join("\n")
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
# end
|
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion-kramdown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brett Walker
|
8
|
+
- Thomas Leitner
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: motion-strscan
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.5'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.5'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: motion-yaml
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.4'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.4'
|
42
|
+
description: A light modification of the kramdown Markdown gem, for use with RubyMotion
|
43
|
+
on iOS and OS X.
|
44
|
+
email:
|
45
|
+
- github@digitalmoksha.com
|
46
|
+
- t_leitner@gmx.at
|
47
|
+
executables: []
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- README.md
|
52
|
+
- lib/kramdown.rb
|
53
|
+
- lib/kramdown/compatibility.rb
|
54
|
+
- lib/kramdown/converter.rb
|
55
|
+
- lib/kramdown/converter/base.rb
|
56
|
+
- lib/kramdown/converter/html.rb
|
57
|
+
- lib/kramdown/converter/kramdown.rb
|
58
|
+
- lib/kramdown/converter/latex.rb
|
59
|
+
- lib/kramdown/converter/math_engine/itex2mml.rb
|
60
|
+
- lib/kramdown/converter/math_engine/mathjax.rb
|
61
|
+
- lib/kramdown/converter/math_engine/ritex.rb
|
62
|
+
- lib/kramdown/converter/pdf.rb
|
63
|
+
- lib/kramdown/converter/remove_html_tags.rb
|
64
|
+
- lib/kramdown/converter/syntax_highlighter/coderay.rb
|
65
|
+
- lib/kramdown/converter/syntax_highlighter/rouge.rb
|
66
|
+
- lib/kramdown/converter/toc.rb
|
67
|
+
- lib/kramdown/document.rb
|
68
|
+
- lib/kramdown/element.rb
|
69
|
+
- lib/kramdown/error.rb
|
70
|
+
- lib/kramdown/options.rb
|
71
|
+
- lib/kramdown/parser.rb
|
72
|
+
- lib/kramdown/parser/base.rb
|
73
|
+
- lib/kramdown/parser/gfm.rb
|
74
|
+
- lib/kramdown/parser/html.rb
|
75
|
+
- lib/kramdown/parser/kramdown.rb
|
76
|
+
- lib/kramdown/parser/kramdown/abbreviation.rb
|
77
|
+
- lib/kramdown/parser/kramdown/autolink.rb
|
78
|
+
- lib/kramdown/parser/kramdown/blank_line.rb
|
79
|
+
- lib/kramdown/parser/kramdown/block_boundary.rb
|
80
|
+
- lib/kramdown/parser/kramdown/blockquote.rb
|
81
|
+
- lib/kramdown/parser/kramdown/codeblock.rb
|
82
|
+
- lib/kramdown/parser/kramdown/codespan.rb
|
83
|
+
- lib/kramdown/parser/kramdown/emphasis.rb
|
84
|
+
- lib/kramdown/parser/kramdown/eob.rb
|
85
|
+
- lib/kramdown/parser/kramdown/escaped_chars.rb
|
86
|
+
- lib/kramdown/parser/kramdown/extensions.rb
|
87
|
+
- lib/kramdown/parser/kramdown/footnote.rb
|
88
|
+
- lib/kramdown/parser/kramdown/header.rb
|
89
|
+
- lib/kramdown/parser/kramdown/horizontal_rule.rb
|
90
|
+
- lib/kramdown/parser/kramdown/html.rb
|
91
|
+
- lib/kramdown/parser/kramdown/html_entity.rb
|
92
|
+
- lib/kramdown/parser/kramdown/line_break.rb
|
93
|
+
- lib/kramdown/parser/kramdown/link.rb
|
94
|
+
- lib/kramdown/parser/kramdown/list.rb
|
95
|
+
- lib/kramdown/parser/kramdown/math.rb
|
96
|
+
- lib/kramdown/parser/kramdown/paragraph.rb
|
97
|
+
- lib/kramdown/parser/kramdown/smart_quotes.rb
|
98
|
+
- lib/kramdown/parser/kramdown/table.rb
|
99
|
+
- lib/kramdown/parser/kramdown/typographic_symbol.rb
|
100
|
+
- lib/kramdown/parser/markdown.rb
|
101
|
+
- lib/kramdown/utils.rb
|
102
|
+
- lib/kramdown/utils/configurable.rb
|
103
|
+
- lib/kramdown/utils/entities.rb
|
104
|
+
- lib/kramdown/utils/html.rb
|
105
|
+
- lib/kramdown/utils/ordered_hash.rb
|
106
|
+
- lib/kramdown/utils/string_scanner.rb
|
107
|
+
- lib/kramdown/utils/unidecoder.rb
|
108
|
+
- lib/kramdown/version.rb
|
109
|
+
- lib/motion-kramdown.rb
|
110
|
+
- lib/rubymotion/encodings.rb
|
111
|
+
- lib/rubymotion/rexml_shim.rb
|
112
|
+
- lib/rubymotion/set.rb
|
113
|
+
- lib/rubymotion/version.rb
|
114
|
+
- spec/document_tree.rb
|
115
|
+
- spec/gfm_to_html.rb
|
116
|
+
- spec/helpers/it_behaves_like.rb
|
117
|
+
- spec/helpers/option_file.rb
|
118
|
+
- spec/helpers/spec_options.rb
|
119
|
+
- spec/helpers/tidy.rb
|
120
|
+
- spec/html_to_html.rb
|
121
|
+
- spec/html_to_kramdown_to_html.rb
|
122
|
+
- spec/kramdown_to_xxx.rb
|
123
|
+
- spec/test_location.rb
|
124
|
+
- spec/test_string_scanner_kramdown.rb
|
125
|
+
- spec/text_to_kramdown_to_html.rb
|
126
|
+
- spec/text_to_latex.rb
|
127
|
+
homepage: https://github.com/digitalmoksha/motion-kramdown
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.4.5
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: RubyMotion version of kramdown parser for Markdown
|
151
|
+
test_files:
|
152
|
+
- spec/document_tree.rb
|
153
|
+
- spec/gfm_to_html.rb
|
154
|
+
- spec/helpers/it_behaves_like.rb
|
155
|
+
- spec/helpers/option_file.rb
|
156
|
+
- spec/helpers/spec_options.rb
|
157
|
+
- spec/helpers/tidy.rb
|
158
|
+
- spec/html_to_html.rb
|
159
|
+
- spec/html_to_kramdown_to_html.rb
|
160
|
+
- spec/kramdown_to_xxx.rb
|
161
|
+
- spec/test_location.rb
|
162
|
+
- spec/test_string_scanner_kramdown.rb
|
163
|
+
- spec/text_to_kramdown_to_html.rb
|
164
|
+
- spec/text_to_latex.rb
|