kramdown 0.14.2 → 1.0.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 +15 -0
- data/CONTRIBUTERS +2 -1
- data/COPYING +17 -11
- data/README.md +12 -1
- data/Rakefile +8 -26
- data/VERSION +1 -1
- data/benchmark/testing.sh +4 -1
- data/bin/kramdown +2 -15
- data/doc/index.page +2 -3
- data/doc/news.feed +0 -1
- data/doc/sidebar.template +2 -2
- data/doc/syntax.page +1 -1
- data/doc/tests.page +3 -3
- data/lib/kramdown.rb +2 -15
- data/lib/kramdown/compatibility.rb +2 -15
- data/lib/kramdown/converter.rb +2 -15
- data/lib/kramdown/converter/base.rb +5 -15
- data/lib/kramdown/converter/html.rb +4 -17
- data/lib/kramdown/converter/kramdown.rb +2 -15
- data/lib/kramdown/converter/latex.rb +2 -15
- data/lib/kramdown/converter/remove_html_tags.rb +2 -15
- data/lib/kramdown/converter/toc.rb +2 -15
- data/lib/kramdown/document.rb +3 -16
- data/lib/kramdown/element.rb +2 -15
- data/lib/kramdown/error.rb +2 -15
- data/lib/kramdown/options.rb +18 -16
- data/lib/kramdown/parser.rb +2 -15
- data/lib/kramdown/parser/base.rb +6 -15
- data/lib/kramdown/parser/html.rb +6 -20
- data/lib/kramdown/parser/kramdown.rb +2 -15
- data/lib/kramdown/parser/kramdown/abbreviation.rb +7 -17
- data/lib/kramdown/parser/kramdown/autolink.rb +2 -15
- data/lib/kramdown/parser/kramdown/blank_line.rb +2 -15
- data/lib/kramdown/parser/kramdown/block_boundary.rb +2 -15
- data/lib/kramdown/parser/kramdown/blockquote.rb +2 -15
- data/lib/kramdown/parser/kramdown/codeblock.rb +2 -15
- data/lib/kramdown/parser/kramdown/codespan.rb +2 -15
- data/lib/kramdown/parser/kramdown/emphasis.rb +2 -15
- data/lib/kramdown/parser/kramdown/eob.rb +2 -15
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +2 -15
- data/lib/kramdown/parser/kramdown/extensions.rb +5 -16
- data/lib/kramdown/parser/kramdown/footnote.rb +2 -15
- data/lib/kramdown/parser/kramdown/header.rb +3 -16
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +2 -15
- data/lib/kramdown/parser/kramdown/html.rb +2 -15
- data/lib/kramdown/parser/kramdown/html_entity.rb +2 -15
- data/lib/kramdown/parser/kramdown/line_break.rb +2 -15
- data/lib/kramdown/parser/kramdown/link.rb +2 -15
- data/lib/kramdown/parser/kramdown/list.rb +2 -15
- data/lib/kramdown/parser/kramdown/math.rb +2 -15
- data/lib/kramdown/parser/kramdown/paragraph.rb +2 -15
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +3 -45
- data/lib/kramdown/parser/kramdown/table.rb +2 -15
- data/lib/kramdown/parser/kramdown/typographic_symbol.rb +2 -15
- data/lib/kramdown/parser/markdown.rb +2 -15
- data/lib/kramdown/utils.rb +3 -15
- data/lib/kramdown/utils/entities.rb +2 -15
- data/lib/kramdown/utils/html.rb +7 -19
- data/lib/kramdown/utils/ordered_hash.rb +2 -15
- data/lib/kramdown/utils/unidecoder.rb +43 -0
- data/lib/kramdown/version.rb +3 -16
- data/man/man1/kramdown.1 +14 -0
- data/test/run_tests.rb +2 -15
- data/test/test_files.rb +20 -23
- data/test/testcases/block/04_header/atx_header.html +2 -0
- data/test/testcases/block/04_header/atx_header.text +3 -1
- data/test/testcases/block/04_header/with_auto_ids.html +2 -0
- data/test/testcases/block/04_header/with_auto_ids.options +1 -0
- data/test/testcases/block/04_header/with_auto_ids.text +2 -0
- data/test/testcases/block/12_extension/options.html +2 -2
- data/test/testcases/block/12_extension/options2.html +2 -2
- data/test/testcases/block/14_table/table_with_footnote.html +2 -2
- data/test/testcases/block/16_toc/toc_with_footnotes.html +2 -2
- data/test/testcases/span/04_footnote/footnote_nr.html +3 -3
- data/test/testcases/span/04_footnote/markers.html +10 -10
- data/test/testcases/span/abbreviations/abbrev.html +11 -0
- data/test/testcases/span/abbreviations/abbrev.text +9 -0
- data/test/testcases/span/text_substitutions/entities_as_char.html +1 -1
- data/test/testcases/span/text_substitutions/entities_as_char.html.19 +1 -1
- data/test/testcases/span/text_substitutions/entities_as_char.options +1 -0
- data/test/testcases/span/text_substitutions/entities_as_char.text +1 -1
- metadata +8 -12
- data/ChangeLog +0 -7436
- data/GPL +0 -674
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
data/lib/kramdown/document.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
# = kramdown
|
@@ -46,7 +33,7 @@
|
|
46
33
|
#
|
47
34
|
# == License
|
48
35
|
#
|
49
|
-
#
|
36
|
+
# MIT - see the COPYING file.
|
50
37
|
|
51
38
|
|
52
39
|
require 'kramdown/compatibility'
|
data/lib/kramdown/element.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
data/lib/kramdown/error.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
data/lib/kramdown/options.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -61,6 +48,7 @@ module Kramdown
|
|
61
48
|
# suffices. A block needs to be specified when using type 'Object' and it has to cope with
|
62
49
|
# a value given as string and as the opaque type.
|
63
50
|
def self.define(name, type, default, desc, &block)
|
51
|
+
name = name.to_sym
|
64
52
|
raise ArgumentError, "Option name #{name} is already used" if @options.has_key?(name)
|
65
53
|
raise ArgumentError, "Invalid option type #{type} specified" if !ALLOWED_TYPES.include?(type)
|
66
54
|
raise ArgumentError, "Invalid type for default value" if !(type === default) && !default.nil?
|
@@ -75,7 +63,7 @@ module Kramdown
|
|
75
63
|
|
76
64
|
# Return +true+ if an option called +name+ is defined.
|
77
65
|
def self.defined?(name)
|
78
|
-
@options.has_key?(name)
|
66
|
+
@options.has_key?(name.to_sym)
|
79
67
|
end
|
80
68
|
|
81
69
|
# Return a Hash with the default values for all options.
|
@@ -90,6 +78,7 @@ module Kramdown
|
|
90
78
|
def self.merge(hash)
|
91
79
|
temp = defaults
|
92
80
|
hash.each do |k,v|
|
81
|
+
k = k.to_sym
|
93
82
|
next unless @options.has_key?(k)
|
94
83
|
temp[k] = parse(k, v)
|
95
84
|
end
|
@@ -102,6 +91,7 @@ module Kramdown
|
|
102
91
|
# If +data+ already has the correct type, it is just returned. Otherwise it is converted to a
|
103
92
|
# String and then to the correct type.
|
104
93
|
def self.parse(name, data)
|
94
|
+
name = name.to_sym
|
105
95
|
raise ArgumentError, "No option named #{name} defined" if !@options.has_key?(name)
|
106
96
|
if !(@options[name].type === data)
|
107
97
|
data = data.to_s
|
@@ -196,6 +186,18 @@ contain characters that are valid in an ID!
|
|
196
186
|
|
197
187
|
Default: ''
|
198
188
|
Used by: HTML/Latex converter
|
189
|
+
EOF
|
190
|
+
|
191
|
+
define(:transliterated_header_ids, Boolean, false, <<EOF)
|
192
|
+
Transliterate the header text before generating the ID
|
193
|
+
|
194
|
+
Only ASCII characters are used in headers IDs. This is not good for
|
195
|
+
languages with many non-ASCII characters. By enabling this option
|
196
|
+
the header text is transliterated to ASCII as good as possible so that
|
197
|
+
the resulting header ID is more useful.
|
198
|
+
|
199
|
+
Default: false
|
200
|
+
Used by: HTML/Latex converter
|
199
201
|
EOF
|
200
202
|
|
201
203
|
define(:parse_block_html, Boolean, false, <<EOF)
|
data/lib/kramdown/parser.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
data/lib/kramdown/parser/base.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -98,6 +85,10 @@ module Kramdown
|
|
98
85
|
# Modify the string +source+ to be usable by the parser (unifies line ending characters to
|
99
86
|
# +\n+ and makes sure +source+ ends with a new line character).
|
100
87
|
def adapt_source(source)
|
88
|
+
if source.respond_to?(:encode!)
|
89
|
+
raise "The encoding of the source text is not valid!" if !source.valid_encoding?
|
90
|
+
source.encode!('UTF-8')
|
91
|
+
end
|
101
92
|
source.gsub(/\r\n?/, "\n").chomp + "\n"
|
102
93
|
end
|
103
94
|
|
data/lib/kramdown/parser/html.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -384,14 +371,13 @@ module Kramdown
|
|
384
371
|
if c.type == :text
|
385
372
|
mem << c.value
|
386
373
|
elsif c.type == :entity
|
387
|
-
|
388
|
-
if value_char.respond_to?(:encode)
|
389
|
-
mem << value_char.encode(@root.options[:encoding])
|
390
|
-
elsif [60, 62, 34, 38].include?(c.value.code_point)
|
374
|
+
if [60, 62, 34, 38].include?(c.value.code_point)
|
391
375
|
mem << c.value.code_point.chr
|
376
|
+
else
|
377
|
+
mem << c.value.char
|
392
378
|
end
|
393
379
|
elsif c.type == :smart_quote || c.type == :typographic_sym
|
394
|
-
mem << entity(c.value.to_s).char
|
380
|
+
mem << entity(c.value.to_s).char
|
395
381
|
else
|
396
382
|
raise "Bug - please report"
|
397
383
|
end
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|
@@ -52,8 +39,11 @@ module Kramdown
|
|
52
39
|
result = []
|
53
40
|
strscan = StringScanner.new(child.value)
|
54
41
|
while temp = strscan.scan_until(regexps.last)
|
55
|
-
|
56
|
-
abbr
|
42
|
+
abbr = strscan.scan(regexps.first) # begin of line case of abbr with \W char as first one
|
43
|
+
if abbr.nil?
|
44
|
+
temp << strscan.scan(/\W|^/)
|
45
|
+
abbr = strscan.scan(regexps.first)
|
46
|
+
end
|
57
47
|
result << Element.new(:text, temp) << Element.new(:abbreviation, abbr)
|
58
48
|
end
|
59
49
|
result << Element.new(:text, strscan.rest)
|
@@ -1,22 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
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/>.
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
20
7
|
#++
|
21
8
|
#
|
22
9
|
|