kramdown 0.13.2 → 0.13.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kramdown might be problematic. Click here for more details.
- data/CONTRIBUTERS +1 -1
- data/ChangeLog +196 -0
- data/Rakefile +5 -3
- data/VERSION +1 -1
- data/data/kramdown/document.latex +1 -1
- data/doc/default.scss.css +7 -1
- data/doc/index.page +1 -1
- data/doc/quickref.page +29 -8
- data/doc/tests.page +1 -1
- data/lib/kramdown/converter/base.rb +5 -5
- data/lib/kramdown/converter/html.rb +14 -15
- data/lib/kramdown/converter/kramdown.rb +5 -3
- data/lib/kramdown/converter/latex.rb +16 -16
- data/lib/kramdown/document.rb +47 -50
- data/lib/kramdown/parser/base.rb +8 -8
- data/lib/kramdown/parser/html.rb +56 -36
- data/lib/kramdown/parser/kramdown.rb +5 -5
- data/lib/kramdown/parser/kramdown/extensions.rb +2 -2
- data/lib/kramdown/parser/kramdown/link.rb +1 -1
- data/lib/kramdown/parser/kramdown/table.rb +3 -3
- data/lib/kramdown/utils/html.rb +6 -7
- data/lib/kramdown/utils/ordered_hash.rb +17 -0
- data/lib/kramdown/version.rb +1 -1
- data/test/test_files.rb +35 -0
- data/test/testcases/block/09_html/content_model/tables.html +8 -8
- data/test/testcases/block/09_html/content_model/tables.text +1 -1
- data/test/testcases/block/09_html/html_and_headers.html +5 -0
- data/test/testcases/block/09_html/html_and_headers.text +6 -0
- data/test/testcases/block/09_html/html_to_native/emphasis.html +2 -1
- data/test/testcases/block/09_html/html_to_native/table_normal.html +10 -12
- data/test/testcases/block/09_html/html_to_native/table_simple.html +11 -11
- data/test/testcases/block/14_table/header.html +9 -16
- data/test/testcases/block/14_table/simple.html +19 -0
- data/test/testcases/block/14_table/simple.html.19 +19 -0
- data/test/testcases/block/14_table/simple.text +6 -0
- data/test/testcases/block/14_table/table_with_footnote.html +25 -0
- data/test/testcases/block/14_table/table_with_footnote.latex +11 -0
- data/test/testcases/block/14_table/table_with_footnote.text +6 -0
- metadata +8 -3
data/CONTRIBUTERS
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,199 @@
|
|
1
|
+
commit 91889069d843273d5847330cdce4b1068e74108f
|
2
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
3
|
+
Date: Fri May 6 15:39:50 2011 +0200
|
4
|
+
|
5
|
+
Fixed problems with running tests
|
6
|
+
|
7
|
+
lib/kramdown/utils/ordered_hash.rb
|
8
|
+
test/test_files.rb
|
9
|
+
|
10
|
+
commit fb83e9d8534b7f2b6f3143e9f394bc3c03c3e219
|
11
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
12
|
+
Date: Fri May 6 15:17:22 2011 +0200
|
13
|
+
|
14
|
+
Updated benchmark graphs
|
15
|
+
|
16
|
+
doc/img/graph-jruby-1.5.3-249.png
|
17
|
+
doc/img/graph-jruby-1.6.0-330.png
|
18
|
+
doc/img/graph-ruby-1.8.5-231.png
|
19
|
+
doc/img/graph-ruby-1.8.6-399.png
|
20
|
+
doc/img/graph-ruby-1.8.7-249.png
|
21
|
+
doc/img/graph-ruby-1.8.7-302.png
|
22
|
+
doc/img/graph-ruby-1.9.2p136-136.png
|
23
|
+
doc/tests.page
|
24
|
+
|
25
|
+
commit 05865df588767fa89996282719ab4a9302ab01a7
|
26
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
27
|
+
Date: Fri May 6 15:07:36 2011 +0200
|
28
|
+
|
29
|
+
Updated release notes and version for release
|
30
|
+
|
31
|
+
doc/index.page
|
32
|
+
doc/news/release_0_13_3.page
|
33
|
+
doc/news/release_0_X_X.page
|
34
|
+
lib/kramdown/version.rb
|
35
|
+
|
36
|
+
commit 9766c5c47e45bff0b92e96e5b6dc926cfb219941
|
37
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
38
|
+
Date: Thu May 5 17:45:34 2011 +0200
|
39
|
+
|
40
|
+
Nicer HTML block element output in kramdown converter
|
41
|
+
|
42
|
+
lib/kramdown/converter/kramdown.rb
|
43
|
+
|
44
|
+
commit c40c34b28de32114d4b62a5e0ff6858209eae8f4
|
45
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
46
|
+
Date: Thu May 5 17:45:07 2011 +0200
|
47
|
+
|
48
|
+
Fixed kramdown converter to correctly output table cells with attributes
|
49
|
+
|
50
|
+
doc/news/release_0_X_X.page
|
51
|
+
lib/kramdown/converter/kramdown.rb
|
52
|
+
|
53
|
+
commit 3317b5ebf72ba96423c643275ee40bee54a57de9
|
54
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
55
|
+
Date: Thu May 5 17:42:33 2011 +0200
|
56
|
+
|
57
|
+
Fixed HTML-to-native conversion of unsupported HTML elements
|
58
|
+
|
59
|
+
The conversion of HTML elements that have no native representation was
|
60
|
+
flawed because they were processed like elements with a native
|
61
|
+
representation.
|
62
|
+
|
63
|
+
doc/news/release_0_X_X.page
|
64
|
+
lib/kramdown/parser/html.rb
|
65
|
+
test/testcases/block/09_html/content_model/tables.html
|
66
|
+
test/testcases/block/09_html/content_model/tables.text
|
67
|
+
test/testcases/block/09_html/html_to_native/emphasis.html
|
68
|
+
test/testcases/block/09_html/html_to_native/table_normal.html
|
69
|
+
test/testcases/block/09_html/html_to_native/table_simple.html
|
70
|
+
|
71
|
+
commit b598a800dad68766b728545a0c1137eee33ac36a
|
72
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
73
|
+
Date: Thu May 5 17:31:34 2011 +0200
|
74
|
+
|
75
|
+
Updated HTML parser to support more HTML5 elements
|
76
|
+
|
77
|
+
doc/news/release_0_X_X.page
|
78
|
+
lib/kramdown/parser/html.rb
|
79
|
+
|
80
|
+
commit 7a6512cd034f4ff11f2b8a5d63d8aafdb07df95d
|
81
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
82
|
+
Date: Mon May 2 15:28:33 2011 +0200
|
83
|
+
|
84
|
+
Table cell alignments in HTML are now done using a style attribute on the cells
|
85
|
+
|
86
|
+
doc/news/release_0_X_X.page
|
87
|
+
lib/kramdown/converter/html.rb
|
88
|
+
lib/kramdown/parser/html.rb
|
89
|
+
test/testcases/block/14_table/header.html
|
90
|
+
|
91
|
+
commit 09b538a79b8074dfd6b1e31bf0390b5906c1da0e
|
92
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
93
|
+
Date: Sat Apr 30 08:05:14 2011 +0200
|
94
|
+
|
95
|
+
Fixed problem with footnotes in LaTeX tables
|
96
|
+
|
97
|
+
The tabular environment doesn't support footnotes in LaTeX tables.
|
98
|
+
Therefore tables are now set using the longtable environment.
|
99
|
+
|
100
|
+
data/kramdown/document.latex
|
101
|
+
doc/news/release_0_X_X.page
|
102
|
+
lib/kramdown/converter/latex.rb
|
103
|
+
test/testcases/block/14_table/table_with_footnote.html
|
104
|
+
test/testcases/block/14_table/table_with_footnote.latex
|
105
|
+
test/testcases/block/14_table/table_with_footnote.text
|
106
|
+
|
107
|
+
commit 33d07594485db205c327e9ace467538bd61d40c2
|
108
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
109
|
+
Date: Thu Apr 28 17:27:06 2011 +0200
|
110
|
+
|
111
|
+
Fixed problems and inconsistencies in quick reference
|
112
|
+
|
113
|
+
Rakefile
|
114
|
+
doc/default.scss.css
|
115
|
+
doc/news/release_0_X_X.page
|
116
|
+
doc/quickref.page
|
117
|
+
|
118
|
+
commit a0816c07176b3951a0d43908c581e45c61ea7468
|
119
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
120
|
+
Date: Thu Apr 28 17:24:16 2011 +0200
|
121
|
+
|
122
|
+
Fixed problem with block HTML tag being treated as header text
|
123
|
+
|
124
|
+
doc/news/release_0_X_X.page
|
125
|
+
lib/kramdown/parser/kramdown.rb
|
126
|
+
test/testcases/block/09_html/html_and_headers.html
|
127
|
+
test/testcases/block/09_html/html_and_headers.text
|
128
|
+
|
129
|
+
commit ebd006a9a6bc0d576420fe4bc137f6315af4c079
|
130
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
131
|
+
Date: Mon Apr 25 22:47:57 2011 +0200
|
132
|
+
|
133
|
+
Removed all <tt> tags from RDoc comments
|
134
|
+
|
135
|
+
lib/kramdown/converter/base.rb
|
136
|
+
lib/kramdown/converter/html.rb
|
137
|
+
lib/kramdown/converter/latex.rb
|
138
|
+
lib/kramdown/document.rb
|
139
|
+
lib/kramdown/parser/base.rb
|
140
|
+
lib/kramdown/parser/html.rb
|
141
|
+
lib/kramdown/parser/kramdown.rb
|
142
|
+
lib/kramdown/parser/kramdown/extensions.rb
|
143
|
+
lib/kramdown/parser/kramdown/link.rb
|
144
|
+
lib/kramdown/utils/html.rb
|
145
|
+
|
146
|
+
commit 054aa7f5d610731ba13b326d5beca11a967d2c8a
|
147
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
148
|
+
Date: Thu Apr 28 17:46:42 2011 +0200
|
149
|
+
|
150
|
+
Fixed bug in LaTeX image converter
|
151
|
+
|
152
|
+
doc/news/release_0_X_X.page
|
153
|
+
lib/kramdown/converter/latex.rb
|
154
|
+
|
155
|
+
commit e1b83c85f9ae1f98f0305b1e8f8b3ce201fe3d4b
|
156
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
157
|
+
Date: Thu Apr 28 17:41:40 2011 +0200
|
158
|
+
|
159
|
+
Fixed place where the document tree was modified during conversion
|
160
|
+
|
161
|
+
doc/news/release_0_X_X.page
|
162
|
+
lib/kramdown/converter/kramdown.rb
|
163
|
+
test/test_files.rb
|
164
|
+
|
165
|
+
commit 3a4aa5e3cafcc9d4c7922c31cda92430edb6b0ad
|
166
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
167
|
+
Date: Mon Apr 25 18:04:42 2011 +0200
|
168
|
+
|
169
|
+
Added OrderedHash#dup
|
170
|
+
|
171
|
+
doc/news/release_0_X_X.page
|
172
|
+
lib/kramdown/utils/ordered_hash.rb
|
173
|
+
|
174
|
+
commit 23fdb20ad7604271d21c63ee8b9b4a3092872bb8
|
175
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
176
|
+
Date: Fri Mar 4 15:26:44 2011 +0100
|
177
|
+
|
178
|
+
Adapted table parser patch from Masahiro Kitajima
|
179
|
+
|
180
|
+
* "|a|`b`" was parsed as "|a`b`"
|
181
|
+
* error condition occured when parsing "|`a`"
|
182
|
+
|
183
|
+
doc/news/release_0_X_X.page
|
184
|
+
lib/kramdown/parser/kramdown/table.rb
|
185
|
+
test/testcases/block/14_table/simple.html
|
186
|
+
test/testcases/block/14_table/simple.html.19
|
187
|
+
test/testcases/block/14_table/simple.text
|
188
|
+
|
189
|
+
commit 9d0a09e8273ee6bd366bd61eab2b072102c40a9b
|
190
|
+
Author: Thomas Leitner <t_leitner@gmx.at>
|
191
|
+
Date: Fri Mar 4 14:50:37 2011 +0100
|
192
|
+
|
193
|
+
Added release notes file
|
194
|
+
|
195
|
+
doc/news/release_0_X_X.page
|
196
|
+
|
1
197
|
commit d26fde6293ac67157f58cc64339085e0a6bc2fc3
|
2
198
|
Author: Thomas Leitner <t_leitner@gmx.at>
|
3
199
|
Date: Mon Feb 21 18:05:33 2011 +0100
|
data/Rakefile
CHANGED
@@ -233,7 +233,7 @@ EOF
|
|
233
233
|
rf.configure
|
234
234
|
rf.login
|
235
235
|
|
236
|
-
rf.userconfig["release_notes"] = REL_PAGE.blocks['content'].content
|
236
|
+
rf.userconfig["release_notes"] = REL_PAGE.blocks['content'].content.force_encoding('ASCII-8BIT')
|
237
237
|
rf.userconfig["preformatted"] = false
|
238
238
|
|
239
239
|
files = %w[.gem .tgz .zip].collect {|ext| "pkg/kramdown-#{Kramdown::VERSION}" + ext}
|
@@ -344,10 +344,12 @@ if defined? Webgen
|
|
344
344
|
include Webgen::Tag::Base
|
345
345
|
|
346
346
|
def call(tag, body, context)
|
347
|
+
body.strip!
|
347
348
|
result = ::Kramdown::Document.new(body, :auto_ids => false).to_html
|
348
|
-
before = "<pre class='kdexample-before'>#{body}
|
349
|
-
after = "<pre class='kdexample-after-source'>#{CGI::escapeHTML(result)}
|
349
|
+
before = "<pre class='kdexample-before'><code>#{CGI::escapeHTML(body)}\n</code></pre>"
|
350
|
+
after = "<pre class='kdexample-after-source'><code>#{CGI::escapeHTML(result)}\n</code></pre>"
|
350
351
|
afterhtml = "<div class='kdexample-after-live'>#{result}</div>"
|
352
|
+
|
351
353
|
"<div class='kdexample'>#{before}#{after}#{afterhtml}\n</div><div class='clear'></div>"
|
352
354
|
end
|
353
355
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.13.
|
1
|
+
0.13.3
|
@@ -28,9 +28,9 @@ encmap = {
|
|
28
28
|
<% end %>
|
29
29
|
\usepackage[T1]{fontenc}
|
30
30
|
\usepackage{listings}
|
31
|
-
\usepackage{hyperref}
|
32
31
|
<% @converter.data[:packages].each {|pkg| %>\usepackage{<%= pkg %>}
|
33
32
|
<% } %>
|
33
|
+
\usepackage{hyperref}
|
34
34
|
|
35
35
|
<% if @converter.data[:packages].include?('fancyvrb') %>
|
36
36
|
\VerbatimFootnotes
|
data/doc/default.scss.css
CHANGED
@@ -435,13 +435,19 @@ body, table, code {
|
|
435
435
|
pre.kdexample-before {
|
436
436
|
width: 45%;
|
437
437
|
float: left;
|
438
|
+
margin: 10px 10px 3px 10px;
|
439
|
+
}
|
440
|
+
pre.kdexample-before:hover + pre {
|
441
|
+
display: block;
|
438
442
|
}
|
439
443
|
|
440
444
|
pre.kdexample-after-source {
|
445
|
+
display: none;
|
441
446
|
width: 45%;
|
442
447
|
float: right;
|
443
448
|
background-color: #ffffee;
|
444
449
|
border: 2px solid #e6e8e9;
|
450
|
+
margin: 10px 10px 3px 10px;
|
445
451
|
margin-left: 10px;
|
446
452
|
margin-right: 10px;
|
447
453
|
margin-bottom: 3px;
|
@@ -453,7 +459,7 @@ body, table, code {
|
|
453
459
|
clear: right;
|
454
460
|
background-color: #eeffee;
|
455
461
|
border: 2px solid #e6e8e9;
|
456
|
-
margin:
|
462
|
+
margin: 10px 10px 3px 10px;
|
457
463
|
padding: 5px;
|
458
464
|
}
|
459
465
|
|
data/doc/index.page
CHANGED
@@ -90,7 +90,7 @@ It is probably the fastest pure-Ruby Markdown converter available (January 2011)
|
|
90
90
|
faster than [Maruku] and about 5x faster than [BlueFeather].
|
91
91
|
|
92
92
|
<p class="a-center">
|
93
|
-
The latest version of kramdown is <b>0.13.
|
93
|
+
The latest version of kramdown is <b>0.13.3</b> and it was released on <b>2011-05-06</b>.
|
94
94
|
</p>
|
95
95
|
|
96
96
|
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
data/doc/quickref.page
CHANGED
@@ -20,8 +20,8 @@ kramdown has two main classes of elements: block and span-level elements. Block-
|
|
20
20
|
used to create paragraphs, headers, lists and so on whereas span-level elements are used to markup
|
21
21
|
text phrases as emphasized, as a link and so on.
|
22
22
|
|
23
|
-
All examples below feature the kramdown source, the converted HTML source
|
24
|
-
appears in the browser. This looks like this:
|
23
|
+
All examples below feature the kramdown source, the converted HTML source (shown when hovering over
|
24
|
+
the kramdown source) and the output as it appears in the browser. This looks like this:
|
25
25
|
|
26
26
|
<div class="kdexample">
|
27
27
|
<pre class="kdexample-before"><code>kramdown example code</code></pre>
|
@@ -39,7 +39,8 @@ Live browser view of example code
|
|
39
39
|
|
40
40
|
{kdlink: {oid: paragraphs, part: "paragraphs"}}
|
41
41
|
|
42
|
-
|
42
|
+
Consecutive lines of text are considered to be one paragraph. As with other block level elements you
|
43
|
+
have to add a blank line to separate it from the following block-level element:
|
43
44
|
|
44
45
|
{kdexample::}
|
45
46
|
The first paragraph.
|
@@ -62,6 +63,7 @@ which contains a hard line break.
|
|
62
63
|
kramdown supports Setext style headers and atx style headers. A header must always be preceded by a
|
63
64
|
blank line except at the beginning of the document:
|
64
65
|
|
66
|
+
|
65
67
|
{kdexample::}
|
66
68
|
First level header
|
67
69
|
==================
|
@@ -104,6 +106,7 @@ elements inside a blockquote:
|
|
104
106
|
|
105
107
|
{kdexample::}
|
106
108
|
> A sample blockquote.
|
109
|
+
>
|
107
110
|
> >Nested blockquotes are
|
108
111
|
> >also possible.
|
109
112
|
>
|
@@ -111,6 +114,15 @@ elements inside a blockquote:
|
|
111
114
|
> This is the outer quote again.
|
112
115
|
{kdexample}
|
113
116
|
|
117
|
+
You may also be lazy with the `>` markers as long as there is no blank line:
|
118
|
+
|
119
|
+
{kdexample::}
|
120
|
+
> This is a blockquote
|
121
|
+
continued on this
|
122
|
+
and this line.
|
123
|
+
|
124
|
+
But this is a separate paragraph.
|
125
|
+
{kdexample}
|
114
126
|
|
115
127
|
## Code Blocks
|
116
128
|
|
@@ -167,7 +179,14 @@ to the list item:
|
|
167
179
|
1. This is a list item
|
168
180
|
2. And another item
|
169
181
|
2. And the third one
|
170
|
-
with additional
|
182
|
+
with additional text
|
183
|
+
{kdexample}
|
184
|
+
|
185
|
+
As with block quotes, you may be lazy when using the list item marker:
|
186
|
+
|
187
|
+
{kdexample::}
|
188
|
+
* A list item
|
189
|
+
with additional text
|
171
190
|
{kdexample}
|
172
191
|
|
173
192
|
As the content consists of block-level elements you can do things like the following:
|
@@ -298,7 +317,9 @@ level or span-level text, depending on the tag:
|
|
298
317
|
<div style="float: right">
|
299
318
|
Something that stays right and is not wrapped in a para.
|
300
319
|
</div>
|
301
|
-
|
320
|
+
|
321
|
+
{::options parse_block_html="true" /}
|
322
|
+
|
302
323
|
<div>
|
303
324
|
This is wrapped in a para.
|
304
325
|
</div>
|
@@ -372,14 +393,14 @@ Here is an example that shows how to insert comments into text:
|
|
372
393
|
|
373
394
|
{kdexample::}
|
374
395
|
This is a paragraph
|
375
|
-
{
|
396
|
+
{::comment}
|
376
397
|
This is a comment which is
|
377
398
|
completely ignored.
|
378
399
|
{:/comment}
|
379
400
|
... paragraph continues here.
|
380
401
|
|
381
402
|
Extensions can also be used
|
382
|
-
inline {
|
403
|
+
inline {::nomarkdown}**see**{:/}!
|
383
404
|
{kdexample}
|
384
405
|
|
385
406
|
As one can see from the above example, the syntax for extensions is nearly identical to that of
|
@@ -390,7 +411,7 @@ the extension name. Also, if the extension does not have a body, there needs to
|
|
390
411
|
before the closing brace:
|
391
412
|
|
392
413
|
{kdexample::}
|
393
|
-
{
|
414
|
+
{::options auto_ids="false" /}
|
394
415
|
|
395
416
|
# Header without id
|
396
417
|
{kdexample}
|
data/doc/tests.page
CHANGED
@@ -46,7 +46,7 @@ different Ruby interpreters:
|
|
46
46
|
![ruby 1.8.7p249]({relocatable: img/graph-ruby-1.8.7-249.png})
|
47
47
|
![ruby 1.8.7p302]({relocatable: img/graph-ruby-1.8.7-302.png})
|
48
48
|
![ruby 1.9.2p136]({relocatable: img/graph-ruby-1.9.2p136-136.png})
|
49
|
-
![jruby 1.
|
49
|
+
![jruby 1.6.0]({relocatable: img/graph-jruby-1.6.0-330.png})
|
50
50
|
|
51
51
|
[Markdown Test Suite]: http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
|
52
52
|
[MDTest]: http://www.michelf.com/docs/projets/mdtest-1.0.zip
|
@@ -40,8 +40,8 @@ module Kramdown
|
|
40
40
|
#
|
41
41
|
# Implementing a new converter is rather easy: just derive a new class from this class and put
|
42
42
|
# it in the Kramdown::Converter module (the latter is only needed if auto-detection should work
|
43
|
-
# properly). Then you need to implement the
|
44
|
-
#
|
43
|
+
# properly). Then you need to implement the #convert method which has to contain the conversion
|
44
|
+
# code for converting an element and has to return the conversion result.
|
45
45
|
#
|
46
46
|
# The actual transformation of the document tree can be done in any way. However, writing one
|
47
47
|
# method per element type is a straight forward way to do it - this is how the Html and Latex
|
@@ -81,10 +81,10 @@ module Kramdown
|
|
81
81
|
#
|
82
82
|
# 1. Look in the current working directory for the template.
|
83
83
|
#
|
84
|
-
# 2. Append
|
85
|
-
#
|
84
|
+
# 2. Append +.convertername+ (e.g. +.html+) to the template name and look for the resulting
|
85
|
+
# file in the current working directory.
|
86
86
|
#
|
87
|
-
# 3. Append
|
87
|
+
# 3. Append +.convertername+ to the template name and look for it in the kramdown data
|
88
88
|
# directory.
|
89
89
|
def self.convert(tree, options = {})
|
90
90
|
converter = new(tree, ::Kramdown::Options.merge(options.merge(tree.options[:options] || {})))
|
@@ -28,8 +28,8 @@ module Kramdown
|
|
28
28
|
|
29
29
|
# Converts a Kramdown::Document to HTML.
|
30
30
|
#
|
31
|
-
# You can customize the HTML converter by sub-classing it and overriding the
|
32
|
-
#
|
31
|
+
# You can customize the HTML converter by sub-classing it and overriding the +convert_NAME+
|
32
|
+
# methods. Each such method takes the following parameters:
|
33
33
|
#
|
34
34
|
# [+el+] The element of type +NAME+ to be converted.
|
35
35
|
#
|
@@ -69,8 +69,8 @@ module Kramdown
|
|
69
69
|
# The mapping of element type to conversion method.
|
70
70
|
DISPATCHER = Hash.new {|h,k| h[k] = "convert_#{k}"}
|
71
71
|
|
72
|
-
# Dispatch the conversion of the element +el+ to a
|
73
|
-
#
|
72
|
+
# Dispatch the conversion of the element +el+ to a +convert_TYPE+ method using the +type+ of
|
73
|
+
# the element.
|
74
74
|
def convert(el, indent = -@indent)
|
75
75
|
send(DISPATCHER[el.type], el, indent)
|
76
76
|
end
|
@@ -78,8 +78,8 @@ module Kramdown
|
|
78
78
|
# Return the converted content of the children of +el+ as a string. The parameter +indent+ has
|
79
79
|
# to be the amount of indentation used for the element +el+.
|
80
80
|
#
|
81
|
-
# Pushes +el+ onto the
|
82
|
-
#
|
81
|
+
# Pushes +el+ onto the @stack before converting the child elements and pops it from the stack
|
82
|
+
# afterwards.
|
83
83
|
def inner(el, indent)
|
84
84
|
result = ''
|
85
85
|
indent += @indent
|
@@ -212,14 +212,7 @@ module Kramdown
|
|
212
212
|
alias :convert_xml_pi :convert_xml_comment
|
213
213
|
|
214
214
|
def convert_table(el, indent)
|
215
|
-
|
216
|
-
alignment = ''
|
217
|
-
else
|
218
|
-
alignment = el.options[:alignment].map do |a|
|
219
|
-
"#{' '*(indent + @indent)}" << (a == :default ? "<col />" : "<col align=\"#{a}\" />") << "\n"
|
220
|
-
end.join('')
|
221
|
-
end
|
222
|
-
"#{' '*indent}<table#{html_attributes(el.attr)}>\n#{alignment}#{inner(el, indent)}#{' '*indent}</table>\n"
|
215
|
+
"#{' '*indent}<table#{html_attributes(el.attr)}>\n#{inner(el, indent)}#{' '*indent}</table>\n"
|
223
216
|
end
|
224
217
|
|
225
218
|
def convert_thead(el, indent)
|
@@ -234,7 +227,13 @@ module Kramdown
|
|
234
227
|
def convert_td(el, indent)
|
235
228
|
res = inner(el, indent)
|
236
229
|
type = (@stack[-2].type == :thead ? :th : :td)
|
237
|
-
|
230
|
+
attr = el.attr
|
231
|
+
alignment = @stack[-3].options[:alignment][@stack.last.children.index(el)]
|
232
|
+
if alignment != :default
|
233
|
+
attr = el.attr.dup
|
234
|
+
attr['style'] = (attr.has_key?('style') ? "#{attr['style']}; ": '') << "text-align: #{alignment}"
|
235
|
+
end
|
236
|
+
"#{' '*indent}<#{type}#{html_attributes(attr)}>#{res.empty? ? entity_to_str(ENTITY_NBSP) : res}</#{type}>\n"
|
238
237
|
end
|
239
238
|
|
240
239
|
def convert_comment(el, indent)
|