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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 762672bf30e0c2bcc71355e3b43edb552dc0680f
4
- data.tar.gz: ab25e4ed7bc11403cf899f114b6ae468219adced
3
+ metadata.gz: a29271ef47d6e3832bc4b1ce30803ca7e6c1b985
4
+ data.tar.gz: 8e215448828e83deb9e53039eb0ffec9dda82306
5
5
  SHA512:
6
- metadata.gz: c97487f81874d9c1e4109e94ec1050997c8c4998b8cc3a3d5c64e43513473e3942111b26060555bf508e3201b672b67ae3db44ebdb2f96ccdac0689abf8c0558
7
- data.tar.gz: 89837ca84aa43bf437fb3aec9c6ac919cc9f424045746201b5e365b23a11b5962ef0d340357338587e06dc9fa0cb191e52a86d800365ac47b551c9c0486d51c9
6
+ metadata.gz: a28a80e5bba88ba0f15a8c9e9d7fc21fd804195f752467693de148b363c3f8dd05ca8101d1392c585a78a208ba1ed2718c7b6bf1211982ac73d80b8bc7ba137f
7
+ data.tar.gz: 25523fb2b906cc42592e422fe691474f50072f7caa64762d84d0b3ac46d1b6f6359d116a1481ea501d5b6ef9c2bd313086b4f4c1c9ad260b5a7c9e32b4bf9f93
@@ -1,6 +1,6 @@
1
1
  Count Name
2
2
  ======= ====
3
- 631 Thomas Leitner <t_leitner@gmx.at>
3
+ 643 Thomas Leitner <t_leitner@gmx.at>
4
4
  6 Gioele Barabucci <gioele@svario.it>
5
5
  4 Ted Pak <powerpak006@gmail.com>
6
6
  4 Arne Brasseur <arne@arnebrasseur.net>
data/Rakefile CHANGED
@@ -183,6 +183,7 @@ EOF
183
183
  s.add_development_dependency 'minitest', '~> 5.0'
184
184
  s.add_development_dependency 'coderay', '~> 1.0.0'
185
185
  s.add_development_dependency 'stringex', '~> 1.5.1'
186
+ s.add_development_dependency 'prawn', '~> 0.13'
186
187
 
187
188
  #### Documentation
188
189
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -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=40] {node[concept] (o-html) {HTML}}
32
- child[concept color=green!50!black, grow=0] {node[concept] (o-kramdown) {kramdown}}
33
- child[concept color=green!50!black, grow=-40] {
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=-40] {node[concept] {\LaTeX}}
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
 
@@ -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.0</span> and it was released
4
- on <span class="inline-important">2013-12-08</span></p>
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
 
@@ -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 (May 2013) ~3-4x faster than Maruku, ~4-5x faster
37
- than BlueFeather but ~30x slower than BlueCloth and RDiscount and ~100x slower than Redcarpet:
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 2013-05-08 under ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
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.1 1.010000 0.000000 1.010000 ( 1.014665)
45
- Maruku 0.6.0 2.910000 0.020000 2.930000 ( 2.939359)
46
- BlueFeather 0.40 3.890000 0.000000 3.890000 ( 3.903594)
47
- BlueCloth 2.2.0 0.050000 0.000000 0.050000 ( 0.048246)
48
- RDiscount 1.6.8 0.020000 0.000000 0.020000 ( 0.020237)
49
- redcarpet 2.2.2 0.000000 0.000000 0.000000 ( 0.005038)
50
- ------------------------------------------- total: 7.900000sec
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.1 0.850000 0.000000 0.850000 ( 0.856454)
54
- Maruku 0.6.0 2.820000 0.030000 2.850000 ( 2.856139)
55
- BlueFeather 0.40 3.870000 0.000000 3.870000 ( 3.884309)
56
- BlueCloth 2.2.0 0.040000 0.000000 0.040000 ( 0.044865)
57
- RDiscount 1.6.8 0.020000 0.000000 0.020000 ( 0.022889)
58
- redcarpet 2.2.2 0.010000 0.000000 0.010000 ( 0.005234)
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 3.3348
62
- BlueFeather 4.5353
63
- BlueCloth 0.0524
64
- RDiscount 0.0267
65
- redcarpet 0.0061
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.1 0.150000 0.000000 0.150000 ( 0.154616)
70
- Maruku 0.6.0 0.690000 0.000000 0.690000 ( 0.689874)
71
- BlueFeather 0.40 1.000000 0.000000 1.000000 ( 1.003185)
72
- BlueCloth 2.2.0 0.010000 0.000000 0.010000 ( 0.012767)
73
- RDiscount 1.6.8 0.010000 0.000000 0.010000 ( 0.004747)
74
- redcarpet 2.2.2 0.000000 0.000000 0.000000 ( 0.001594)
75
- ------------------------------------------- total: 1.860000sec
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.1 0.160000 0.000000 0.160000 ( 0.155369)
79
- Maruku 0.6.0 0.670000 0.000000 0.670000 ( 0.673886)
80
- BlueFeather 0.40 1.000000 0.000000 1.000000 ( 0.995874)
81
- BlueCloth 2.2.0 0.020000 0.000000 0.020000 ( 0.013389)
82
- RDiscount 1.6.8 0.010000 0.000000 0.010000 ( 0.006698)
83
- redcarpet 2.2.2 0.000000 0.000000 0.000000 ( 0.001691)
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 4.3373
87
- BlueFeather 6.4097
88
- BlueCloth 0.0862
89
- RDiscount 0.0431
90
- redcarpet 0.0109
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.3p392]({relocatable: img/graph-ruby-1.9.3p392-392.png})
102
- ![ruby 2.0.0]({relocatable: img/graph-ruby-2.0.0p0-0.png})
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[0..best_pos].count("\n") + start_line_number
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
@@ -10,6 +10,6 @@
10
10
  module Kramdown
11
11
 
12
12
  # The kramdown version.
13
- VERSION = '1.3.0'
13
+ VERSION = '1.3.1'
14
14
 
15
15
  end
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.0
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: 2013-12-08 00:00:00.000000000 Z
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.