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
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OGVjNDY0Nzc3OTdiZjA1Yzg2MTEwZWJjMGE2NjllNjJiYzk4OTk5OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzNlYWRiNGEyZjg2OTA0ZjA2Zjk3MmFlYTRkYzk4ZTBjNmE2ZTc0OQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGRmZGQ1NjUwOWNlYzM0NjIyZDczNTliYWE0OGM1NjQwYTdkN2VkY2Y4MDIz
|
10
|
+
YTMwZjE1ZTYyNDAyNDlkZTc2ZjdhZDJjNWVlYmZiZTFlZTRkMzE0MjZhMmM1
|
11
|
+
ZDljMzJkNzQyZGM4NzFiMDQ3MTIwMjBhZWRkOTg0ZjhiNjAwNjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDg2ZDA4MDc2ZjMxYmZlNzk4NDk4YzI4MTM5ZTAyZjYwNTk4ZTNmNjFjNGE2
|
14
|
+
ZmEyZDU4OTRiYjc2MjU4NTEyZTAwMTA0MTJiNGI2NmNmNGRjZDFlMDI3M2Nl
|
15
|
+
Y2RhZmJiNDBkZTM0ZjMzYzk2N2U3YmViNDVkY2YxMjE2MDJlNDg=
|
data/CONTRIBUTERS
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Count Name
|
2
2
|
======= ====
|
3
|
-
|
3
|
+
571 Thomas Leitner <t_leitner@gmx.at>
|
4
4
|
6 Gioele Barabucci <gioele@svario.it>
|
5
5
|
3 gettalong <t_leitner@gmx.at>
|
6
6
|
3 Ben Armston <ben.armston@googlemail.com>
|
@@ -9,6 +9,7 @@
|
|
9
9
|
1 tomykaira <tomykaira@gmail.com>
|
10
10
|
1 Tim Bates <tim@rumpuslabs.com>
|
11
11
|
1 Postmodern <postmodern.mod3@gmail.com>
|
12
|
+
1 myqlarson <myqlarson@gmail.com>
|
12
13
|
1 Michal Till <michal.till@gmail.com>
|
13
14
|
1 John Croisant <jacius@gmail.com>
|
14
15
|
1 Joe Fiorini <joe@faithfulgeek.org>
|
data/COPYING
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
kramdown - fast, pure-Ruby Markdown-superset converter
|
2
|
-
Copyright (C) 2009 Thomas Leitner <t_leitner@gmx.at>
|
2
|
+
Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
5
|
+
copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
GNU General Public License for more details.
|
12
|
+
The above copyright notice and this permission notice shall be included
|
13
|
+
in all copies or substantial portions of the Software.
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
16
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
18
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
19
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
20
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
21
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
16
22
|
|
17
23
|
|
18
24
|
Some test cases and the benchmark files are based on test cases from
|
data/README.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# kramdown
|
2
2
|
|
3
|
+
## Readme first!
|
4
|
+
|
5
|
+
kramdown was originally licensed under the GPL until the 1.0.0 release. However, due to the many
|
6
|
+
requests it is now released under the MIT license and therefore can easily be used in commercial
|
7
|
+
projects, too.
|
8
|
+
|
9
|
+
However, if you use kramdown in a commerical setting, please consider **contributing back any
|
10
|
+
changes** for the benefit of the community and/or **making a donation** (see the links in the
|
11
|
+
sidebar on the [kramdown homepage](http://kramdown.rubyforge.org/)!
|
12
|
+
|
13
|
+
|
3
14
|
## Introduction
|
4
15
|
|
5
16
|
kramdown is yet-another-markdown-parser but fast, pure Ruby, using a strict syntax definition and
|
@@ -47,4 +58,4 @@ probably want to install `rake` so that you can use the provided rake tasks. Asi
|
|
47
58
|
|
48
59
|
## License
|
49
60
|
|
50
|
-
|
61
|
+
MIT - see the **COPYING** file.
|
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ begin
|
|
26
26
|
require 'kramdown/options'
|
27
27
|
|
28
28
|
# Add options documentation to Kramdown::Options module
|
29
|
-
opt_module =
|
29
|
+
opt_module = @store.all_classes_and_modules.find {|m| m.full_name == 'Kramdown::Options'}
|
30
30
|
opt_defs = Kramdown::Options.definitions.sort.collect do |n, definition|
|
31
31
|
desc = definition.desc.split(/\n/).map {|l| " #{l}"}
|
32
32
|
desc[-2] = []
|
@@ -125,8 +125,8 @@ EOF
|
|
125
125
|
PKG_FILES = FileList.new([
|
126
126
|
'Rakefile',
|
127
127
|
'setup.rb',
|
128
|
-
'COPYING', '
|
129
|
-
'VERSION', '
|
128
|
+
'COPYING', 'README.md', 'AUTHORS',
|
129
|
+
'VERSION', 'CONTRIBUTERS',
|
130
130
|
'bin/*',
|
131
131
|
'benchmark/*',
|
132
132
|
'lib/**/*.rb',
|
@@ -142,12 +142,6 @@ EOF
|
|
142
142
|
File.open('VERSION', 'w+') {|file| file.write(Kramdown::VERSION + "\n")}
|
143
143
|
end
|
144
144
|
|
145
|
-
CLOBBER << 'ChangeLog'
|
146
|
-
file 'ChangeLog' do
|
147
|
-
puts "Generating ChangeLog file"
|
148
|
-
`git log --name-only > ChangeLog`
|
149
|
-
end
|
150
|
-
|
151
145
|
CLOBBER << 'CONTRIBUTERS'
|
152
146
|
file 'CONTRIBUTERS' do
|
153
147
|
puts "Generating CONTRIBUTERS file"
|
@@ -178,6 +172,7 @@ EOF
|
|
178
172
|
s.version = Kramdown::VERSION
|
179
173
|
s.summary = SUMMARY
|
180
174
|
s.description = DESCRIPTION
|
175
|
+
s.license = 'MIT'
|
181
176
|
|
182
177
|
#### Dependencies, requirements and files
|
183
178
|
s.files = PKG_FILES.to_a
|
@@ -222,7 +217,7 @@ EOF
|
|
222
217
|
rf.configure
|
223
218
|
rf.login
|
224
219
|
|
225
|
-
rf.userconfig["release_notes"] = REL_PAGE.blocks['content'].content
|
220
|
+
rf.userconfig["release_notes"] = REL_PAGE.blocks['content'].content.force_encoding('ASCII-8BIT')
|
226
221
|
rf.userconfig["preformatted"] = false
|
227
222
|
|
228
223
|
files = %w[.gem .tgz .zip].collect {|ext| "pkg/kramdown-#{Kramdown::VERSION}" + ext}
|
@@ -241,7 +236,7 @@ EOF
|
|
241
236
|
rf.configure
|
242
237
|
rf.login
|
243
238
|
|
244
|
-
content = REL_PAGE.blocks['content']
|
239
|
+
content = REL_PAGE.blocks['content']
|
245
240
|
content += "\n\n\nAbout kramdown\n\n#{SUMMARY}\n\n#{DESCRIPTION}"
|
246
241
|
rf.post_news('kramdown', "kramdown #{Kramdown::VERSION} released", content)
|
247
242
|
puts "done"
|
@@ -264,22 +259,9 @@ EOF
|
|
264
259
|
COPYRIGHT=<<EOF
|
265
260
|
#
|
266
261
|
#--
|
267
|
-
# Copyright (C) 2009-
|
268
|
-
#
|
269
|
-
# This file is part of kramdown.
|
270
|
-
#
|
271
|
-
# kramdown is free software: you can redistribute it and/or modify
|
272
|
-
# it under the terms of the GNU General Public License as published by
|
273
|
-
# the Free Software Foundation, either version 3 of the License, or
|
274
|
-
# (at your option) any later version.
|
275
|
-
#
|
276
|
-
# This program is distributed in the hope that it will be useful,
|
277
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
278
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
279
|
-
# GNU General Public License for more details.
|
262
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
280
263
|
#
|
281
|
-
#
|
282
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
264
|
+
# This file is part of kramdown which is licensed under the MIT.
|
283
265
|
#++
|
284
266
|
#
|
285
267
|
EOF
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/benchmark/testing.sh
CHANGED
data/bin/kramdown
CHANGED
@@ -2,22 +2,9 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
#
|
4
4
|
#--
|
5
|
-
# Copyright (C) 2009-
|
5
|
+
# Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
6
6
|
#
|
7
|
-
# This file is part of kramdown.
|
8
|
-
#
|
9
|
-
# kramdown is free software: you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# This program is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
7
|
+
# This file is part of kramdown which is licensed under the MIT.
|
21
8
|
#++
|
22
9
|
#
|
23
10
|
|
data/doc/index.page
CHANGED
@@ -71,7 +71,6 @@ Markdown implementations because kramdown borrowed many ideas from existing pack
|
|
71
71
|
|
72
72
|
* Thomas Leitner
|
73
73
|
* e-Mail: <t_leitner@gmx.at>
|
74
|
-
* GPG Key-Id: 0xB2D0A854
|
75
74
|
|
76
75
|
|
77
76
|
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
@@ -81,12 +80,12 @@ Markdown implementations because kramdown borrowed many ideas from existing pack
|
|
81
80
|
|
82
81
|
--- name:intro
|
83
82
|
|
84
|
-
**kramdown** (sic, not Kramdown or KramDown, just kramdown) is a *free*
|
83
|
+
**kramdown** (sic, not Kramdown or KramDown, just kramdown) is a *free* MIT-licensed
|
85
84
|
[Ruby](http://www.ruby-lang.org) library for parsing and converting a superset of Markdown. It is
|
86
85
|
completely written in Ruby, supports standard Markdown (with some minor modifications) and various
|
87
86
|
extensions that have been made popular by the [PHP Markdown Extra] package and [Maruku].
|
88
87
|
|
89
|
-
It is probably the fastest pure-Ruby Markdown converter available (
|
88
|
+
It is probably the fastest pure-Ruby Markdown converter available (March 2013), being about 4x
|
90
89
|
faster than [Maruku] and about 5x faster than [BlueFeather].
|
91
90
|
|
92
91
|
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
data/doc/news.feed
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
---
|
2
2
|
title: kramdown News
|
3
3
|
description: kramdown - a fast, pure Ruby Markdown-superset converter
|
4
|
-
site_url: http://kramdown.rubyforge.org/
|
5
4
|
author: Thomas Leitner
|
6
5
|
author_url: http://kramdown.rubyforge.org
|
7
6
|
entries: {alcn: news/*.html, sort: sort_info, reverse: true, limit: 10}
|
data/doc/sidebar.template
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<h2>News</h2>
|
2
2
|
|
3
|
-
<p>The latest version of kramdown is <b>0.
|
4
|
-
on <b>2013-
|
3
|
+
<p>The latest version of kramdown is <b>1.0.0</b> and it was released
|
4
|
+
on <b>2013-03-10</b>.</p>
|
5
5
|
|
6
6
|
<p>More <a href="{relocatable: news.html}">news</a>…</p>
|
7
7
|
|
data/doc/syntax.page
CHANGED
@@ -802,7 +802,7 @@ Given the above components, a table is specified by
|
|
802
802
|
Also note
|
803
803
|
|
804
804
|
* that the first line of a table must not have more than three spaces of indentation before the
|
805
|
-
first
|
805
|
+
first non-space character,
|
806
806
|
* that each line of a table needs to have at least one not escaped pipe character so that kramdown
|
807
807
|
recognizes it as a line belonging to the table and
|
808
808
|
* that tables have to start and end on [block boundaries](#block-boundaries)!
|
data/doc/tests.page
CHANGED
@@ -83,9 +83,9 @@ different Ruby interpreters:
|
|
83
83
|
![ruby 1.8.6p399]({relocatable: img/graph-ruby-1.8.6-399.png})
|
84
84
|
![ruby 1.8.7p249]({relocatable: img/graph-ruby-1.8.7-249.png})
|
85
85
|
![ruby 1.8.7p302]({relocatable: img/graph-ruby-1.8.7-302.png})
|
86
|
-
![ruby 1.9.
|
87
|
-
![ruby 1.9.
|
88
|
-
![ruby 2.0.
|
86
|
+
![ruby 1.9.2p320]({relocatable: img/graph-ruby-1.9.2p320-320.png})
|
87
|
+
![ruby 1.9.3p392]({relocatable: img/graph-ruby-1.9.3p392-392.png})
|
88
|
+
![ruby 2.0.0]({relocatable: img/graph-ruby-2.0.0p0-0.png})
|
89
89
|
|
90
90
|
[Markdown Test Suite]: http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
|
91
91
|
[MDTest]: http://www.michelf.com/docs/projets/mdtest-1.0.zip
|
data/lib/kramdown.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
|
|
@@ -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
|
# All the code in this file is backported from Ruby 1.8.7 sothat kramdown works under 1.8.5
|
data/lib/kramdown/converter.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
|
|
@@ -1,26 +1,14 @@
|
|
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
|
require 'erb'
|
11
|
+
require 'kramdown/utils'
|
24
12
|
|
25
13
|
module Kramdown
|
26
14
|
|
@@ -90,6 +78,7 @@ module Kramdown
|
|
90
78
|
converter = new(tree, ::Kramdown::Options.merge(options.merge(tree.options[:options] || {})))
|
91
79
|
result = converter.convert(tree)
|
92
80
|
result = apply_template(converter, result) if !converter.options[:template].empty?
|
81
|
+
result.encode!(tree.options[:encoding]) if result.respond_to?(:encode!)
|
93
82
|
[result, converter.warnings]
|
94
83
|
end
|
95
84
|
|
@@ -164,6 +153,7 @@ module Kramdown
|
|
164
153
|
# Uses the option +auto_id_prefix+: the value of this option is prepended to every generated
|
165
154
|
# ID.
|
166
155
|
def generate_id(str)
|
156
|
+
str = ::Kramdown::Utils::Unidecoder.decode(str) if @options[:transliterated_header_ids]
|
167
157
|
gen_id = str.gsub(/^[^a-zA-Z]+/, '')
|
168
158
|
gen_id.tr!('^a-zA-Z0-9 -', '')
|
169
159
|
gen_id.tr!(' ', '-')
|
@@ -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
|
|
@@ -280,7 +267,7 @@ module Kramdown
|
|
280
267
|
number = @footnote_counter
|
281
268
|
@footnote_counter += 1
|
282
269
|
@footnotes << [el.options[:name], el.value]
|
283
|
-
"<sup id=\"fnref:#{el.options[:name]}\"><a href=\"#fn:#{el.options[:name]}\"
|
270
|
+
"<sup id=\"fnref:#{el.options[:name]}\"><a href=\"#fn:#{el.options[:name]}\" class=\"footnote\">#{number}</a></sup>"
|
284
271
|
end
|
285
272
|
|
286
273
|
def convert_raw(el, indent)
|
@@ -427,7 +414,7 @@ module Kramdown
|
|
427
414
|
li.children = Marshal.load(Marshal.dump(data.children))
|
428
415
|
ol.children << li
|
429
416
|
|
430
|
-
ref = Element.new(:raw, "<a href=\"#fnref:#{name}\"
|
417
|
+
ref = Element.new(:raw, "<a href=\"#fnref:#{name}\" class=\"reversefootnote\">↩</a>")
|
431
418
|
if li.children.last.type == :p
|
432
419
|
para = li.children.last
|
433
420
|
else
|