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,55 +1,13 @@
|
|
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
|
#--
|
23
|
-
# Parts of this file are based on code from
|
24
|
-
# The needed license statements follow:
|
25
|
-
#
|
26
|
-
# Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
|
27
|
-
#
|
28
|
-
# Maruku is free software; you can redistribute it and/or modify
|
29
|
-
# it under the terms of the GNU General Public License as published by
|
30
|
-
# the Free Software Foundation; either version 2 of the License, or
|
31
|
-
# (at your option) any later version.
|
32
|
-
#
|
33
|
-
# Maruku is distributed in the hope that it will be useful,
|
34
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
35
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
36
|
-
# GNU General Public License for more details.
|
37
|
-
#
|
38
|
-
# You should have received a copy of the GNU General Public License
|
39
|
-
# along with Maruku; if not, write to the Free Software
|
40
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
41
|
-
#
|
42
|
-
# NOTA BENE:
|
43
|
-
#
|
44
|
-
# The following algorithm is a rip-off of RubyPants written by
|
45
|
-
# Christian Neukirchen.
|
46
|
-
#
|
47
|
-
# RubyPants is a Ruby port of SmartyPants written by John Gruber.
|
48
|
-
#
|
49
|
-
# This file is distributed under the GPL, which I guess is compatible
|
50
|
-
# with the terms of the RubyPants license.
|
51
|
-
#
|
52
|
-
# -- Andrea Censi
|
10
|
+
# Parts of this file are based on code from RubyPants:
|
53
11
|
#
|
54
12
|
# = RubyPants -- SmartyPants ported to Ruby
|
55
13
|
#
|
@@ -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/utils.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
|
|
@@ -31,6 +18,7 @@ module Kramdown
|
|
31
18
|
autoload :Entities, 'kramdown/utils/entities'
|
32
19
|
autoload :Html, 'kramdown/utils/html'
|
33
20
|
autoload :OrderedHash, 'kramdown/utils/ordered_hash'
|
21
|
+
autoload :Unidecoder, 'kramdown/utils/unidecoder'
|
34
22
|
|
35
23
|
# Treat +name+ as if it were snake cased (e.g. snake_case) and camelize it (e.g. SnakeCase).
|
36
24
|
def self.camelize(name)
|
@@ -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/utils/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
|
|
@@ -39,7 +26,8 @@ module Kramdown
|
|
39
26
|
entity_output = @options[:entity_output]
|
40
27
|
|
41
28
|
if e.char.respond_to?(:encoding) && entity_output == :as_char &&
|
42
|
-
(c = e.char.encode(@root.options[:encoding]) rescue nil) &&
|
29
|
+
(c = e.char.encode(@root.options[:encoding]) rescue nil) &&
|
30
|
+
((c = e.char) == '"' || !ESCAPE_MAP.has_key?(c))
|
43
31
|
c
|
44
32
|
elsif (entity_output == :as_input || entity_output == :as_char) && original
|
45
33
|
original
|
@@ -73,9 +61,9 @@ module Kramdown
|
|
73
61
|
# :startdoc:
|
74
62
|
|
75
63
|
# Escape the special HTML characters in the string +str+. The parameter +type+ specifies what
|
76
|
-
# is escaped: :all - all special HTML characters
|
77
|
-
# characters except the quotation mark but no entities and
|
78
|
-
# characters including the quotation mark but no entities.
|
64
|
+
# is escaped: :all - all special HTML characters except the quotation mark as well as
|
65
|
+
# entities, :text - all special HTML characters except the quotation mark but no entities and
|
66
|
+
# :attribute - all special HTML characters including the quotation mark but no entities.
|
79
67
|
def escape_html(str, type = :all)
|
80
68
|
str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m}
|
81
69
|
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
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
9
|
+
# This file is based on code originally from the Stringex library and needs the data files from
|
10
|
+
# Stringex to work correctly.
|
11
|
+
|
12
|
+
module Kramdown
|
13
|
+
module Utils
|
14
|
+
|
15
|
+
# Provides the ability to tranliterate Unicode strings into plain ASCII ones.
|
16
|
+
module Unidecoder
|
17
|
+
|
18
|
+
if RUBY_VERSION <= '1.8.6'
|
19
|
+
def self.decode(string)
|
20
|
+
string
|
21
|
+
end
|
22
|
+
else
|
23
|
+
|
24
|
+
require 'stringex/unidecoder' # dummy require so that we can get at the data files
|
25
|
+
|
26
|
+
# Transliterate string from Unicode into ASCII.
|
27
|
+
def self.decode(string)
|
28
|
+
string.gsub(/[^\x00-\x7f]/u) do |codepoint|
|
29
|
+
begin
|
30
|
+
unpacked = codepoint.unpack("U")[0]
|
31
|
+
Stringex::Unidecoder::CODEPOINTS["x%02x" % (unpacked >> 8)][unpacked & 255]
|
32
|
+
rescue
|
33
|
+
"?"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/lib/kramdown/version.rb
CHANGED
@@ -1,28 +1,15 @@
|
|
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
|
|
23
10
|
module Kramdown
|
24
11
|
|
25
12
|
# The kramdown version.
|
26
|
-
VERSION = '0.
|
13
|
+
VERSION = '1.0.0'
|
27
14
|
|
28
15
|
end
|
data/man/man1/kramdown.1
CHANGED
@@ -83,6 +83,20 @@ Default: ''
|
|
83
83
|
Used by: HTML/Latex converter
|
84
84
|
|
85
85
|
|
86
|
+
.TP
|
87
|
+
.B \-\-[no\-]transliterated-header-ids
|
88
|
+
|
89
|
+
Transliterate the header text before generating the ID
|
90
|
+
|
91
|
+
Only ASCII characters are used in headers IDs. This is not good for
|
92
|
+
languages with many non-ASCII characters. By enabling this option
|
93
|
+
the header text is transliterated to ASCII as good as possible so that
|
94
|
+
the resulting header ID is more useful.
|
95
|
+
|
96
|
+
Default: false
|
97
|
+
Used by: HTML/Latex converter
|
98
|
+
|
99
|
+
|
86
100
|
.TP
|
87
101
|
.B \-\-[no\-]parse-block-html
|
88
102
|
|
data/test/run_tests.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/test/test_files.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
|
|
@@ -29,8 +16,12 @@ Encoding.default_external = 'utf-8' if RUBY_VERSION >= '1.9'
|
|
29
16
|
|
30
17
|
class TestFiles < Test::Unit::TestCase
|
31
18
|
|
19
|
+
EXCLUDE_KD_FILES = [('test/testcases/block/04_header/with_auto_ids.text' if RUBY_VERSION <= '1.8.6'), # bc of dep stringex not working
|
20
|
+
].compact
|
21
|
+
|
32
22
|
# Generate test methods for kramdown-to-xxx conversion
|
33
23
|
Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
|
24
|
+
next if EXCLUDE_KD_FILES.any? {|f| text_file =~ /#{f}$/}
|
34
25
|
basename = text_file.sub(/\.text$/, '')
|
35
26
|
opts_file = text_file.sub(/\.text$/, '.options')
|
36
27
|
(Dir[basename + ".*"] - [text_file, opts_file]).each do |output_file|
|
@@ -58,11 +49,13 @@ class TestFiles < Test::Unit::TestCase
|
|
58
49
|
'test/testcases/block/04_header/with_auto_ids.html', # bc of auto_ids=true option
|
59
50
|
'test/testcases/block/04_header/header_type_offset.html', # bc of header_offset option
|
60
51
|
]
|
61
|
-
Dir[File.dirname(__FILE__) + '/testcases/**/*.{html,
|
62
|
-
next if EXCLUDE_HTML_FILES.any? {|f| html_file =~ /#{f}
|
63
|
-
|
52
|
+
Dir[File.dirname(__FILE__) + '/testcases/**/*.{html,html.19,htmlinput,htmlinput.19}'].each do |html_file|
|
53
|
+
next if EXCLUDE_HTML_FILES.any? {|f| html_file =~ /#{f}(\.19)?$/}
|
54
|
+
next if (RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')) ||
|
55
|
+
(RUBY_VERSION < '1.9' && html_file =~ /\.19$/)
|
56
|
+
out_file = (html_file =~ /\.htmlinput(\.19)?$/ ? html_file.sub(/input(\.19)?$/, '') : html_file)
|
64
57
|
define_method('test_' + html_file.tr('.', '_') + "_to_html") do
|
65
|
-
opts_file = html_file.sub(/\.html
|
58
|
+
opts_file = html_file.sub(/\.html(input)?(\.19)?$/, '.options')
|
66
59
|
opts_file = File.join(File.dirname(html_file), 'options') if !File.exist?(opts_file)
|
67
60
|
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :footnote_nr => 1}
|
68
61
|
doc = Kramdown::Document.new(File.read(html_file), options.merge(:input => 'html'))
|
@@ -125,7 +118,8 @@ class TestFiles < Test::Unit::TestCase
|
|
125
118
|
'test/testcases/block/11_ial/simple.text', # bc of change of ordering of attributes in header
|
126
119
|
'test/testcases/span/extension/comment.text', # bc of comment text modifications (can this be avoided?)
|
127
120
|
'test/testcases/block/04_header/header_type_offset.text', # bc of header_offset being applied twice
|
128
|
-
|
121
|
+
('test/testcases/block/04_header/with_auto_ids.text' if RUBY_VERSION <= '1.8.6'), # bc of dep stringex not working
|
122
|
+
].compact
|
129
123
|
Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
|
130
124
|
next if EXCLUDE_TEXT_FILES.any? {|f| text_file =~ /#{f}$/}
|
131
125
|
define_method('test_' + text_file.tr('.', '_') + "_to_kramdown_to_html") do
|
@@ -158,12 +152,15 @@ class TestFiles < Test::Unit::TestCase
|
|
158
152
|
'test/testcases/block/04_header/with_auto_ids.html', # bc of auto_ids=true option
|
159
153
|
'test/testcases/block/04_header/header_type_offset.html', # bc of header_offset option
|
160
154
|
'test/testcases/block/16_toc/toc_exclude.html', # bc of different attribute ordering
|
155
|
+
'test/testcases/span/autolinks/url_links.html', # bc of quot entity being converted to char
|
161
156
|
]
|
162
|
-
Dir[File.dirname(__FILE__) + '/testcases/**/*.html'].each do |html_file|
|
163
|
-
next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}
|
157
|
+
Dir[File.dirname(__FILE__) + '/testcases/**/*.{html,html.19}'].each do |html_file|
|
158
|
+
next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}(\.19)?$/}
|
159
|
+
next if (RUBY_VERSION >= '1.9' && File.exist?(html_file + '.19')) ||
|
160
|
+
(RUBY_VERSION < '1.9' && html_file =~ /\.19$/)
|
164
161
|
define_method('test_' + html_file.tr('.', '_') + "_to_kramdown_to_html") do
|
165
162
|
kd = Kramdown::Document.new(File.read(html_file), :input => 'html', :auto_ids => false, :footnote_nr => 1).to_kramdown
|
166
|
-
opts_file = html_file.sub(/\.html
|
163
|
+
opts_file = html_file.sub(/\.html(\.19)?$/, '.options')
|
167
164
|
opts_file = File.join(File.dirname(html_file), 'options') if !File.exist?(opts_file)
|
168
165
|
options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :footnote_nr => 1}
|
169
166
|
doc = Kramdown::Document.new(kd, options)
|