kramdown 0.14.0 → 0.14.1
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/CONTRIBUTERS +1 -1
- data/ChangeLog +60 -0
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/doc/quickref.page +1 -0
- data/doc/sidebar.template +2 -2
- data/lib/kramdown/converter/html.rb +9 -9
- data/lib/kramdown/converter/kramdown.rb +6 -5
- data/lib/kramdown/parser/html.rb +8 -7
- data/lib/kramdown/parser/kramdown/html.rb +5 -3
- data/lib/kramdown/parser/kramdown/list.rb +3 -1
- data/lib/kramdown/version.rb +1 -1
- data/test/testcases/block/13_definition_list/deflist_ial.html +4 -0
- data/test/testcases/block/13_definition_list/deflist_ial.text +4 -0
- data/test/testcases/block/13_definition_list/simple.html +2 -0
- data/test/testcases/block/13_definition_list/simple.text +3 -0
- metadata +4 -2
data/CONTRIBUTERS
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,63 @@
|
|
1
|
+
commit 5971fc408de5137b38f1ebe95f47f3f6573a86ed
|
2
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
3
|
+
Date: Fri Nov 30 18:41:57 2012 +0100
|
4
|
+
|
5
|
+
Updated release notes and version
|
6
|
+
|
7
|
+
doc/news/release_0_14_1.page
|
8
|
+
doc/sidebar.template
|
9
|
+
lib/kramdown/version.rb
|
10
|
+
|
11
|
+
commit d3c2777b40f29c27de3ea82dccdbd7484ecd3653
|
12
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
13
|
+
Date: Fri Nov 30 18:21:35 2012 +0100
|
14
|
+
|
15
|
+
Fixed GH#30: Specifying empty definitions for a definition list now works
|
16
|
+
|
17
|
+
lib/kramdown/converter/kramdown.rb
|
18
|
+
lib/kramdown/parser/kramdown/list.rb
|
19
|
+
test/testcases/block/13_definition_list/simple.html
|
20
|
+
test/testcases/block/13_definition_list/simple.text
|
21
|
+
|
22
|
+
commit e7e74ad14bfb9036aa0cc771179cdec8d0315c82
|
23
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
24
|
+
Date: Thu Nov 29 20:32:10 2012 +0100
|
25
|
+
|
26
|
+
Better fix for the output of closed/open elements
|
27
|
+
|
28
|
+
Using the already defined tags for HTML elements without a body
|
29
|
+
and better output for unknown elements.
|
30
|
+
|
31
|
+
lib/kramdown/converter/html.rb
|
32
|
+
lib/kramdown/parser/html.rb
|
33
|
+
lib/kramdown/parser/kramdown/html.rb
|
34
|
+
|
35
|
+
commit 12a9060cd06bb40ea3f73edae1c7397d3e2d1320
|
36
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
37
|
+
Date: Sun Nov 18 20:42:54 2012 +0100
|
38
|
+
|
39
|
+
Fixed: Using a block IAL before a definition list now works
|
40
|
+
|
41
|
+
lib/kramdown/parser/kramdown/list.rb
|
42
|
+
test/testcases/block/13_definition_list/deflist_ial.html
|
43
|
+
test/testcases/block/13_definition_list/deflist_ial.text
|
44
|
+
|
45
|
+
commit 3912de9a399e234c163d792ed84f657ed549d06e
|
46
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
47
|
+
Date: Sun Nov 18 13:04:08 2012 +0100
|
48
|
+
|
49
|
+
Fixed problem with the output of empty i/b HTML tags
|
50
|
+
|
51
|
+
lib/kramdown/converter/html.rb
|
52
|
+
|
53
|
+
commit a03c57bb25cc3d97f6c14df4c48d1f6be4b49130
|
54
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
55
|
+
Date: Sun Oct 28 06:58:49 2012 +0100
|
56
|
+
|
57
|
+
Docu fix
|
58
|
+
|
59
|
+
doc/quickref.page
|
60
|
+
|
1
61
|
commit a29151de6a88eefbd0a181331ebae298ee441d27
|
2
62
|
Author: Thomas Leitner <t_leitner@gmx.at>
|
3
63
|
Date: Sun Sep 16 07:58:38 2012 +0200
|
data/Rakefile
CHANGED
@@ -95,6 +95,8 @@ if defined? Webgen
|
|
95
95
|
config['contentprocessor.tags.map']['kdexample'] = 'KDExample'
|
96
96
|
config['contentprocessor.tags.map']['kdlink'] = 'KDLink'
|
97
97
|
config['contentprocessor.kramdown.options'][:coderay_line_numbers] = nil
|
98
|
+
require 'syck'
|
99
|
+
YAML::ENGINE.yamler = 'syck'
|
98
100
|
end
|
99
101
|
end
|
100
102
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.1
|
data/doc/quickref.page
CHANGED
data/doc/sidebar.template
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<h2>News</h2>
|
2
2
|
|
3
|
-
<p>The latest version of kramdown is <b>0.14.
|
4
|
-
on <b>2012-
|
3
|
+
<p>The latest version of kramdown is <b>0.14.1</b> and it was released
|
4
|
+
on <b>2012-11-30</b>.</p>
|
5
5
|
|
6
6
|
<p>More <a href="{relocatable: news.html}">news</a>…</p>
|
7
7
|
|
@@ -21,6 +21,7 @@
|
|
21
21
|
#
|
22
22
|
|
23
23
|
require 'rexml/parsers/baseparser'
|
24
|
+
require 'kramdown/parser/html'
|
24
25
|
|
25
26
|
module Kramdown
|
26
27
|
|
@@ -50,7 +51,7 @@ module Kramdown
|
|
50
51
|
end
|
51
52
|
|
52
53
|
include ::Kramdown::Utils::Html
|
53
|
-
|
54
|
+
include ::Kramdown::Parser::Html::Constants
|
54
55
|
|
55
56
|
# The amount of indentation used when nesting HTML tags.
|
56
57
|
attr_accessor :indent
|
@@ -183,25 +184,24 @@ module Kramdown
|
|
183
184
|
"#{' '*indent}<dt#{html_attributes(el.attr)}>#{inner(el, indent)}</dt>\n"
|
184
185
|
end
|
185
186
|
|
186
|
-
# A list of all HTML tags that need to have a body (even if the body is empty).
|
187
|
-
HTML_TAGS_WITH_BODY=['div', 'span', 'script', 'iframe', 'textarea', 'a'] # :nodoc:
|
188
|
-
|
189
187
|
def convert_html_element(el, indent)
|
190
188
|
res = inner(el, indent)
|
191
189
|
if el.options[:category] == :span
|
192
|
-
"<#{el.value}#{html_attributes(el.attr)}" << (
|
190
|
+
"<#{el.value}#{html_attributes(el.attr)}" << (res.empty? && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value) ? " />" : ">#{res}</#{el.value}>")
|
193
191
|
else
|
194
192
|
output = ''
|
195
193
|
output << ' '*indent if @stack.last.type != :html_element || @stack.last.options[:content_model] != :raw
|
196
194
|
output << "<#{el.value}#{html_attributes(el.attr)}"
|
197
|
-
if
|
195
|
+
if el.options[:is_closed] && el.options[:content_model] == :raw
|
196
|
+
output << " />"
|
197
|
+
elsif !res.empty? && el.options[:content_model] != :block
|
198
198
|
output << ">#{res}</#{el.value}>"
|
199
199
|
elsif !res.empty?
|
200
200
|
output << ">\n#{res.chomp}\n" << ' '*indent << "</#{el.value}>"
|
201
|
-
elsif
|
202
|
-
output << "></#{el.value}>"
|
203
|
-
else
|
201
|
+
elsif HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
|
204
202
|
output << " />"
|
203
|
+
else
|
204
|
+
output << "></#{el.value}>"
|
205
205
|
end
|
206
206
|
output << "\n" if @stack.last.type != :html_element || @stack.last.options[:content_model] != :raw
|
207
207
|
output
|
@@ -161,7 +161,7 @@ module Kramdown
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def convert_dd(el, opts)
|
164
|
-
sym, width = ": ", (el.children.first.type == :codeblock ? 4 : 2)
|
164
|
+
sym, width = ": ", (el.children.first && el.children.first.type == :codeblock ? 4 : 2)
|
165
165
|
if ial = ial_for_element(el)
|
166
166
|
sym << ial << " "
|
167
167
|
end
|
@@ -171,12 +171,13 @@ module Kramdown
|
|
171
171
|
newlines = text.scan(/\n*\Z/).first
|
172
172
|
first, *last = text.split(/\n/)
|
173
173
|
last = last.map {|l| " "*width + l}.join("\n")
|
174
|
-
text = first + (last.empty? ? "" : "\n") + last + newlines
|
174
|
+
text = first.to_s + (last.empty? ? "" : "\n") + last + newlines
|
175
175
|
text.chomp! if text =~ /\n\n\Z/ && opts[:next] && opts[:next].type == :dd
|
176
|
-
text << "\n" if text !~ /\n\n\Z/ && opts[:next] && opts[:next].type == :dt
|
177
|
-
|
176
|
+
text << "\n" if (text !~ /\n\n\Z/ && opts[:next] && opts[:next].type == :dt)
|
177
|
+
text << "\n" if el.children.empty?
|
178
|
+
if el.children.first && el.children.first.type == :p && !el.children.first.options[:transparent]
|
178
179
|
"\n#{sym}#{text}"
|
179
|
-
elsif el.children.first.type == :codeblock
|
180
|
+
elsif el.children.first && el.children.first.type == :codeblock
|
180
181
|
"#{sym}\n #{text}"
|
181
182
|
else
|
182
183
|
"#{sym}#{text}"
|
data/lib/kramdown/parser/html.rb
CHANGED
@@ -83,9 +83,10 @@ module Kramdown
|
|
83
83
|
# Process the HTML start tag that has already be scanned/checked via @src.
|
84
84
|
#
|
85
85
|
# Does the common processing steps and then yields to the caller for further processing
|
86
|
-
# (first parameter is the created element
|
87
|
-
# element is already closed, ie. contains no body
|
88
|
-
|
86
|
+
# (first parameter is the created element; the second parameter is +true+ if the HTML
|
87
|
+
# element is already closed, ie. contains no body; the third parameter specifies whether the
|
88
|
+
# body - and the end tag - need to be handled in case closed=false).
|
89
|
+
def handle_html_start_tag # :yields: el, closed, handle_body
|
89
90
|
name = @src[1].downcase
|
90
91
|
closed = !@src[4].nil?
|
91
92
|
attrs = Utils::OrderedHash.new
|
@@ -100,9 +101,9 @@ module Kramdown
|
|
100
101
|
end
|
101
102
|
if name == 'script' || name == 'style'
|
102
103
|
handle_raw_html_tag(name)
|
103
|
-
yield(el,
|
104
|
+
yield(el, false, false)
|
104
105
|
else
|
105
|
-
yield(el, closed)
|
106
|
+
yield(el, closed, true)
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
@@ -559,8 +560,8 @@ module Kramdown
|
|
559
560
|
end
|
560
561
|
end
|
561
562
|
|
562
|
-
tag_handler = lambda do |c, closed|
|
563
|
-
parse_raw_html(c, &tag_handler) if !closed
|
563
|
+
tag_handler = lambda do |c, closed, handle_body|
|
564
|
+
parse_raw_html(c, &tag_handler) if !closed && handle_body
|
564
565
|
end
|
565
566
|
parse_raw_html(@tree, &tag_handler)
|
566
567
|
|
@@ -35,7 +35,7 @@ module Kramdown
|
|
35
35
|
|
36
36
|
TRAILING_WHITESPACE = /[ \t]*\n/
|
37
37
|
|
38
|
-
def handle_kramdown_html_tag(el, closed)
|
38
|
+
def handle_kramdown_html_tag(el, closed, handle_body)
|
39
39
|
el.options[:ial] = @block_ial if @block_ial
|
40
40
|
|
41
41
|
content_model = if @tree.type != :html_element || @tree.options[:content_model] != :raw
|
@@ -49,8 +49,9 @@ module Kramdown
|
|
49
49
|
|
50
50
|
@src.scan(TRAILING_WHITESPACE) if content_model == :block
|
51
51
|
el.options[:content_model] = content_model
|
52
|
+
el.options[:is_closed] = closed
|
52
53
|
|
53
|
-
if !closed
|
54
|
+
if !closed && handle_body
|
54
55
|
if content_model == :block
|
55
56
|
if !parse_blocks(el)
|
56
57
|
warning("Found no end tag for '#{el.value}' - auto-closing it")
|
@@ -143,7 +144,8 @@ module Kramdown
|
|
143
144
|
end
|
144
145
|
end
|
145
146
|
|
146
|
-
el = Element.new(:html_element, tag_name, attrs, :category => :span,
|
147
|
+
el = Element.new(:html_element, tag_name, attrs, :category => :span,
|
148
|
+
:content_model => (do_parsing ? :span : :raw), :is_closed => !!@src[4])
|
147
149
|
@tree.children << el
|
148
150
|
stop_re = /<\/#{Regexp.escape(tag_name)}\s*>/i
|
149
151
|
if !@src[4] && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
|
@@ -164,6 +164,7 @@ module Kramdown
|
|
164
164
|
el.children << Element.new(:raw_text, term)
|
165
165
|
deflist.children << el
|
166
166
|
end
|
167
|
+
deflist.options[:ial] = para.options[:ial]
|
167
168
|
|
168
169
|
item = nil
|
169
170
|
content_re, lazy_re, indent_re = nil
|
@@ -214,7 +215,8 @@ module Kramdown
|
|
214
215
|
else
|
215
216
|
last = nil
|
216
217
|
end
|
217
|
-
|
218
|
+
|
219
|
+
if it.children.first && it.children.first.type == :p && !it.options.delete(:first_as_para)
|
218
220
|
it.children.first.children.first.value << "\n" if it.children.size > 1
|
219
221
|
it.children.first.options[:transparent] = true
|
220
222
|
end
|
data/lib/kramdown/version.rb
CHANGED
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.14.
|
4
|
+
version: 0.14.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: coderay
|
@@ -394,9 +394,11 @@ files:
|
|
394
394
|
- test/testcases/block/07_horizontal_rule/error.text
|
395
395
|
- test/testcases/block/07_horizontal_rule/normal.text
|
396
396
|
- test/testcases/block/07_horizontal_rule/sepspaces.html
|
397
|
+
- test/testcases/block/13_definition_list/deflist_ial.html
|
397
398
|
- test/testcases/block/13_definition_list/separated_by_eob.html
|
398
399
|
- test/testcases/block/13_definition_list/definition_at_beginning.text
|
399
400
|
- test/testcases/block/13_definition_list/simple.html
|
401
|
+
- test/testcases/block/13_definition_list/deflist_ial.text
|
400
402
|
- test/testcases/block/13_definition_list/too_much_space.text
|
401
403
|
- test/testcases/block/13_definition_list/item_ial.text
|
402
404
|
- test/testcases/block/13_definition_list/multiple_terms.text
|