kramdown 1.3.1 → 1.3.2
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.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +1 -1
- data/VERSION +1 -1
- data/benchmark/graph-ruby-2.1.0p0-0.png +0 -0
- data/benchmark/kramdown-ruby-2.1.0p0-0.dat +9 -0
- data/doc/sidebar.template +2 -2
- 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 -2
- data/lib/kramdown/converter/html.rb +8 -5
- data/lib/kramdown/converter/kramdown.rb +7 -7
- data/lib/kramdown/converter/latex.rb +4 -4
- data/lib/kramdown/converter/pdf.rb +1 -1
- data/lib/kramdown/converter/remove_html_tags.rb +1 -1
- data/lib/kramdown/converter/toc.rb +1 -1
- data/lib/kramdown/document.rb +1 -1
- data/lib/kramdown/element.rb +1 -1
- data/lib/kramdown/error.rb +1 -1
- data/lib/kramdown/options.rb +1 -1
- data/lib/kramdown/parser.rb +1 -1
- data/lib/kramdown/parser/base.rb +1 -1
- data/lib/kramdown/parser/html.rb +1 -1
- data/lib/kramdown/parser/kramdown.rb +8 -3
- data/lib/kramdown/parser/kramdown/abbreviation.rb +1 -1
- 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 +1 -1
- 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 +1 -1
- data/lib/kramdown/parser/kramdown/footnote.rb +1 -1
- 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 +1 -1
- 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 +2 -2
- data/lib/kramdown/parser/kramdown/list.rb +1 -1
- data/lib/kramdown/parser/kramdown/math.rb +1 -1
- data/lib/kramdown/parser/kramdown/paragraph.rb +1 -1
- 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 +1 -1
- data/lib/kramdown/utils.rb +2 -2
- data/lib/kramdown/utils/entities.rb +1 -1
- data/lib/kramdown/utils/html.rb +1 -1
- data/lib/kramdown/utils/ordered_hash.rb +1 -1
- data/lib/kramdown/utils/unidecoder.rb +1 -1
- data/lib/kramdown/version.rb +2 -2
- data/test/run_tests.rb +1 -1
- data/test/test_files.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05cb65d8c3b633833c3b93fb4df3fe0b11af7408
|
4
|
+
data.tar.gz: f370942fc9b15e83b50b322467884fb35384a325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2714b1b6996bd54d01aedd4c24995eeba7091cb1ff4e8d8154e3b9c28a4bbdfd436727f34bd29711b9fb9a7fad6bdfbcbd6a7a935cd465e496a09091250d8a87
|
7
|
+
data.tar.gz: 0a2023bd31764772204bbb6ebe568f3a0c37c4dfab33adf8080d58a84ccd7f56cc3cecef22ff8d9c863fbea42617521ef3f4b4ab568a4536420f50cd8fecfa32
|
data/CONTRIBUTERS
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.2
|
Binary file
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# 2014-01-20--21:04:17 || 2014-01-20--21:48:40 || 2014-01-20--22:35:48 || 2014-01-21--11:13:47 || 2014-01-21--11:21:44 || 2014-01-21--11:34:35
|
2
|
+
1 0.00756 0.00812 0.00894 0.00730 0.00781 0.00793
|
3
|
+
2 0.01485 0.01459 0.01474 0.01465 0.01471 0.01429
|
4
|
+
4 0.02822 0.02783 0.02973 0.02855 0.02746 0.02871
|
5
|
+
8 0.05997 0.05985 0.06152 0.06203 0.06018 0.06171
|
6
|
+
16 0.12721 0.12596 0.12647 0.12438 0.12664 0.12578
|
7
|
+
32 0.27359 0.27128 0.28278 0.27786 0.27565 0.27402
|
8
|
+
64 0.64162 0.63571 0.67304 0.64003 0.64986 0.63973
|
9
|
+
128 1.57056 1.53235 1.62888 1.55602 1.53303 1.53403
|
data/doc/sidebar.template
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<h2>News</h2>
|
2
2
|
|
3
|
-
<p>The latest version of kramdown is <span class="inline-important">1.3.
|
4
|
-
on <span class="inline-important">2014-
|
3
|
+
<p>The latest version of kramdown is <span class="inline-important">1.3.2</span> and it was released
|
4
|
+
on <span class="inline-important">2014-02-16</span></p>
|
5
5
|
|
6
6
|
<p>More <a href="{relocatable: news.html}">news</a>…</p>
|
7
7
|
|
data/lib/kramdown.rb
CHANGED
data/lib/kramdown/converter.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -169,7 +169,7 @@ module Kramdown
|
|
169
169
|
# Return +true+ if the header element +el+ should be used for the table of contents (as
|
170
170
|
# specified by the +toc_levels+ option).
|
171
171
|
def in_toc?(el)
|
172
|
-
@options[:toc_levels].include?(el.options[:level])
|
172
|
+
@options[:toc_levels].include?(el.options[:level]) && (el.attr['class'] || '') !~ /\bno_toc\b/
|
173
173
|
end
|
174
174
|
|
175
175
|
# Return the output header level given a level.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -146,7 +146,7 @@ module Kramdown
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def convert_ul(el, indent)
|
149
|
-
if !@toc_code && (el.options[:ial][:refs].include?('toc') rescue nil)
|
149
|
+
if !@toc_code && (el.options[:ial][:refs].include?('toc') rescue nil)
|
150
150
|
@toc_code = [el.type, el.attr, (0..128).to_a.map{|a| rand(36).to_s(36)}.join]
|
151
151
|
@toc_code.last
|
152
152
|
else
|
@@ -154,7 +154,10 @@ module Kramdown
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
alias :convert_ol :convert_ul
|
157
|
-
|
157
|
+
|
158
|
+
def convert_dl(el, indent)
|
159
|
+
format_as_indented_block_html(el.type, el.attr, inner(el, indent), indent)
|
160
|
+
end
|
158
161
|
|
159
162
|
def convert_li(el, indent)
|
160
163
|
output = ' '*indent << "<#{el.type}" << html_attributes(el.attr) << ">"
|
@@ -242,8 +245,8 @@ module Kramdown
|
|
242
245
|
def convert_a(el, indent)
|
243
246
|
res = inner(el, indent)
|
244
247
|
attr = el.attr.dup
|
245
|
-
if attr['href']
|
246
|
-
mail_addr = attr['href']
|
248
|
+
if attr['href'].start_with?('mailto:')
|
249
|
+
mail_addr = attr['href'][7..-1]
|
247
250
|
attr['href'] = obfuscate('mailto') << ":" << obfuscate(mail_addr)
|
248
251
|
res = obfuscate(res) if res == mail_addr
|
249
252
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -223,16 +223,16 @@ module Kramdown
|
|
223
223
|
def convert_thead(el, opts)
|
224
224
|
rows = inner(el, opts)
|
225
225
|
if opts[:alignment].all? {|a| a == :default}
|
226
|
-
"#{rows}|"
|
226
|
+
"#{rows}|" << "-"*10 << "\n"
|
227
227
|
else
|
228
|
-
"#{rows}| "
|
228
|
+
"#{rows}| " << opts[:alignment].map do |a|
|
229
229
|
case a
|
230
230
|
when :left then ":-"
|
231
231
|
when :right then "-:"
|
232
232
|
when :center then ":-:"
|
233
233
|
when :default then "-"
|
234
234
|
end
|
235
|
-
end.join(' ')
|
235
|
+
end.join(' ') << "\n"
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
@@ -244,11 +244,11 @@ module Kramdown
|
|
244
244
|
end
|
245
245
|
|
246
246
|
def convert_tfoot(el, opts)
|
247
|
-
"|"
|
247
|
+
"|" << "="*10 << "\n#{inner(el, opts)}"
|
248
248
|
end
|
249
249
|
|
250
250
|
def convert_tr(el, opts)
|
251
|
-
"| "
|
251
|
+
"| " << el.children.map {|c| convert(c, opts)}.join(" | ") << " |\n"
|
252
252
|
end
|
253
253
|
|
254
254
|
def convert_td(el, opts)
|
@@ -406,7 +406,7 @@ module Kramdown
|
|
406
406
|
" #{k}=\"#{v.to_s}\""
|
407
407
|
end
|
408
408
|
end.compact.join('')
|
409
|
-
res = "toc"
|
409
|
+
res = "toc" << (res.strip.empty? ? '' : " #{res}") if (el.type == :ul || el.type == :ol) &&
|
410
410
|
(el.options[:ial][:refs].include?('toc') rescue nil)
|
411
411
|
res.strip.empty? ? nil : "{:#{res}}"
|
412
412
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -186,7 +186,7 @@ module Kramdown
|
|
186
186
|
end
|
187
187
|
|
188
188
|
def convert_tr(el, opts)
|
189
|
-
el.children.map {|c| send("convert_#{c.type}", c, opts)}.join(' & ')
|
189
|
+
el.children.map {|c| send("convert_#{c.type}", c, opts)}.join(' & ') << "\\\\\n"
|
190
190
|
end
|
191
191
|
|
192
192
|
def convert_td(el, opts)
|
@@ -194,7 +194,7 @@ module Kramdown
|
|
194
194
|
end
|
195
195
|
|
196
196
|
def convert_comment(el, opts)
|
197
|
-
el.value.split(/\n/).map {|l| "% #{l}"}.join("\n")
|
197
|
+
el.value.split(/\n/).map {|l| "% #{l}"}.join("\n") << "\n"
|
198
198
|
end
|
199
199
|
|
200
200
|
def convert_br(el, opts)
|
@@ -205,7 +205,7 @@ module Kramdown
|
|
205
205
|
|
206
206
|
def convert_a(el, opts)
|
207
207
|
url = el.attr['href']
|
208
|
-
if url
|
208
|
+
if url.start_with?('#')
|
209
209
|
"\\hyperlink{#{escape(url[1..-1])}}{#{inner(el, opts)}}"
|
210
210
|
else
|
211
211
|
"\\href{#{escape(url)}}{#{inner(el, opts)}}"
|
data/lib/kramdown/document.rb
CHANGED
data/lib/kramdown/element.rb
CHANGED
data/lib/kramdown/error.rb
CHANGED
data/lib/kramdown/options.rb
CHANGED
data/lib/kramdown/parser.rb
CHANGED
data/lib/kramdown/parser/base.rb
CHANGED
data/lib/kramdown/parser/html.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -68,9 +68,9 @@ module Kramdown
|
|
68
68
|
|
69
69
|
@root.options[:abbrev_defs] = {}
|
70
70
|
@alds = {}
|
71
|
-
@link_defs = {}
|
72
|
-
@options[:link_defs].each {|k,v| @link_defs[normalize_link_id(k)] = v}
|
73
71
|
@footnotes = {}
|
72
|
+
@link_defs = {}
|
73
|
+
update_link_definitions(@options[:link_defs])
|
74
74
|
|
75
75
|
@block_parsers = [:blank_line, :codeblock, :codeblock_fenced, :blockquote, :atx_header,
|
76
76
|
:horizontal_rule, :list, :definition_list, :block_html, :setext_header,
|
@@ -96,6 +96,11 @@ module Kramdown
|
|
96
96
|
protected
|
97
97
|
#######
|
98
98
|
|
99
|
+
# Update the link definitions with the data from +link_defs+.
|
100
|
+
def update_link_definitions(link_defs)
|
101
|
+
link_defs.each {|k,v| @link_defs[normalize_link_id(k)] = v}
|
102
|
+
end
|
103
|
+
|
99
104
|
# Adapt the object to allow parsing like specified in the options.
|
100
105
|
def configure_parser
|
101
106
|
@parsers = {}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -13,7 +13,7 @@ module Kramdown
|
|
13
13
|
|
14
14
|
# Normalize the link identifier.
|
15
15
|
def normalize_link_id(id)
|
16
|
-
id.gsub(/
|
16
|
+
id.gsub(/[\s\n]+/, ' ').downcase
|
17
17
|
end
|
18
18
|
|
19
19
|
LINK_DEFINITION_START = /^#{OPT_SPACE}\[([^\n\]]+)\]:[ \t]*(?:<(.*?)>|([^'"\n]*?\S[^'"\n]*?))[ \t]*?(?:\n?[ \t]*?(["'])(.+?)\4[ \t]*?)?\n/
|
data/lib/kramdown/utils.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -23,7 +23,7 @@ module Kramdown
|
|
23
23
|
|
24
24
|
# Treat +name+ as if it were snake cased (e.g. snake_case) and camelize it (e.g. SnakeCase).
|
25
25
|
def self.camelize(name)
|
26
|
-
name.split('_').inject('') {|s,x| s << x[0..0].upcase
|
26
|
+
name.split('_').inject('') {|s,x| s << x[0..0].upcase << x[1..-1] }
|
27
27
|
end
|
28
28
|
|
29
29
|
# Treat +name+ as if it were camelized (e.g. CamelizedName) and snake-case it (e.g. camelized_name).
|
data/lib/kramdown/utils/html.rb
CHANGED
data/lib/kramdown/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -10,6 +10,6 @@
|
|
10
10
|
module Kramdown
|
11
11
|
|
12
12
|
# The kramdown version.
|
13
|
-
VERSION = '1.3.
|
13
|
+
VERSION = '1.3.2'
|
14
14
|
|
15
15
|
end
|
data/test/run_tests.rb
CHANGED
data/test/test_files.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2014 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -252,6 +252,7 @@ class TestFiles < Minitest::Test
|
|
252
252
|
opts_file = text_file.sub(/\.text$/, '.options')
|
253
253
|
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :footnote_nr => 1}
|
254
254
|
(Kramdown::Converter.constants.map {|c| c.to_sym} - [:Base, :RemoveHtmlTags]).each do |conv_class|
|
255
|
+
next if conv_class == :Pdf && RUBY_VERSION < '1.9'
|
255
256
|
define_method("test_whether_#{conv_class}_modifies_tree_with_file_#{text_file.tr('.', '_')}") do
|
256
257
|
doc = Kramdown::Document.new(File.read(text_file), options)
|
257
258
|
options_before = Marshal.load(Marshal.dump(doc.options))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -86,6 +86,8 @@ files:
|
|
86
86
|
- benchmark/benchmark.rb
|
87
87
|
- benchmark/benchmark.sh
|
88
88
|
- benchmark/generate_data.rb
|
89
|
+
- benchmark/graph-ruby-2.1.0p0-0.png
|
90
|
+
- benchmark/kramdown-ruby-2.1.0p0-0.dat
|
89
91
|
- benchmark/mdbasics.text
|
90
92
|
- benchmark/mdsyntax.text
|
91
93
|
- benchmark/testing.sh
|