kramdown 0.11.0 → 0.12.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.
- data/CONTRIBUTERS +1 -1
- data/ChangeLog +532 -0
- data/README +22 -12
- data/Rakefile +9 -8
- data/VERSION +1 -1
- data/benchmark/benchmark.sh +61 -0
- data/benchmark/generate_data.rb +57 -55
- data/benchmark/testing.sh +1 -1
- data/benchmark/timing.sh +3 -3
- data/bin/kramdown +1 -2
- data/data/kramdown/document.html +2 -2
- data/data/kramdown/document.latex +2 -2
- data/doc/default.scss.css +6 -1
- data/doc/default.template +1 -1
- data/doc/documentation.page +1 -1
- data/doc/index.page +9 -7
- data/doc/installation.page +2 -3
- data/doc/links.markdown +1 -1
- data/doc/quickref.page +19 -19
- data/doc/syntax.page +117 -98
- data/doc/tests.page +8 -7
- data/lib/kramdown/compatibility.rb +2 -1
- data/lib/kramdown/converter.rb +5 -7
- data/lib/kramdown/converter/base.rb +87 -32
- data/lib/kramdown/converter/html.rb +134 -122
- data/lib/kramdown/converter/kramdown.rb +24 -25
- data/lib/kramdown/converter/latex.rb +65 -55
- data/lib/kramdown/document.rb +487 -42
- data/lib/kramdown/error.rb +3 -0
- data/lib/kramdown/options.rb +83 -28
- data/lib/kramdown/parser.rb +5 -5
- data/lib/kramdown/parser/base.rb +55 -13
- data/lib/kramdown/parser/html.rb +83 -71
- data/lib/kramdown/parser/kramdown.rb +73 -54
- data/lib/kramdown/parser/kramdown/abbreviation.rb +17 -12
- data/lib/kramdown/parser/kramdown/autolink.rb +2 -3
- data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
- data/lib/kramdown/parser/kramdown/block_boundary.rb +2 -2
- data/lib/kramdown/parser/kramdown/blockquote.rb +2 -2
- data/lib/kramdown/parser/kramdown/codeblock.rb +5 -2
- data/lib/kramdown/parser/kramdown/codespan.rb +1 -2
- data/lib/kramdown/parser/kramdown/emphasis.rb +1 -1
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
- data/lib/kramdown/parser/kramdown/extensions.rb +204 -0
- data/lib/kramdown/parser/kramdown/footnote.rb +7 -7
- data/lib/kramdown/parser/kramdown/header.rb +4 -2
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
- data/lib/kramdown/parser/kramdown/html.rb +39 -45
- data/lib/kramdown/parser/kramdown/link.rb +19 -29
- data/lib/kramdown/parser/kramdown/list.rb +13 -13
- data/lib/kramdown/parser/kramdown/math.rb +1 -1
- data/lib/kramdown/parser/kramdown/paragraph.rb +5 -4
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
- data/lib/kramdown/parser/kramdown/table.rb +51 -12
- data/lib/kramdown/parser/markdown.rb +69 -0
- data/lib/kramdown/utils.rb +2 -2
- data/lib/kramdown/utils/entities.rb +10 -1
- data/lib/kramdown/utils/html.rb +22 -11
- data/lib/kramdown/utils/ordered_hash.rb +44 -40
- data/lib/kramdown/version.rb +1 -1
- data/man/man1/kramdown.1 +31 -4
- data/test/testcases/block/08_list/item_ial.html +1 -1
- data/test/testcases/block/11_ial/nested.html +11 -0
- data/test/testcases/block/11_ial/nested.text +15 -0
- data/test/testcases/block/13_definition_list/item_ial.html +1 -1
- data/test/testcases/block/14_table/escaping.html +52 -0
- data/test/testcases/block/14_table/escaping.text +19 -0
- data/test/testcases/block/14_table/simple.html.19 +139 -0
- data/test/testcases/block/14_table/simple.text +1 -1
- data/test/testcases/block/15_math/normal.html +13 -13
- data/test/testcases/block/16_toc/{no_toc_depth.html → no_toc.html} +0 -0
- data/test/testcases/block/16_toc/{no_toc_depth.options → no_toc.options} +0 -0
- data/test/testcases/block/16_toc/{no_toc_depth.text → no_toc.text} +0 -0
- data/test/testcases/block/16_toc/{toc_depth_2.html → toc_levels.html} +4 -4
- data/test/testcases/block/16_toc/toc_levels.options +1 -0
- data/test/testcases/block/16_toc/{toc_depth_2.text → toc_levels.text} +0 -0
- data/test/testcases/span/escaped_chars/normal.html +4 -0
- data/test/testcases/span/escaped_chars/normal.text +4 -0
- data/test/testcases/span/ial/simple.html +1 -1
- data/test/testcases/span/math/normal.html +2 -2
- metadata +20 -25
- data/benchmark/historic-jruby-1.4.0.dat +0 -7
- data/benchmark/historic-ruby-1.8.6.dat +0 -7
- data/benchmark/historic-ruby-1.8.7.dat +0 -7
- data/benchmark/historic-ruby-1.9.1p243.dat +0 -7
- data/benchmark/historic-ruby-1.9.2dev.dat +0 -7
- data/benchmark/static-jruby-1.4.0.dat +0 -7
- data/benchmark/static-ruby-1.8.6.dat +0 -7
- data/benchmark/static-ruby-1.8.7.dat +0 -7
- data/benchmark/static-ruby-1.9.1p243.dat +0 -7
- data/benchmark/static-ruby-1.9.2dev.dat +0 -7
- data/lib/kramdown/parser/kramdown/attribute_list.rb +0 -111
- data/lib/kramdown/parser/kramdown/extension.rb +0 -116
- data/test/testcases/block/16_toc/toc_depth_2.options +0 -1
@@ -200,7 +200,7 @@ module Kramdown
|
|
200
200
|
regexp, substs = SQ_RULES.find {|reg, subst| @src.scan(reg)}
|
201
201
|
substs.each do |subst|
|
202
202
|
if subst.kind_of?(Integer)
|
203
|
-
add_text(@src[subst]
|
203
|
+
add_text(@src[subst])
|
204
204
|
else
|
205
205
|
val = SQ_SUBSTS[[subst, @src[subst.to_s[-1,1].to_i]]] || subst
|
206
206
|
@tree.children << Element.new(:smart_quote, val)
|
@@ -30,7 +30,8 @@ module Kramdown
|
|
30
30
|
TABLE_HSEP_ALIGN = /[ ]?(:?)-+(:?)[ ]?/
|
31
31
|
TABLE_FSEP_LINE = /^[+|: =]*?=[+|: =]*?[ \t]*\n/
|
32
32
|
TABLE_ROW_LINE = /^(.*?)[ \t]*\n/
|
33
|
-
|
33
|
+
TABLE_PIPE_CHECK = /(?:\||.*?[^\\\n]\|)/
|
34
|
+
TABLE_LINE = /#{TABLE_PIPE_CHECK}.*?\n/
|
34
35
|
TABLE_START = /^#{OPT_SPACE}(?=\S)#{TABLE_LINE}/
|
35
36
|
|
36
37
|
# Parse the table at the current location.
|
@@ -47,7 +48,7 @@ module Kramdown
|
|
47
48
|
columns = 0
|
48
49
|
|
49
50
|
add_container = lambda do |type, force|
|
50
|
-
if
|
51
|
+
if !has_footer || type != :tbody || force
|
51
52
|
cont = Element.new(type)
|
52
53
|
cont.children, rows = rows, []
|
53
54
|
table.children << cont
|
@@ -70,17 +71,32 @@ module Kramdown
|
|
70
71
|
has_footer = true
|
71
72
|
elsif @src.scan(TABLE_ROW_LINE)
|
72
73
|
trow = Element.new(:tr)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
|
75
|
+
# parse possible code spans on the line
|
76
|
+
env = save_env
|
77
|
+
reset_env(:src => StringScanner.new(@src[1] + ' '))
|
78
|
+
root = Element.new(:root)
|
79
|
+
parse_spans(root, nil, [:codespan])
|
80
|
+
restore_env(env)
|
81
|
+
|
82
|
+
# correctly split the line into cells
|
83
|
+
cells = []
|
84
|
+
root.children.each do |c|
|
85
|
+
if c.type == :raw_text
|
86
|
+
# Only on Ruby 1.9: f, *l = c.value.split(/(?<!\\)\|/).map {|t| t.gsub(/\\\|/, '|')}
|
87
|
+
f, *l = c.value.split(/\\\|/).map {|t| t.split(/\|/)}.inject([]) do |memo, t|
|
88
|
+
memo.last << "|" << t.shift if memo.size > 0
|
89
|
+
memo.concat(t)
|
90
|
+
end
|
91
|
+
(cells.empty? ? cells : cells.last) << f
|
92
|
+
cells.concat(l)
|
80
93
|
else
|
81
|
-
|
94
|
+
delim = (c.value.scan(/`+/).max || '') + '`'
|
95
|
+
tmp = "#{delim}#{' ' if delim.size > 1}#{c.value}#{' ' if delim.size > 1}#{delim}"
|
96
|
+
(cells.empty? ? cells : cells.last) << tmp
|
82
97
|
end
|
83
98
|
end
|
99
|
+
|
84
100
|
cells.shift if leading_pipe && cells.first.strip.empty?
|
85
101
|
cells.pop if cells.last.strip.empty?
|
86
102
|
cells.each do |cell_text|
|
@@ -100,9 +116,33 @@ module Kramdown
|
|
100
116
|
return false
|
101
117
|
end
|
102
118
|
|
119
|
+
# Parse all lines of the table with the code span parser
|
120
|
+
env = save_env
|
121
|
+
reset_env(:src => StringScanner.new(extract_string(orig_pos...(@src.pos-1), @src)))
|
122
|
+
root = Element.new(:root)
|
123
|
+
parse_spans(root, nil, [:codespan])
|
124
|
+
restore_env(env)
|
125
|
+
|
126
|
+
# Check if each line has at least one unescaped backslash that is not inside a code span
|
127
|
+
pipe_on_line = false
|
128
|
+
while (c = root.children.shift)
|
129
|
+
lines = c.value.split(/\n/)
|
130
|
+
if c.type == :codespan
|
131
|
+
if lines.size > 2 || (lines.size == 2 && !pipe_on_line)
|
132
|
+
break
|
133
|
+
elsif lines.size == 2 && pipe_on_line
|
134
|
+
pipe_on_line = false
|
135
|
+
end
|
136
|
+
else
|
137
|
+
break if lines.size > 1 && !pipe_on_line && lines.first !~ /^#{TABLE_PIPE_CHECK}/
|
138
|
+
pipe_on_line = (lines.size > 1 ? false : pipe_on_line) || (lines.last =~ /^#{TABLE_PIPE_CHECK}/)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
@src.pos = orig_pos and return false if !pipe_on_line
|
142
|
+
|
103
143
|
add_container.call(has_footer ? :tfoot : :tbody, false) if !rows.empty?
|
104
144
|
|
105
|
-
if !table.children.any? {|
|
145
|
+
if !table.children.any? {|el| el.type == :tbody}
|
106
146
|
warning("Found table without body - ignoring it")
|
107
147
|
@src.pos = orig_pos
|
108
148
|
return false
|
@@ -114,7 +154,6 @@ module Kramdown
|
|
114
154
|
(columns - row.children.length).times do
|
115
155
|
row.children << Element.new(:td)
|
116
156
|
end
|
117
|
-
row.children.each {|el| el.type = :th} if kind.type == :thead
|
118
157
|
end
|
119
158
|
end
|
120
159
|
if table.options[:alignment].length > columns
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown.
|
7
|
+
#
|
8
|
+
# kramdown is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
#++
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'kramdown/parser/kramdown'
|
24
|
+
|
25
|
+
module Kramdown
|
26
|
+
|
27
|
+
module Parser
|
28
|
+
|
29
|
+
# Used for parsing a document in Markdown format.
|
30
|
+
#
|
31
|
+
# This parser is based on the kramdown parser and removes the parser methods for the additional
|
32
|
+
# non-Markdown features. However, since some things are handled differently by the kramdown
|
33
|
+
# parser methods (like deciding when a list item contains just text), this parser differs from
|
34
|
+
# real Markdown parsers in some respects.
|
35
|
+
#
|
36
|
+
# Note, though, that the parser basically fails just one of the Markdown test cases (some others
|
37
|
+
# also fail but those failures are negligible).
|
38
|
+
class Markdown < Kramdown
|
39
|
+
|
40
|
+
# Array with all the parsing methods that should be removed from the standard kramdown parser.
|
41
|
+
EXTENDED = [:codeblock_fenced, :table, :definition_list, :footnote_definition, :abbrev_definition, :block_math,
|
42
|
+
:block_extensions,
|
43
|
+
:footnote_marker, :smart_quotes, :inline_math, :span_extensions, :typographic_syms]
|
44
|
+
|
45
|
+
def initialize(source, options) # :nodoc:
|
46
|
+
super
|
47
|
+
@block_parsers.delete_if {|i| EXTENDED.include?(i)}
|
48
|
+
@span_parsers.delete_if {|i| EXTENDED.include?(i)}
|
49
|
+
end
|
50
|
+
|
51
|
+
# :stopdoc:
|
52
|
+
|
53
|
+
BLOCK_BOUNDARY = /#{BLANK_LINE}|#{EOB_MARKER}|\Z/
|
54
|
+
BLOCKQUOTE_MATCH = /(^.*\n)+?(?=#{BLANK_LINE}|#{EOB_MARKER}|^#{OPT_SPACE}#{LAZY_END_HTML_STOP}|^#{OPT_SPACE}#{LAZY_END_HTML_START}|\Z)/
|
55
|
+
CODEBLOCK_MATCH = /(?:#{BLANK_LINE}?(?:#{INDENT}[ \t]*\S.*\n)+)*/
|
56
|
+
PARAGRAPH_MATCH = BLOCKQUOTE_MATCH
|
57
|
+
|
58
|
+
IAL_RAND_CHARS = (('a'..'z').to_a + ('0'..'9').to_a)
|
59
|
+
IAL_RAND_STRING = (1..20).collect {|a| IAL_RAND_CHARS[rand(IAL_RAND_CHARS.size)]}.join
|
60
|
+
LIST_ITEM_IAL = /^\s*(#{IAL_RAND_STRING})?\s*\n/
|
61
|
+
IAL_SPAN_START = LIST_ITEM_IAL
|
62
|
+
|
63
|
+
# :startdoc:
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/lib/kramdown/utils.rb
CHANGED
@@ -22,14 +22,14 @@
|
|
22
22
|
|
23
23
|
module Kramdown
|
24
24
|
|
25
|
-
# == Utils Module
|
25
|
+
# == \Utils Module
|
26
26
|
#
|
27
27
|
# This module contains utility class/modules/methods that can be used by both parsers and
|
28
28
|
# converters.
|
29
29
|
module Utils
|
30
30
|
|
31
31
|
autoload :Entities, 'kramdown/utils/entities'
|
32
|
-
autoload :
|
32
|
+
autoload :Html, 'kramdown/utils/html'
|
33
33
|
autoload :OrderedHash, 'kramdown/utils/ordered_hash'
|
34
34
|
|
35
35
|
end
|
@@ -24,16 +24,23 @@ module Kramdown
|
|
24
24
|
|
25
25
|
module Utils
|
26
26
|
|
27
|
+
# Provides convenience methods for handling named and numeric entities.
|
27
28
|
module Entities
|
28
29
|
|
30
|
+
# Represents an entity that has a +code_point+ and +name+.
|
29
31
|
class Entity < Struct.new(:code_point, :name)
|
30
32
|
|
33
|
+
# Return the UTF8 representation of the entity.
|
31
34
|
def char
|
32
35
|
[code_point].pack('U*') rescue nil
|
33
36
|
end
|
34
37
|
|
35
38
|
end
|
36
39
|
|
40
|
+
# Array of arrays. Each sub-array specifies a code point and the associated name.
|
41
|
+
#
|
42
|
+
# This table is not used directly -- Entity objects are automatically created from it and put
|
43
|
+
# into a Hash map when this file is loaded.
|
37
44
|
ENTITY_TABLE = [
|
38
45
|
[913, 'Alpha'],
|
39
46
|
[914, 'Beta'],
|
@@ -304,6 +311,8 @@ module Kramdown
|
|
304
311
|
[158, 382],
|
305
312
|
[159, 376],
|
306
313
|
]
|
314
|
+
|
315
|
+
# Contains the mapping of code point (or name) to the actual Entity object.
|
307
316
|
ENTITY_MAP = Hash.new do |h,k|
|
308
317
|
if k.kind_of?(Integer)
|
309
318
|
h[k] = Entity.new(k, nil)
|
@@ -320,7 +329,7 @@ module Kramdown
|
|
320
329
|
end
|
321
330
|
end
|
322
331
|
|
323
|
-
# Return the entity for the given +point_or_name+.
|
332
|
+
# Return the entity for the given code point or name +point_or_name+.
|
324
333
|
def entity(point_or_name)
|
325
334
|
ENTITY_MAP[point_or_name]
|
326
335
|
end
|
data/lib/kramdown/utils/html.rb
CHANGED
@@ -24,27 +24,36 @@ module Kramdown
|
|
24
24
|
|
25
25
|
module Utils
|
26
26
|
|
27
|
-
|
27
|
+
# Provides convenience methods for HTML related tasks.
|
28
|
+
#
|
29
|
+
# *Note* that this module has to be mixed into a class that has a <tt>@root</tt> (containing an
|
30
|
+
# element of type :root) and an <tt>@options</tt> (containing an options hash) instance variable
|
31
|
+
# so that some of the methods can work correctly.
|
32
|
+
module Html
|
28
33
|
|
29
|
-
# Convert the
|
34
|
+
# Convert the entity +e+ to a string. The optional parameter +original+ may contain the
|
35
|
+
# original representation of the entity.
|
36
|
+
#
|
37
|
+
# This method uses the option +entity_output+ to determine the output form for the entity.
|
30
38
|
def entity_to_str(e, original = nil)
|
31
|
-
if RUBY_VERSION >= '1.9' && @
|
32
|
-
(c = e.char.encode(@
|
39
|
+
if RUBY_VERSION >= '1.9' && @options[:entity_output] == :as_char &&
|
40
|
+
(c = e.char.encode(@root.options[:encoding]) rescue nil) && !ESCAPE_MAP.has_key?(c)
|
33
41
|
c
|
34
|
-
elsif (@
|
42
|
+
elsif (@options[:entity_output] == :as_input || @options[:entity_output] == :as_char) && original
|
35
43
|
original
|
36
|
-
elsif @
|
44
|
+
elsif @options[:entity_output] == :numeric || e.name.nil?
|
37
45
|
"&##{e.code_point};"
|
38
46
|
else
|
39
47
|
"&#{e.name};"
|
40
48
|
end
|
41
49
|
end
|
42
50
|
|
43
|
-
# Return the
|
44
|
-
def html_attributes(
|
45
|
-
|
51
|
+
# Return the HTML representation of the attributes +attr+.
|
52
|
+
def html_attributes(attr)
|
53
|
+
attr.map {|k,v| v.nil? ? '' : " #{k}=\"#{escape_html(v.to_s, :attribute)}\"" }.join('')
|
46
54
|
end
|
47
55
|
|
56
|
+
# :stopdoc:
|
48
57
|
ESCAPE_MAP = {
|
49
58
|
'<' => '<',
|
50
59
|
'>' => '>',
|
@@ -59,11 +68,13 @@ module Kramdown
|
|
59
68
|
:text => ESCAPE_TEXT_RE,
|
60
69
|
:attribute => ESCAPE_ATTRIBUTE_RE
|
61
70
|
}
|
71
|
+
# :startdoc:
|
62
72
|
|
63
73
|
# Escape the special HTML characters in the string +str+. The parameter +type+ specifies what
|
64
74
|
# is escaped: <tt>:all</tt> - all special HTML characters as well as entities, <tt>:text</tt>
|
65
|
-
#
|
66
|
-
# <tt>:attribute</tt> - all special HTML characters including the quotation mark but no
|
75
|
+
# \- all special HTML characters except the quotation mark but no entities and
|
76
|
+
# <tt>:attribute</tt> - all special HTML characters including the quotation mark but no
|
77
|
+
# entities.
|
67
78
|
def escape_html(str, type = :all)
|
68
79
|
str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m}
|
69
80
|
end
|
@@ -24,54 +24,58 @@ module Kramdown
|
|
24
24
|
|
25
25
|
module Utils
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
@data, @order = hash.instance_eval { [@data.dup, @order.dup] }
|
43
|
-
else
|
44
|
-
@data = hash || {}
|
45
|
-
@order = @data.keys
|
27
|
+
if RUBY_VERSION < '1.9'
|
28
|
+
|
29
|
+
# A partial hash implementation which preserves the insertion order of the keys.
|
30
|
+
#
|
31
|
+
# *Note* that this class is only used on Ruby 1.8 since the built-in Hash on Ruby 1.9
|
32
|
+
# automatically preserves the insertion order. However, to remain compatibility only the
|
33
|
+
# methods defined in this class may be used when working with OrderedHash on Ruby 1.9.
|
34
|
+
class OrderedHash
|
35
|
+
|
36
|
+
include Enumerable
|
37
|
+
|
38
|
+
# Initialize the OrderedHash object.
|
39
|
+
def initialize
|
40
|
+
@data = {}
|
41
|
+
@order = []
|
46
42
|
end
|
47
|
-
end
|
48
43
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
# Iterate over the stored keys in insertion order.
|
45
|
+
def each
|
46
|
+
@order.each {|k| yield(k, @data[k])}
|
47
|
+
end
|
53
48
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
49
|
+
# Return the value for the +key+.
|
50
|
+
def [](key)
|
51
|
+
@data[key]
|
52
|
+
end
|
58
53
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
# Set the value for the +key+ to +val+.
|
55
|
+
def []=(key, val)
|
56
|
+
@order << key if !@data.has_key?(key)
|
57
|
+
@data[key] = val
|
58
|
+
end
|
64
59
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
# Delete the +key+.
|
61
|
+
def delete(key)
|
62
|
+
@order.delete(key)
|
63
|
+
@data.delete(key)
|
64
|
+
end
|
65
|
+
|
66
|
+
def merge!(other)
|
67
|
+
other.each {|k,v| self[k] = v}
|
68
|
+
self
|
69
|
+
end
|
70
|
+
|
71
|
+
def inspect #:nodoc:
|
72
|
+
"{" + map {|k,v| "#{k.inspect}=>#{v.inspect}"}.join(" ") + "}"
|
73
|
+
end
|
70
74
|
|
71
|
-
def inspect #:nodoc:
|
72
|
-
"{" + map {|k,v| "#{k.inspect}=>#{v.inspect}"}.join(" ") + "}"
|
73
75
|
end
|
74
76
|
|
77
|
+
else
|
78
|
+
OrderedHash = Hash
|
75
79
|
end
|
76
80
|
|
77
81
|
end
|
data/lib/kramdown/version.rb
CHANGED
data/man/man1/kramdown.1
CHANGED
@@ -88,7 +88,7 @@ Used by: HTML/Latex converter
|
|
88
88
|
Process kramdown syntax in block HTML tags
|
89
89
|
|
90
90
|
If this option is `true`, the kramdown parser processes the content of
|
91
|
-
block HTML tags as text containing block
|
91
|
+
block HTML tags as text containing block-level elements. Since this is
|
92
92
|
not wanted normally, the default is `false`. It is normally better to
|
93
93
|
selectively enable kramdown processing via the markdown attribute.
|
94
94
|
|
@@ -102,7 +102,7 @@ Used by: kramdown parser
|
|
102
102
|
Process kramdown syntax in span HTML tags
|
103
103
|
|
104
104
|
If this option is `true`, the kramdown parser processes the content of
|
105
|
-
span HTML tags as text containing span
|
105
|
+
span HTML tags as text containing span-level elements.
|
106
106
|
|
107
107
|
Default: true
|
108
108
|
Used by: kramdown parser
|
@@ -217,11 +217,26 @@ Used by: HTML converter, kramdown converter
|
|
217
217
|
.TP
|
218
218
|
.B \-\-toc-depth ARG
|
219
219
|
|
220
|
-
Defines the maximum level of headers which will be used to generate the table of
|
220
|
+
DEPRECATED: Defines the maximum level of headers which will be used to generate the table of
|
221
221
|
contents. For instance, with a value of 2, toc entries will be generated for h1
|
222
222
|
and h2 headers but not for h3, h4, etc. A value of 0 uses all header levels.
|
223
223
|
|
224
|
-
|
224
|
+
Use option toc_levels instead!
|
225
|
+
|
226
|
+
Default: -1
|
227
|
+
Used by: HTML/Latex converter
|
228
|
+
|
229
|
+
|
230
|
+
.TP
|
231
|
+
.B \-\-toc-levels ARG
|
232
|
+
|
233
|
+
Defines the levels that are used for the table of contents
|
234
|
+
|
235
|
+
The individual levels can be specified by separating them with commas
|
236
|
+
(e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
|
237
|
+
specified levels are used for the table of contents.
|
238
|
+
|
239
|
+
Default: 1..6
|
225
240
|
Used by: HTML/Latex converter
|
226
241
|
|
227
242
|
|
@@ -234,6 +249,18 @@ Default: 72
|
|
234
249
|
Used by: kramdown converter
|
235
250
|
|
236
251
|
|
252
|
+
.TP
|
253
|
+
.B \-\-latex-headers ARG
|
254
|
+
|
255
|
+
Defines the LaTeX commands for different header levels
|
256
|
+
|
257
|
+
The commands for the header levels one to six can be specified by
|
258
|
+
separating them with commas.
|
259
|
+
|
260
|
+
Default: section,subsection,subsubsection,paragraph,subparagraph,subsubparagraph
|
261
|
+
Used by: Latex converter
|
262
|
+
|
263
|
+
|
237
264
|
.SH EXIT STATUS
|
238
265
|
The exit status is 0 if no error happened. Otherwise it is 1.
|
239
266
|
.SH SEE ALSO
|