kramdown 1.5.0 → 1.6.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 +4 -4
- data/CONTRIBUTERS +3 -1
- data/README.md +6 -6
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/kramdown +1 -1
- data/doc/default.template +2 -2
- data/doc/index.page +21 -7
- data/doc/options.page +42 -3
- data/doc/sidebar.template +0 -7
- data/doc/sitemap.sitemap +5 -0
- data/doc/syntax.page +31 -3
- data/doc/virtual +3 -0
- data/lib/kramdown.rb +1 -1
- data/lib/kramdown/compatibility.rb +1 -1
- data/lib/kramdown/converter.rb +1 -1
- data/lib/kramdown/converter/base.rb +2 -1
- data/lib/kramdown/converter/html.rb +10 -5
- data/lib/kramdown/converter/kramdown.rb +13 -7
- data/lib/kramdown/converter/latex.rb +2 -1
- data/lib/kramdown/converter/math_engine/itex2mml.rb +1 -1
- data/lib/kramdown/converter/math_engine/mathjax.rb +18 -3
- data/lib/kramdown/converter/math_engine/ritex.rb +1 -1
- data/lib/kramdown/converter/pdf.rb +3 -2
- data/lib/kramdown/converter/remove_html_tags.rb +3 -1
- data/lib/kramdown/converter/syntax_highlighter.rb +53 -0
- data/lib/kramdown/converter/syntax_highlighter/coderay.rb +1 -1
- data/lib/kramdown/converter/syntax_highlighter/rouge.rb +2 -2
- data/lib/kramdown/converter/toc.rb +2 -2
- data/lib/kramdown/document.rb +5 -5
- data/lib/kramdown/element.rb +4 -1
- data/lib/kramdown/error.rb +1 -1
- data/lib/kramdown/options.rb +4 -3
- data/lib/kramdown/parser.rb +1 -1
- data/lib/kramdown/parser/base.rb +8 -4
- data/lib/kramdown/parser/gfm.rb +9 -1
- data/lib/kramdown/parser/html.rb +18 -3
- data/lib/kramdown/parser/kramdown.rb +8 -5
- data/lib/kramdown/parser/kramdown/abbreviation.rb +10 -2
- data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
- data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
- data/lib/kramdown/parser/kramdown/block_boundary.rb +1 -1
- data/lib/kramdown/parser/kramdown/blockquote.rb +1 -1
- data/lib/kramdown/parser/kramdown/codeblock.rb +1 -1
- data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
- data/lib/kramdown/parser/kramdown/emphasis.rb +2 -2
- data/lib/kramdown/parser/kramdown/eob.rb +1 -1
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
- data/lib/kramdown/parser/kramdown/extensions.rb +8 -7
- data/lib/kramdown/parser/kramdown/footnote.rb +11 -4
- data/lib/kramdown/parser/kramdown/header.rb +1 -1
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
- data/lib/kramdown/parser/kramdown/html.rb +7 -4
- data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
- data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
- data/lib/kramdown/parser/kramdown/link.rb +8 -5
- data/lib/kramdown/parser/kramdown/list.rb +12 -7
- data/lib/kramdown/parser/kramdown/math.rb +3 -3
- data/lib/kramdown/parser/kramdown/paragraph.rb +3 -3
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
- data/lib/kramdown/parser/kramdown/table.rb +1 -1
- data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
- data/lib/kramdown/parser/markdown.rb +2 -2
- data/lib/kramdown/utils.rb +1 -1
- data/lib/kramdown/utils/configurable.rb +1 -1
- data/lib/kramdown/utils/entities.rb +1 -1
- data/lib/kramdown/utils/html.rb +3 -1
- data/lib/kramdown/utils/ordered_hash.rb +1 -1
- data/lib/kramdown/utils/string_scanner.rb +8 -0
- data/lib/kramdown/utils/unidecoder.rb +1 -1
- data/lib/kramdown/version.rb +2 -2
- data/man/man1/kramdown.1 +1 -1
- data/test/run_tests.rb +1 -1
- data/test/test_files.rb +48 -17
- data/test/test_location.rb +8 -0
- data/test/test_string_scanner_kramdown.rb +8 -0
- data/test/testcases/block/04_header/atx_header.html +1 -1
- data/test/testcases/block/06_codeblock/highlighting-rouge.html +2 -2
- data/test/testcases/block/09_html/html_after_block.html +7 -0
- data/test/testcases/block/09_html/html_after_block.text +5 -0
- data/test/testcases/block/11_ial/simple.html +3 -1
- data/test/testcases/block/11_ial/simple.text +5 -1
- data/test/testcases/block/15_math/gh_128.html +1 -1
- data/test/testcases/block/15_math/mathjax_preview.html +4 -0
- data/test/testcases/block/15_math/mathjax_preview.options +2 -0
- data/test/testcases/block/15_math/mathjax_preview.text +5 -0
- data/test/testcases/block/15_math/mathjax_preview_simple.html +4 -0
- data/test/testcases/block/15_math/mathjax_preview_simple.options +2 -0
- data/test/testcases/block/15_math/mathjax_preview_simple.text +5 -0
- data/test/testcases/block/15_math/normal.html +1 -1
- data/test/testcases/block/16_toc/toc_exclude.html +7 -7
- data/test/testcases/block/16_toc/toc_levels.html +4 -4
- data/test/testcases/block/16_toc/toc_with_footnotes.html +1 -1
- data/test/testcases/span/01_link/empty_title.htmlinput +3 -0
- data/test/testcases/span/01_link/empty_title.text +7 -0
- data/test/testcases/span/01_link/link_defs_with_ial.html +4 -0
- data/test/testcases/span/01_link/link_defs_with_ial.text +16 -0
- data/test/testcases/span/02_emphasis/normal.html +2 -0
- data/test/testcases/span/02_emphasis/normal.text +2 -0
- data/test/testcases/span/04_footnote/markers.text +1 -0
- data/test/testcases/span/abbreviations/abbrev.html +3 -1
- data/test/testcases/span/abbreviations/abbrev.text +7 -0
- data/test/testcases/span/line_breaks/normal.html +2 -2
- data/test/testcases/span/line_breaks/normal.latex +2 -2
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8108b2bee2981647e49b9d9bab886babcc204fc
|
4
|
+
data.tar.gz: cc74805fdeda7a9756f98f9a16d6ec3ca17442c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc4e05dfd0cc980479e027bfe8aa362e0f25dc008198dbd1922a3c18eb5552fdee1f78e2587ed430618af34ef6ea53f757b9f3447a86ea6b537318ed0d1c7e2
|
7
|
+
data.tar.gz: a7294eefa4b979a6bfe307c340c6b00b537f44c04e46977b4f5dedd256326bc7e02089a23edeaf4942e5e1f889fde1c21e469fcfa55dd32bfa8f49f94aa19818
|
data/CONTRIBUTERS
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Count Name
|
2
2
|
======= ====
|
3
|
-
|
3
|
+
756 Thomas Leitner <t_leitner@gmx.at>
|
4
4
|
6 Gioele Barabucci <gioele@svario.it>
|
5
5
|
4 Ted Pak <powerpak006@gmail.com>
|
6
6
|
4 Arne Brasseur <arne@arnebrasseur.net>
|
@@ -12,6 +12,7 @@
|
|
12
12
|
2 Nathanael Jones <nathanael.jones@gmail.com>
|
13
13
|
2 Jo Hund <jhund@clearcove.ca>
|
14
14
|
2 Bran <m.versum@gmail.com>
|
15
|
+
1 winniehell <git@winniehell.de>
|
15
16
|
1 utenmiki <utenmiki@gmail.com>
|
16
17
|
1 Trevor Wennblom <trevor@well.com>
|
17
18
|
1 tomykaira <tomykaira@gmail.com>
|
@@ -30,6 +31,7 @@
|
|
30
31
|
1 Luca Barbato <luca.barbato@gmail.com>
|
31
32
|
1 John Croisant <jacius@gmail.com>
|
32
33
|
1 Joe Fiorini <joe@faithfulgeek.org>
|
34
|
+
1 Jens Kraemer <jk@jkraemer.net>
|
33
35
|
1 Floreal Morandat florealm@gmail.com <florealm@gmail.com>
|
34
36
|
1 Damien Pollet <damien.pollet@gmail.com>
|
35
37
|
1 Alex Tomlins <alex.tomlins@digital.cabinet-office.gov.uk>
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ sidebar on the [kramdown homepage](http://kramdown.gettalong.org/)!
|
|
13
13
|
|
14
14
|
## Introduction
|
15
15
|
|
16
|
-
kramdown is
|
16
|
+
kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and
|
17
17
|
supporting several common extensions.
|
18
18
|
|
19
19
|
The syntax definition for the kramdown syntax can be found in **doc/syntax.page** (or online at
|
@@ -21,11 +21,11 @@ The syntax definition for the kramdown syntax can be found in **doc/syntax.page*
|
|
21
21
|
**doc/quickref.page** or online at <http://kramdown.gettalong.org/quickref.html>.
|
22
22
|
|
23
23
|
The kramdown library is mainly written to support the kramdown-to-HTML conversion chain. However,
|
24
|
-
due to its flexibility it supports other input and output formats as
|
25
|
-
supported formats:
|
24
|
+
due to its flexibility (by creating an internal AST) it supports other input and output formats as
|
25
|
+
well. Here is a list of the supported formats:
|
26
26
|
|
27
|
-
* input formats: kramdown (a Markdown superset), Markdown, HTML
|
28
|
-
* output formats: HTML, kramdown, LaTeX (and therefore PDF)
|
27
|
+
* input formats: kramdown (a Markdown superset), Markdown, GFM, HTML
|
28
|
+
* output formats: HTML, kramdown, LaTeX (and therefore PDF), PDF via Prawn
|
29
29
|
|
30
30
|
All the documentation on the available input and output formats is available in the **doc/**
|
31
31
|
directory and online at <http://kramdown.gettalong.org>.
|
@@ -37,7 +37,7 @@ number on the introduction of new features and the patch number on everything el
|
|
37
37
|
|
38
38
|
## Usage
|
39
39
|
|
40
|
-
kramdown has a
|
40
|
+
kramdown has a very simple API, so using kramdown is as easy as
|
41
41
|
|
42
42
|
```ruby
|
43
43
|
require 'kramdown'
|
data/Rakefile
CHANGED
@@ -177,9 +177,9 @@ EOF
|
|
177
177
|
s.default_executable = 'kramdown'
|
178
178
|
s.add_development_dependency 'minitest', '~> 5.0'
|
179
179
|
s.add_development_dependency 'coderay', '~> 1.0.0'
|
180
|
-
s.add_development_dependency 'rouge', '~> 1.
|
180
|
+
s.add_development_dependency 'rouge', '~> 1.8'
|
181
181
|
s.add_development_dependency 'stringex', '~> 1.5.1'
|
182
|
-
s.add_development_dependency 'prawn', '~> 0
|
182
|
+
s.add_development_dependency 'prawn', '~> 2.0'
|
183
183
|
s.add_development_dependency 'ritex', '~> 1.0'
|
184
184
|
s.add_development_dependency 'itextomml', '~> 1.5'
|
185
185
|
|
@@ -239,7 +239,7 @@ EOF
|
|
239
239
|
COPYRIGHT=<<EOF
|
240
240
|
#
|
241
241
|
#--
|
242
|
-
# Copyright (C) 2009-
|
242
|
+
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
|
243
243
|
#
|
244
244
|
# This file is part of kramdown which is licensed under the MIT.
|
245
245
|
#++
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/bin/kramdown
CHANGED
data/doc/default.template
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
5
5
|
<meta name="author" content="Thomas Leitner" />
|
6
|
-
<meta name="copyright" content="2009-
|
6
|
+
<meta name="copyright" content="2009-2015 Thomas Leitner" />
|
7
7
|
<meta name="description" content="kramdown is a fast, pure-Ruby Markdown-superset converter" />
|
8
8
|
<meta name="keywords" content="ruby, kramdown, markdown, text markup" />
|
9
9
|
<link href="{relocatable: default.css}" type="text/css" rel="stylesheet" media="screen,projection" />
|
@@ -43,7 +43,7 @@
|
|
43
43
|
</div>
|
44
44
|
|
45
45
|
<footer>
|
46
|
-
<div class="float-left">Copyright © 2009-
|
46
|
+
<div class="float-left">Copyright © 2009-2015 Thomas Leitner</div>
|
47
47
|
<div class="float-right">Generated by <a href="http://webgen.gettalong.org">webgen</a></div>
|
48
48
|
</footer>
|
49
49
|
|
data/doc/index.page
CHANGED
@@ -74,22 +74,36 @@ Markdown implementations because kramdown borrowed many ideas from existing pack
|
|
74
74
|
* Thomas Leitner
|
75
75
|
* e-Mail: <mailto:t_leitner@gmx.at>
|
76
76
|
|
77
|
-
|
78
77
|
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
79
|
-
[Maruku]:
|
80
|
-
[
|
81
|
-
|
82
|
-
|
83
|
-
--- name:intro
|
78
|
+
[Maruku]: http://maruku.rubyforge.org
|
79
|
+
[BlueFeather]: http://ruby.morphball.net/bluefeather/index_en.html
|
84
80
|
|
85
|
-
|
81
|
+
--- intro
|
82
|
+
<div markdown="1" itemscope="" itemtype="http://schema.org/SoftwareApplication">
|
83
|
+
<meta itemprop="applicationCategory" content="Markdown library, Markdown converter" />
|
84
|
+
<meta itemprop="operatingSystem" content="Linux, Windows, Mac OS X" />
|
85
|
+
<div itemprop="author" itemscope="" itemtype="http://schema.org/Person">
|
86
|
+
<meta itemprop="name" content="Thomas Leitner" />
|
87
|
+
<meta itemprop="email" content="t_leitner@gmx.at" />
|
88
|
+
</div>
|
89
|
+
|
90
|
+
**kramdown**{:itemprop="name"} (sic, not Kramdown or KramDown, just kramdown) is a *free*
|
91
|
+
[MIT](https://github.com/gettalong/kramdown/blob/master/COPYING){:itemprop="license"}-licensed
|
86
92
|
[Ruby](http://www.ruby-lang.org) library for parsing and converting a superset of Markdown. It is
|
87
93
|
completely written in Ruby, supports standard Markdown (with some minor modifications) and various
|
88
94
|
extensions that have been made popular by the [PHP Markdown Extra] package and [Maruku].
|
95
|
+
{:itemprop="description"}
|
89
96
|
|
90
97
|
It is probably the fastest pure-Ruby Markdown converter available (September 2014), being about 3x
|
91
98
|
faster than [Maruku] and about 4.5x faster than [BlueFeather].
|
92
99
|
|
100
|
+
Version **1.6.0**{:itemprop="softwareVersion"} released on
|
101
|
+
**2015-02-28**{:itemprop="datePublished"}, [more news](news.html)
|
102
|
+
{: style="text-align: center; font-size: 80%"}
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
93
107
|
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
94
108
|
[Maruku]: http://maruku.rubyforge.org
|
95
109
|
[BlueFeather]: http://ruby.morphball.net/bluefeather/index_en.html
|
data/doc/options.page
CHANGED
@@ -1,10 +1,49 @@
|
|
1
1
|
---
|
2
2
|
title: Options
|
3
3
|
---
|
4
|
+
## Options
|
5
|
+
|
6
|
+
The behaviour of kramdown can be adjusted via the available options.
|
7
|
+
|
8
|
+
Options can be specified in multiple ways:
|
9
|
+
|
10
|
+
On the command line
|
11
|
+
: The `kramdown` binary allows setting any option by using command line switches.
|
12
|
+
|
13
|
+
For example, the following command will disable automatic header ID generation and defines the
|
14
|
+
first footnote number as 5:
|
15
|
+
|
16
|
+
~~~
|
17
|
+
$ kramdown --no-auto-ids --footnote-nr 5
|
18
|
+
~~~
|
19
|
+
|
20
|
+
As you can see all underscores in option names have to be replaced with dashes. The built-in help
|
21
|
+
of the binary as well as the man-page show all available options.
|
22
|
+
|
23
|
+
Within a kramdown document
|
24
|
+
: By using the special extension syntax, it is possible to set options within a document.
|
25
|
+
|
26
|
+
Using the above example, the options would be set like this within a document:
|
27
|
+
|
28
|
+
~~~
|
29
|
+
{::options auto_ids="false" footnote_nr="5" /}
|
30
|
+
~~~
|
31
|
+
|
32
|
+
Using Ruby code
|
33
|
+
|
34
|
+
: If you are using kramdown as a library, you can pass any options as second parameter to the
|
35
|
+
`Kramdown::Document.new` method.
|
36
|
+
|
37
|
+
Again, using the above example you would initalize the kramdown document class as follows:
|
38
|
+
|
39
|
+
~~~ ruby
|
40
|
+
Kramdown::Document.new(source_text, \{auto_ids: false, footnote_nr: 5})
|
41
|
+
~~~
|
42
|
+
|
43
|
+
|
4
44
|
## Available Options
|
5
45
|
|
6
|
-
|
7
|
-
|
8
|
-
directly which options they support!
|
46
|
+
Below is a list of all currently available options. Have a look at the documentation of a converter
|
47
|
+
or parser to see directly which options they support!
|
9
48
|
|
10
49
|
{options: {items: all}}
|
data/doc/sidebar.template
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
<h2>News</h2>
|
2
|
-
|
3
|
-
<p>The latest version of kramdown is <span class="inline-important">1.5.0</span> and it was released
|
4
|
-
on <span class="inline-important">2014-10-25</span></p>
|
5
|
-
|
6
|
-
<p>More <a href="{relocatable: news.html}">news</a>…</p>
|
7
|
-
|
8
1
|
<h2>Support kramdown</h2>
|
9
2
|
|
10
3
|
<p>If you like kramdown and would like to support it, you are welcome to make a small
|
data/doc/sitemap.sitemap
ADDED
data/doc/syntax.page
CHANGED
@@ -1156,6 +1156,11 @@ Notes:
|
|
1156
1156
|
|
1157
1157
|
* The link title may not contain its delimiters and may not be empty.
|
1158
1158
|
|
1159
|
+
* Additional link attributes can be added by using a [span IAL](#span-ials) after the inline link,
|
1160
|
+
for example:
|
1161
|
+
|
1162
|
+
This is a [link](http://example.com){:hreflang="de"}
|
1163
|
+
|
1159
1164
|
### Reference Links
|
1160
1165
|
|
1161
1166
|
To create a reference style link, you need to surround the link text with square brackets (as with
|
@@ -1173,6 +1178,9 @@ second pair of square brackets, the link text is converted to a valid link ident
|
|
1173
1178
|
all invalid characters and inserting spaces for line breaks. If there is a link definition found for
|
1174
1179
|
the link identifier, a link will be created. Otherwise the text is not converted to a link.
|
1175
1180
|
|
1181
|
+
As with inline links, additional link attributes can be added by using a [span IAL](#span-ials)
|
1182
|
+
after the reference link.
|
1183
|
+
|
1176
1184
|
### Link Definitions
|
1177
1185
|
|
1178
1186
|
The link definition can be put anywhere in the document. It does not appear in the output. A link
|
@@ -1205,6 +1213,11 @@ you can escape the colon after the link identifier:
|
|
1205
1213
|
|
1206
1214
|
[Room 100]: link_to_room_100.html
|
1207
1215
|
|
1216
|
+
Although link definitions are non-content block-level elements, [block IALs](#block-ials) can be
|
1217
|
+
used on them to specify additional attributes for the links:
|
1218
|
+
|
1219
|
+
[linkid]: http://example.com
|
1220
|
+
{:hreflang="de"}
|
1208
1221
|
|
1209
1222
|
### Images
|
1210
1223
|
|
@@ -1218,8 +1231,16 @@ example:
|
|
1218
1231
|
![too](../images/other.png 'Title text'). Or ![here].
|
1219
1232
|
With empty alt text ![](see.jpg)
|
1220
1233
|
|
1221
|
-
The link definition for images is exactly the same as the link definition for normal links.
|
1234
|
+
The link definition for images is exactly the same as the link definition for normal links. Since
|
1235
|
+
additional attributes can be added via span and block IALs, it is possible, for example, to specify
|
1236
|
+
image width and height:
|
1222
1237
|
|
1238
|
+
Here is an inline ![smiley](smiley.png){:height="36px" width="36px"}.
|
1239
|
+
|
1240
|
+
And here is a referenced ![smile]
|
1241
|
+
|
1242
|
+
[smile]: smile.png
|
1243
|
+
{: height="36px" width="36px"}
|
1223
1244
|
|
1224
1245
|
## Emphasis
|
1225
1246
|
|
@@ -1402,6 +1423,8 @@ referenced footnote definitions will be placed at the end of the kramdown docume
|
|
1402
1423
|
footnote definitions are ignored. If more than one footnote definitions have the same footnote name,
|
1403
1424
|
all footnote definitions but the last are ignored.
|
1404
1425
|
|
1426
|
+
Although footnote definitions are non-content block-level elements, [block IALs](#block-ials) can be
|
1427
|
+
used on them to attach attributes. How these attributes are used depends on the converter.
|
1405
1428
|
|
1406
1429
|
## Abbreviations
|
1407
1430
|
|
@@ -1422,15 +1445,20 @@ following structure:
|
|
1422
1445
|
* then a colon and the full phrase of the abbreviation on one line (leading and trailing spaces are
|
1423
1446
|
stripped from the full phrase).
|
1424
1447
|
|
1425
|
-
Later abbreviation
|
1448
|
+
Later abbreviation definitions for the same abbreviation override prior ones and it does not matter
|
1426
1449
|
where you put an abbreviation definition in a kramdown document. Empty definitions are also allowed.
|
1427
1450
|
|
1451
|
+
Although abbreviation definitions are non-content block-level elements, [block IALs](#block-ials)
|
1452
|
+
can be used on them to specify additional attributes.
|
1453
|
+
|
1428
1454
|
Here are some examples:
|
1429
1455
|
|
1430
1456
|
This is some text not written in HTML but in another language!
|
1431
1457
|
|
1432
1458
|
*[another language]: It's called Markdown
|
1459
|
+
|
1433
1460
|
*[HTML]: HyperTextMarkupLanguage
|
1461
|
+
{:.mega-big}
|
1434
1462
|
|
1435
1463
|
> Abbreviation definitions are, despite being described here, non-content block-level elements.
|
1436
1464
|
{: .information}
|
@@ -1587,7 +1615,7 @@ These elements are used to attach attributes to another element.
|
|
1587
1615
|
> the [Maruku] package.
|
1588
1616
|
{: .markdown-difference}
|
1589
1617
|
|
1590
|
-
This block-level element is used to attach attributes to
|
1618
|
+
This block-level element is used to attach attributes to another block-level element. A block inline
|
1591
1619
|
attribute list (block IAL) has the same structure as an [ALD](#attribute-list-definitions) except
|
1592
1620
|
that the colon/reference name/colon part is replaced by a colon. A block IAL (or two or more block
|
1593
1621
|
IALs) has to be put directly before or after the block-level element to which the attributes should
|
data/doc/virtual
CHANGED
data/lib/kramdown.rb
CHANGED
data/lib/kramdown/converter.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
require 'erb'
|
11
11
|
require 'kramdown/utils'
|
12
|
+
require 'kramdown/document'
|
12
13
|
|
13
14
|
module Kramdown
|
14
15
|
|
@@ -1,14 +1,15 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
8
8
|
#
|
9
9
|
|
10
|
-
require '
|
11
|
-
require 'kramdown/
|
10
|
+
require 'kramdown/parser'
|
11
|
+
require 'kramdown/converter'
|
12
|
+
require 'kramdown/utils'
|
12
13
|
|
13
14
|
module Kramdown
|
14
15
|
|
@@ -321,7 +322,9 @@ module Kramdown
|
|
321
322
|
|
322
323
|
def convert_abbreviation(el, indent)
|
323
324
|
title = @root.options[:abbrev_defs][el.value]
|
324
|
-
|
325
|
+
attr = @root.options[:abbrev_attr][el.value].dup
|
326
|
+
attr['title'] = title unless title.empty?
|
327
|
+
format_as_span_html("abbr", attr, el.value)
|
325
328
|
end
|
326
329
|
|
327
330
|
def convert_root(el, indent)
|
@@ -372,7 +375,9 @@ module Kramdown
|
|
372
375
|
toc.each do |level, id, children|
|
373
376
|
li = Element.new(:li, nil, nil, {:level => level})
|
374
377
|
li.children << Element.new(:p, nil, nil, {:transparent => true})
|
375
|
-
a = Element.new(:a, nil
|
378
|
+
a = Element.new(:a, nil)
|
379
|
+
a.attr['href'] = "##{id}"
|
380
|
+
a.attr['id'] = "#{sections.attr['id']}-#{id}"
|
376
381
|
a.children.concat(remove_footnotes(Marshal.load(Marshal.dump(children))))
|
377
382
|
li.children.last.children << a
|
378
383
|
li.children << Element.new(type)
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
#--
|
4
|
-
# Copyright (C) 2009-
|
4
|
+
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
|
5
5
|
#
|
6
6
|
# This file is part of kramdown which is licensed under the MIT.
|
7
7
|
#++
|
8
8
|
#
|
9
9
|
|
10
|
-
require '
|
10
|
+
require 'kramdown/converter'
|
11
|
+
require 'kramdown/utils'
|
11
12
|
|
12
13
|
module Kramdown
|
13
14
|
|
@@ -280,17 +281,17 @@ module Kramdown
|
|
280
281
|
end
|
281
282
|
"[#{inner(el, opts)}][#{index}]"
|
282
283
|
else
|
283
|
-
title = el.attr['title']
|
284
|
+
title = parse_title(el.attr['title'])
|
284
285
|
"[#{inner(el, opts)}](#{el.attr['href']}#{title})"
|
285
286
|
end
|
286
287
|
end
|
287
288
|
|
288
289
|
def convert_img(el, opts)
|
289
|
-
alt_text = el.attr['alt'].gsub(ESCAPED_CHAR_RE) { $1 ? "\\#{$1}" : $2 }
|
290
|
+
alt_text = el.attr['alt'].to_s.gsub(ESCAPED_CHAR_RE) { $1 ? "\\#{$1}" : $2 }
|
290
291
|
if el.attr['src'].empty?
|
291
292
|
"![#{alt_text}]()"
|
292
293
|
else
|
293
|
-
title = (el.attr['title']
|
294
|
+
title = parse_title(el.attr['title'])
|
294
295
|
link = if el.attr['src'].count("()") > 0
|
295
296
|
"<#{el.attr['src']}>"
|
296
297
|
else
|
@@ -369,8 +370,8 @@ module Kramdown
|
|
369
370
|
res = ''
|
370
371
|
res << "\n\n" if @linkrefs.size > 0
|
371
372
|
@linkrefs.each_with_index do |el, i|
|
372
|
-
title = el.attr['title']
|
373
|
-
res << "[#{i+1}]: #{el.attr['href']}#{title
|
373
|
+
title = parse_title(el.attr['title'])
|
374
|
+
res << "[#{i+1}]: #{el.attr['href']}#{title}\n"
|
374
375
|
end
|
375
376
|
res
|
376
377
|
end
|
@@ -389,6 +390,7 @@ module Kramdown
|
|
389
390
|
res = ''
|
390
391
|
@root.options[:abbrev_defs].each do |name, text|
|
391
392
|
res << "*[#{name}]: #{text}\n"
|
393
|
+
res << ial_for_element(Element.new(:unused, nil, @root.options[:abbrev_attr][name])).to_s << "\n\n"
|
392
394
|
end
|
393
395
|
res
|
394
396
|
end
|
@@ -415,6 +417,10 @@ module Kramdown
|
|
415
417
|
res.strip.empty? ? nil : "{:#{res}}"
|
416
418
|
end
|
417
419
|
|
420
|
+
def parse_title(attr)
|
421
|
+
attr.to_s.empty? ? '' : ' "' + attr.gsub(/"/, '"') + '"'
|
422
|
+
end
|
423
|
+
|
418
424
|
# :startdoc:
|
419
425
|
|
420
426
|
end
|