kramdown 1.7.0 → 1.8.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.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +1 -1
- data/VERSION +1 -1
- data/doc/index.page +2 -2
- data/doc/installation.page +2 -5
- data/lib/kramdown/converter/html.rb +5 -4
- data/lib/kramdown/converter/latex.rb +1 -1
- data/lib/kramdown/options.rb +10 -0
- data/lib/kramdown/parser/html.rb +0 -1
- data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
- data/lib/kramdown/parser/kramdown/html.rb +1 -3
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
- data/lib/kramdown/parser/kramdown/table.rb +4 -2
- data/lib/kramdown/version.rb +1 -1
- data/man/man1/kramdown.1 +12 -0
- data/test/testcases/block/14_table/errors.html +4 -0
- data/test/testcases/block/14_table/errors.text +4 -0
- data/test/testcases/block/16_toc/toc_levels.html +2 -2
- data/test/testcases/block/16_toc/toc_levels.text +1 -1
- data/test/testcases/span/04_footnote/backlink_text.html +9 -0
- data/test/testcases/span/04_footnote/backlink_text.options +1 -0
- data/test/testcases/span/04_footnote/backlink_text.text +3 -0
- data/test/testcases/span/04_footnote/placement.html +1 -1
- data/test/testcases/span/04_footnote/placement.text +1 -1
- data/test/testcases/span/04_footnote/regexp_problem.html +14 -0
- data/test/testcases/span/04_footnote/regexp_problem.text +52 -0
- data/test/testcases/span/text_substitutions/typography.html +8 -0
- data/test/testcases/span/text_substitutions/typography.text +8 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fd1d5abb103643686848dd667d1e3106c4f5bcc
|
4
|
+
data.tar.gz: 6e14c9a736721e2bb5aab181d6c11f861f9edf83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c6b26d0390aa2a2afdfad39cfcfadd782cc04c7e5c6d4ef00f5ccd66c78108b3271675adfd63c7182482024f6a817e104c7e4added160e895dd52d515a7d69f
|
7
|
+
data.tar.gz: bc3c786078e444d72d27985cd349b74e69b523d3419bd9bd78ac24ca0766a7a8275efaa52e99b425c45f4675b5963e2bdbaa408b5682fa6066c0e4a86491765f
|
data/CONTRIBUTERS
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.8.0
|
data/doc/index.page
CHANGED
@@ -97,8 +97,8 @@ extensions that have been made popular by the [PHP Markdown Extra] package and [
|
|
97
97
|
It is probably the fastest pure-Ruby Markdown converter available (September 2014), being about 3x
|
98
98
|
faster than [Maruku] and about 4.5x faster than [BlueFeather].
|
99
99
|
|
100
|
-
Version **1.
|
101
|
-
**2015-04
|
100
|
+
Version **1.8.0**{:itemprop="softwareVersion"} released on
|
101
|
+
**2015-07-04**{:itemprop="datePublished"}, [more news](news.html)
|
102
102
|
{: style="text-align: center; font-size: 80%"}
|
103
103
|
|
104
104
|
</div>
|
data/doc/installation.page
CHANGED
@@ -26,17 +26,14 @@ See the platform specific installation notes for more information!
|
|
26
26
|
### Linux
|
27
27
|
|
28
28
|
There are a variety of Linux distributions out there with different package management systems. So
|
29
|
-
we will focus on instructions for Ubuntu
|
29
|
+
we will focus on instructions for Ubuntu 15.04 here (which should probably also work for any newer
|
30
30
|
Ubuntu version or any recent Debian based distribution).
|
31
31
|
|
32
32
|
After running the following commands, kramdown is installed and ready to use:
|
33
33
|
|
34
|
-
sudo
|
34
|
+
sudo apt-get install ruby
|
35
35
|
sudo gem install kramdown
|
36
36
|
|
37
|
-
> You will also need to add `export PATH=$PATH:/var/lib/gems/1.9/bin` to your `~/.bashrc` because
|
38
|
-
> this is the binary path the executable files get installed to.
|
39
|
-
|
40
37
|
|
41
38
|
### Mac OS X
|
42
39
|
|
@@ -330,7 +330,7 @@ module Kramdown
|
|
330
330
|
def convert_root(el, indent)
|
331
331
|
result = inner(el, indent)
|
332
332
|
if @footnote_location
|
333
|
-
result.sub!(/#{@footnote_location}/, footnote_content)
|
333
|
+
result.sub!(/#{@footnote_location}/, footnote_content.gsub(/\\/, "\\\\\\\\"))
|
334
334
|
else
|
335
335
|
result << footnote_content
|
336
336
|
end
|
@@ -341,7 +341,7 @@ module Kramdown
|
|
341
341
|
else
|
342
342
|
''
|
343
343
|
end
|
344
|
-
result.sub!(/#{@toc_code.last}/, text)
|
344
|
+
result.sub!(/#{@toc_code.last}/, text.gsub(/\\/, "\\\\\\\\"))
|
345
345
|
end
|
346
346
|
result
|
347
347
|
end
|
@@ -430,6 +430,7 @@ module Kramdown
|
|
430
430
|
ol = Element.new(:ol)
|
431
431
|
ol.attr['start'] = @footnote_start if @footnote_start != 1
|
432
432
|
i = 0
|
433
|
+
backlink_text = escape_html(@options[:footnote_backlink], :text)
|
433
434
|
while i < @footnotes.length
|
434
435
|
name, data, _, repeat = *@footnotes[i]
|
435
436
|
li = Element.new(:li, nil, {'id' => "fn:#{name}"})
|
@@ -443,9 +444,9 @@ module Kramdown
|
|
443
444
|
insert_space = false
|
444
445
|
end
|
445
446
|
|
446
|
-
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [insert_space ? ' ' : '', name,
|
447
|
+
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [insert_space ? ' ' : '', name, backlink_text])
|
447
448
|
(1..repeat).each do |index|
|
448
|
-
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [" ", "#{name}:#{index}", "
|
449
|
+
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [" ", "#{name}:#{index}", "#{backlink_text}<sup>#{index+1}</sup>"])
|
449
450
|
end
|
450
451
|
|
451
452
|
ol.children << Element.new(:raw, convert(li, 4))
|
data/lib/kramdown/options.rb
CHANGED
@@ -580,6 +580,16 @@ EOF
|
|
580
580
|
val
|
581
581
|
end
|
582
582
|
|
583
|
+
define(:footnote_backlink, String, '↩', <<EOF)
|
584
|
+
Defines the text that should be used for the footnote backlinks
|
585
|
+
|
586
|
+
The footnote backlink is just text, so any special HTML characters will
|
587
|
+
be escaped.
|
588
|
+
|
589
|
+
Default: '&8617;'
|
590
|
+
Used by: HTML converter
|
591
|
+
EOF
|
592
|
+
|
583
593
|
end
|
584
594
|
|
585
595
|
end
|
data/lib/kramdown/parser/html.rb
CHANGED
@@ -86,7 +86,6 @@ module Kramdown
|
|
86
86
|
@tree.children << el
|
87
87
|
|
88
88
|
if !closed && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
|
89
|
-
warning("The HTML tag '#{el.value}' on line #{line} cannot have any content - auto-closing it")
|
90
89
|
closed = true
|
91
90
|
end
|
92
91
|
if name == 'script' || name == 'style'
|
@@ -140,9 +140,7 @@ module Kramdown
|
|
140
140
|
:content_model => (do_parsing ? :span : :raw), :is_closed => !!@src[4])
|
141
141
|
@tree.children << el
|
142
142
|
stop_re = /<\/#{Regexp.escape(tag_name)}\s*>/i
|
143
|
-
if !@src[4] && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
|
144
|
-
warning("The HTML tag '#{el.value}' on line #{line} cannot have any content - auto-closing it")
|
145
|
-
elsif !@src[4]
|
143
|
+
if !@src[4] && !HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
|
146
144
|
if parse_spans(el, stop_re, (do_parsing ? nil : [:span_html]))
|
147
145
|
@src.scan(stop_re)
|
148
146
|
else
|
@@ -123,7 +123,7 @@ module Kramdown
|
|
123
123
|
|
124
124
|
SQ_RULES = [
|
125
125
|
[/("|')(?=[_*]{1,2}\S)/, [:lquote1]],
|
126
|
-
[/("|')(?=#{SQ_PUNCT}\B)/, [:rquote1]],
|
126
|
+
[/("|')(?=#{SQ_PUNCT}(?!\.\.)\B)/, [:rquote1]],
|
127
127
|
# Special case for double sets of quotes, e.g.:
|
128
128
|
# <p>He said, "'Quoted' words in a larger quote."</p>
|
129
129
|
[/(\s?)"'(?=\w)/, [1, :ldquo, :lsquo]],
|
@@ -45,8 +45,10 @@ module Kramdown
|
|
45
45
|
|
46
46
|
while !@src.eos?
|
47
47
|
break if !@src.check(TABLE_LINE)
|
48
|
-
if @src.scan(TABLE_SEP_LINE)
|
49
|
-
if
|
48
|
+
if @src.scan(TABLE_SEP_LINE)
|
49
|
+
if rows.empty?
|
50
|
+
# nothing to do, ignoring multiple consecutive separator lines
|
51
|
+
elsif table.options[:alignment].empty? && !has_footer
|
50
52
|
add_container.call(:thead, false)
|
51
53
|
table.options[:alignment] = @src[1].scan(TABLE_HSEP_ALIGN).map do |left, right|
|
52
54
|
(left.empty? && right.empty? && :default) || (right.empty? && :left) || (left.empty? && :right) || :center
|
data/lib/kramdown/version.rb
CHANGED
data/man/man1/kramdown.1
CHANGED
@@ -181,6 +181,18 @@ Default: :as_char
|
|
181
181
|
Used by: HTML converter, kramdown converter
|
182
182
|
|
183
183
|
|
184
|
+
.TP
|
185
|
+
.B \-\-footnote-backlink ARG
|
186
|
+
|
187
|
+
Defines the text that should be used for the footnote backlinks
|
188
|
+
|
189
|
+
The footnote backlink is just text, so any special HTML characters will
|
190
|
+
be escaped.
|
191
|
+
|
192
|
+
Default: '&8617;'
|
193
|
+
Used by: HTML converter
|
194
|
+
|
195
|
+
|
184
196
|
.TP
|
185
197
|
.B \-\-footnote-nr ARG
|
186
198
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<ul id="markdown-toc">
|
2
|
-
<li><a href="#header
|
2
|
+
<li><a href="#header--level-2" id="markdown-toc-header--level-2">Header \` level 2</a> <ul>
|
3
3
|
<li><a href="#header-level-3" id="markdown-toc-header-level-3">Header level 3</a></li>
|
4
4
|
</ul>
|
5
5
|
</li>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
<h1 id="header-level-1">Header level 1</h1>
|
13
13
|
|
14
|
-
<h2 id="header
|
14
|
+
<h2 id="header--level-2">Header \` level 2</h2>
|
15
15
|
|
16
16
|
<h3 id="header-level-3">Header level 3</h3>
|
17
17
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<p>Some footnote here<sup id="fnref:fn"><a href="#fn:fn" class="footnote">1</a></sup></p>
|
2
|
+
|
3
|
+
<div class="footnotes">
|
4
|
+
<ol>
|
5
|
+
<li id="fn:fn">
|
6
|
+
<p>Some text here <a href="#fnref:fn" class="reversefootnote">text &8617; <img /></a></p>
|
7
|
+
</li>
|
8
|
+
</ol>
|
9
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
:footnote_backlink: 'text &8617; <img />'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>Something</h1>
|
2
|
+
<p>something<sup id="fnref:note1"><a href="#fn:note1" class="footnote">1</a></sup>.</p>
|
3
|
+
|
4
|
+
<h1>Footnotes</h1>
|
5
|
+
|
6
|
+
<h1>Test</h1>
|
7
|
+
<div class="footnotes">
|
8
|
+
<ol>
|
9
|
+
<li id="fn:note1">
|
10
|
+
|
11
|
+
<p>A note <a href="#fnref:note1" class="reversefootnote">↩</a></p>
|
12
|
+
</li>
|
13
|
+
</ol>
|
14
|
+
</div>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Something
|
2
|
+
something[^note1].
|
3
|
+
|
4
|
+
# Footnotes
|
5
|
+
[^note1]:
|
6
|
+
A note
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
# Test
|
@@ -28,3 +28,11 @@ Mark’s name. “…you”
|
|
28
28
|
<p>“<em>Hurrah!</em>”</p>
|
29
29
|
|
30
30
|
<p>‘<strong>Absolutely</strong>.’</p>
|
31
|
+
|
32
|
+
<p>“…some Text”</p>
|
33
|
+
|
34
|
+
<p>“… some Text”</p>
|
35
|
+
|
36
|
+
<p>This: “…some Text”</p>
|
37
|
+
|
38
|
+
<p>This: “… some Text”</p>
|
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.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04
|
11
|
+
date: 2015-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -563,6 +563,9 @@ files:
|
|
563
563
|
- test/testcases/span/03_codespan/highlighting.text
|
564
564
|
- test/testcases/span/03_codespan/normal.html
|
565
565
|
- test/testcases/span/03_codespan/normal.text
|
566
|
+
- test/testcases/span/04_footnote/backlink_text.html
|
567
|
+
- test/testcases/span/04_footnote/backlink_text.options
|
568
|
+
- test/testcases/span/04_footnote/backlink_text.text
|
566
569
|
- test/testcases/span/04_footnote/definitions.html
|
567
570
|
- test/testcases/span/04_footnote/definitions.latex
|
568
571
|
- test/testcases/span/04_footnote/definitions.text
|
@@ -577,6 +580,8 @@ files:
|
|
577
580
|
- test/testcases/span/04_footnote/markers.text
|
578
581
|
- test/testcases/span/04_footnote/placement.html
|
579
582
|
- test/testcases/span/04_footnote/placement.text
|
583
|
+
- test/testcases/span/04_footnote/regexp_problem.html
|
584
|
+
- test/testcases/span/04_footnote/regexp_problem.text
|
580
585
|
- test/testcases/span/05_html/across_lines.html
|
581
586
|
- test/testcases/span/05_html/across_lines.text
|
582
587
|
- test/testcases/span/05_html/button.html
|