kramdown 1.3.0 → 1.3.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.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +1 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/doc/index.page +6 -5
- data/doc/sidebar.template +2 -2
- data/doc/tests.page +44 -44
- data/lib/kramdown/converter/pdf.rb +0 -19
- data/lib/kramdown/utils/string_scanner.rb +10 -1
- data/lib/kramdown/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a29271ef47d6e3832bc4b1ce30803ca7e6c1b985
|
4
|
+
data.tar.gz: 8e215448828e83deb9e53039eb0ffec9dda82306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28a80e5bba88ba0f15a8c9e9d7fc21fd804195f752467693de148b363c3f8dd05ca8101d1392c585a78a208ba1ed2718c7b6bf1211982ac73d80b8bc7ba137f
|
7
|
+
data.tar.gz: 25523fb2b906cc42592e422fe691474f50072f7caa64762d84d0b3ac46d1b6f6359d116a1481ea501d5b6ef9c2bd313086b4f4c1c9ad260b5a7c9e32b4bf9f93
|
data/CONTRIBUTERS
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.1
|
data/doc/index.page
CHANGED
@@ -28,15 +28,15 @@ content_processor.tikz.opts: |
|
|
28
28
|
child[concept color=orange, grow=140, ->] {node[concept] (i-kramdown) {kramdown}}
|
29
29
|
child[concept color=orange, grow=180] {node[concept] (i-html) {HTML}}
|
30
30
|
child[concept color=orange, grow=220] {node[concept] (i-markdown) {Markdown}}
|
31
|
-
child[concept color=green!50!black, grow=
|
32
|
-
child[concept color=green!50!black, grow=
|
33
|
-
child[concept color=green!50!black, grow=-
|
31
|
+
child[concept color=green!50!black, grow=60] {node[concept] (o-html) {HTML}}
|
32
|
+
child[concept color=green!50!black, grow=20] {node[concept] (o-kramdown) {kramdown}}
|
33
|
+
child[concept color=green!50!black, grow=-20] {
|
34
34
|
node[concept] (o-latex) {\LaTeX}
|
35
35
|
child[grow=0] {
|
36
36
|
node[concept] (o-latex-pdf) {PDF}
|
37
37
|
}
|
38
38
|
}
|
39
|
-
child[concept color=green!50!black, grow=-
|
39
|
+
child[concept color=green!50!black, grow=-60] {node[concept] (o-pdf) {PDF}}
|
40
40
|
;
|
41
41
|
\draw [dash pattern=on 0pt off 2pt,line width=5pt,arrows=-angle 60,shorten >=15pt,shorten <=10pt,color=orange]
|
42
42
|
(i-kramdown) edge(lib)
|
@@ -45,7 +45,8 @@ content_processor.tikz.opts: |
|
|
45
45
|
\draw [dash pattern=on 0pt off 2pt,line width=5pt,arrows=-angle 60,shorten >=10pt,shorten <=15pt,color=green!50!black]
|
46
46
|
(lib) edge(o-html)
|
47
47
|
(lib) edge (o-kramdown)
|
48
|
-
(lib) edge (o-latex)
|
48
|
+
(lib) edge (o-latex)
|
49
|
+
(lib) edge (o-pdf);
|
49
50
|
{tikz}
|
50
51
|
{: style="text-align: center"}
|
51
52
|
|
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">
|
3
|
+
<p>The latest version of kramdown is <span class="inline-important">1.3.1</span> and it was released
|
4
|
+
on <span class="inline-important">2014-01-05</span></p>
|
5
5
|
|
6
6
|
<p>More <a href="{relocatable: news.html}">news</a>…</p>
|
7
7
|
|
data/doc/tests.page
CHANGED
@@ -33,73 +33,73 @@ kramdown comes with a small benchmark to test how fast it is in regard to four o
|
|
33
33
|
implementations: Maruku, BlueFeather, BlueCloth, RDiscount and Redcarpet. The first two are written
|
34
34
|
using only Ruby, the latter three are written in C and need to be compiled.
|
35
35
|
|
36
|
-
As one can see below, kramdown is currently (
|
37
|
-
than BlueFeather but ~30x slower than BlueCloth and RDiscount and ~
|
36
|
+
As one can see below, kramdown is currently (January 2014) ~2.5x faster than Maruku, ~4-6x faster
|
37
|
+
than BlueFeather but ~30x slower than BlueCloth and RDiscount and ~150x slower than Redcarpet:
|
38
38
|
|
39
39
|
<pre><code>
|
40
|
-
Running tests on
|
40
|
+
Running tests on 2014-01-05 under ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
|
41
41
|
|
42
42
|
Test using file mdsyntax.text and 20 runs
|
43
43
|
Rehearsal ----------------------------------------------------
|
44
|
-
kramdown 1.0
|
45
|
-
Maruku 0.
|
46
|
-
BlueFeather 0.
|
47
|
-
BlueCloth 2.2.0 0.050000 0.000000 0.050000 ( 0.
|
48
|
-
RDiscount
|
49
|
-
redcarpet
|
50
|
-
------------------------------------------- total:
|
44
|
+
kramdown 1.3.0 1.090000 0.020000 1.110000 ( 1.102094)
|
45
|
+
Maruku 0.7.0 3.140000 0.010000 3.150000 ( 3.151116)
|
46
|
+
BlueFeather 0.41 5.140000 0.000000 5.140000 ( 5.136591)
|
47
|
+
BlueCloth 2.2.0 0.050000 0.000000 0.050000 ( 0.057502)
|
48
|
+
RDiscount 2.0.7 0.020000 0.000000 0.020000 ( 0.015115)
|
49
|
+
redcarpet 3.0.0 0.000000 0.000000 0.000000 ( 0.004641)
|
50
|
+
------------------------------------------- total: 9.470000sec
|
51
51
|
|
52
52
|
user system total real
|
53
|
-
kramdown 1.0
|
54
|
-
Maruku 0.
|
55
|
-
BlueFeather 0.
|
56
|
-
BlueCloth 2.2.0 0.040000 0.000000 0.040000 ( 0.
|
57
|
-
RDiscount
|
58
|
-
redcarpet
|
53
|
+
kramdown 1.3.0 1.200000 0.000000 1.200000 ( 1.199684)
|
54
|
+
Maruku 0.7.0 3.010000 0.040000 3.050000 ( 3.043411)
|
55
|
+
BlueFeather 0.41 5.720000 0.000000 5.720000 ( 5.723845)
|
56
|
+
BlueCloth 2.2.0 0.040000 0.000000 0.040000 ( 0.040749)
|
57
|
+
RDiscount 2.0.7 0.020000 0.000000 0.020000 ( 0.017600)
|
58
|
+
redcarpet 3.0.0 0.000000 0.000000 0.000000 ( 0.004822)
|
59
59
|
|
60
60
|
Real time of X divided by real time of kramdown
|
61
|
-
Maruku
|
62
|
-
BlueFeather 4.
|
63
|
-
BlueCloth 0.
|
64
|
-
RDiscount 0.
|
65
|
-
redcarpet 0.
|
61
|
+
Maruku 2.5368
|
62
|
+
BlueFeather 4.7711
|
63
|
+
BlueCloth 0.034
|
64
|
+
RDiscount 0.0147
|
65
|
+
redcarpet 0.004
|
66
66
|
|
67
67
|
Test using file mdbasics.text and 20 runs
|
68
68
|
Rehearsal ----------------------------------------------------
|
69
|
-
kramdown 1.0
|
70
|
-
Maruku 0.
|
71
|
-
BlueFeather 0.
|
72
|
-
BlueCloth 2.2.0 0.010000 0.000000 0.010000 ( 0.
|
73
|
-
RDiscount
|
74
|
-
redcarpet
|
75
|
-
------------------------------------------- total:
|
69
|
+
kramdown 1.3.0 0.220000 0.000000 0.220000 ( 0.217277)
|
70
|
+
Maruku 0.7.0 0.850000 0.000000 0.850000 ( 0.847144)
|
71
|
+
BlueFeather 0.41 1.290000 0.010000 1.300000 ( 1.291695)
|
72
|
+
BlueCloth 2.2.0 0.010000 0.000000 0.010000 ( 0.012484)
|
73
|
+
RDiscount 2.0.7 0.000000 0.000000 0.000000 ( 0.004158)
|
74
|
+
redcarpet 3.0.0 0.000000 0.000000 0.000000 ( 0.001721)
|
75
|
+
------------------------------------------- total: 2.380000sec
|
76
76
|
|
77
77
|
user system total real
|
78
|
-
kramdown 1.0
|
79
|
-
Maruku 0.
|
80
|
-
BlueFeather 0.
|
81
|
-
BlueCloth 2.2.0 0.
|
82
|
-
RDiscount
|
83
|
-
redcarpet
|
78
|
+
kramdown 1.3.0 0.210000 0.000000 0.210000 ( 0.215760)
|
79
|
+
Maruku 0.7.0 0.590000 0.000000 0.590000 ( 0.591681)
|
80
|
+
BlueFeather 0.41 1.360000 0.000000 1.360000 ( 1.362281)
|
81
|
+
BlueCloth 2.2.0 0.010000 0.000000 0.010000 ( 0.013973)
|
82
|
+
RDiscount 2.0.7 0.010000 0.000000 0.010000 ( 0.005797)
|
83
|
+
redcarpet 3.0.0 0.000000 0.000000 0.000000 ( 0.001692)
|
84
84
|
|
85
85
|
Real time of X divided by real time of kramdown
|
86
|
-
Maruku
|
87
|
-
BlueFeather 6.
|
88
|
-
BlueCloth 0.
|
89
|
-
RDiscount 0.
|
90
|
-
redcarpet 0.
|
86
|
+
Maruku 2.7423
|
87
|
+
BlueFeather 6.3139
|
88
|
+
BlueCloth 0.0648
|
89
|
+
RDiscount 0.0269
|
90
|
+
redcarpet 0.0078
|
91
91
|
</code></pre>
|
92
92
|
|
93
93
|
And here are some graphs which show the execution times of the various kramdown releases on
|
94
94
|
different Ruby interpreters:
|
95
95
|
|
96
|
-
![ruby 1.8.5p231]({relocatable: img/graph-ruby-1.8.5-231.png})
|
97
|
-
![ruby 1.8.6p399]({relocatable: img/graph-ruby-1.8.6-399.png})
|
98
|
-
![ruby 1.8.7p249]({relocatable: img/graph-ruby-1.8.7-249.png})
|
99
96
|
![ruby 1.8.7p302]({relocatable: img/graph-ruby-1.8.7-302.png})
|
100
97
|
![ruby 1.9.2p320]({relocatable: img/graph-ruby-1.9.2p320-320.png})
|
101
|
-
![ruby 1.9.
|
102
|
-
![ruby 2.0.
|
98
|
+
![ruby 1.9.3p448]({relocatable: img/graph-ruby-1.9.3p448-448.png})
|
99
|
+
![ruby 2.0.0p247]({relocatable: img/graph-ruby-2.0.0p247-247.png})
|
100
|
+
![ruby 2.1.0p0]({relocatable: img/graph-ruby-2.1.0p0-0.png})
|
101
|
+
![jruby 1.7.3]({relocatable: img/graph-jruby-1.7.3-385.png})
|
102
|
+
![rubinius 2.0.0]({relocatable: img/graph-rubinius-2.0.0-0.png})
|
103
103
|
|
104
104
|
[Markdown Test Suite]: http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
|
105
105
|
[MDTest]: http://www.michelf.com/docs/projets/mdtest-1.0.zip
|
@@ -539,7 +539,6 @@ module Kramdown
|
|
539
539
|
|
540
540
|
# Create the PDF outline from the header elements in the TOC.
|
541
541
|
def create_outline(root)
|
542
|
-
patch_outline_object
|
543
542
|
toc = ::Kramdown::Converter::Toc.convert(root).first
|
544
543
|
|
545
544
|
text_of_header = lambda do |el|
|
@@ -568,24 +567,6 @@ module Kramdown
|
|
568
567
|
end
|
569
568
|
end
|
570
569
|
|
571
|
-
# Patch the pdf_document.outline object to accept arbitrary destinations.
|
572
|
-
def patch_outline_object
|
573
|
-
def (@pdf.outline).create_outline_item(title, options)
|
574
|
-
outline_item = ::Prawn::OutlineItem.new(title, parent, options)
|
575
|
-
|
576
|
-
case options[:destination]
|
577
|
-
when Integer
|
578
|
-
page_index = options[:destination] - 1
|
579
|
-
outline_item.dest = [document.state.pages[page_index].dictionary, :Fit]
|
580
|
-
when Array
|
581
|
-
outline_item.dest = options[:destination]
|
582
|
-
end
|
583
|
-
|
584
|
-
outline_item.prev = prev if @prev
|
585
|
-
items[title] = document.ref!(outline_item)
|
586
|
-
end
|
587
|
-
end
|
588
|
-
|
589
570
|
|
590
571
|
# ----------------------------
|
591
572
|
# :section: Helper methods
|
@@ -19,6 +19,8 @@ module Kramdown
|
|
19
19
|
def initialize(string, start_line_number = 1)
|
20
20
|
super(string)
|
21
21
|
@start_line_number = start_line_number || 1
|
22
|
+
@previous_pos = 0
|
23
|
+
@previous_line_number = @start_line_number
|
22
24
|
end
|
23
25
|
|
24
26
|
# To make this unicode (multibyte) aware, we have to use #charpos which was added in Ruby
|
@@ -43,7 +45,14 @@ module Kramdown
|
|
43
45
|
# NOTE: Normally we'd have to add one to the count of newlines to get the correct line number.
|
44
46
|
# However we add the one indirectly by using a one-based start_line_number.
|
45
47
|
def current_line_number
|
46
|
-
string[
|
48
|
+
# Not using string[@previous_pos..best_pos].count('\n') because it is slower
|
49
|
+
strscan = ::StringScanner.new(string)
|
50
|
+
strscan.pos = @previous_pos
|
51
|
+
old_pos = pos + 1
|
52
|
+
@previous_line_number += 1 while strscan.skip_until(/\n/) && strscan.pos <= old_pos
|
53
|
+
|
54
|
+
@previous_pos = (eos? ? best_pos : best_pos + 1)
|
55
|
+
@previous_line_number
|
47
56
|
end
|
48
57
|
|
49
58
|
end
|
data/lib/kramdown/version.rb
CHANGED
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.5.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: prawn
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.13'
|
55
69
|
description: |
|
56
70
|
kramdown is yet-another-markdown-parser but fast, pure Ruby,
|
57
71
|
using a strict syntax definition and supporting several common extensions.
|