kramdown 0.13.4 → 0.13.5

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.

Files changed (77) hide show
  1. data/CONTRIBUTERS +2 -1
  2. data/ChangeLog +237 -0
  3. data/Rakefile +5 -4
  4. data/VERSION +1 -1
  5. data/bin/kramdown +1 -1
  6. data/doc/bg.png +0 -0
  7. data/doc/default.scss.css +127 -473
  8. data/doc/default.template +27 -40
  9. data/doc/design.scss.css +441 -0
  10. data/doc/documentation.page +4 -1
  11. data/doc/index.page +4 -9
  12. data/doc/installation.page +3 -3
  13. data/doc/news.page +1 -1
  14. data/doc/quickref.page +1 -1
  15. data/doc/sidebar.template +21 -0
  16. data/doc/syntax.page +65 -38
  17. data/doc/tests.page +6 -4
  18. data/lib/kramdown.rb +1 -1
  19. data/lib/kramdown/compatibility.rb +17 -3
  20. data/lib/kramdown/converter.rb +1 -1
  21. data/lib/kramdown/converter/base.rb +1 -1
  22. data/lib/kramdown/converter/html.rb +3 -2
  23. data/lib/kramdown/converter/kramdown.rb +13 -7
  24. data/lib/kramdown/converter/latex.rb +1 -1
  25. data/lib/kramdown/converter/toc.rb +1 -1
  26. data/lib/kramdown/document.rb +2 -2
  27. data/lib/kramdown/element.rb +1 -1
  28. data/lib/kramdown/error.rb +1 -1
  29. data/lib/kramdown/options.rb +1 -1
  30. data/lib/kramdown/parser.rb +1 -1
  31. data/lib/kramdown/parser/base.rb +1 -1
  32. data/lib/kramdown/parser/html.rb +5 -5
  33. data/lib/kramdown/parser/kramdown.rb +1 -1
  34. data/lib/kramdown/parser/kramdown/abbreviation.rb +1 -1
  35. data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
  36. data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
  37. data/lib/kramdown/parser/kramdown/block_boundary.rb +1 -1
  38. data/lib/kramdown/parser/kramdown/blockquote.rb +1 -1
  39. data/lib/kramdown/parser/kramdown/codeblock.rb +1 -1
  40. data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
  41. data/lib/kramdown/parser/kramdown/emphasis.rb +1 -1
  42. data/lib/kramdown/parser/kramdown/eob.rb +1 -1
  43. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  44. data/lib/kramdown/parser/kramdown/extensions.rb +1 -1
  45. data/lib/kramdown/parser/kramdown/footnote.rb +1 -1
  46. data/lib/kramdown/parser/kramdown/header.rb +1 -1
  47. data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
  48. data/lib/kramdown/parser/kramdown/html.rb +2 -2
  49. data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
  50. data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
  51. data/lib/kramdown/parser/kramdown/link.rb +1 -1
  52. data/lib/kramdown/parser/kramdown/list.rb +1 -1
  53. data/lib/kramdown/parser/kramdown/math.rb +4 -3
  54. data/lib/kramdown/parser/kramdown/paragraph.rb +1 -1
  55. data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
  56. data/lib/kramdown/parser/kramdown/table.rb +1 -1
  57. data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
  58. data/lib/kramdown/parser/markdown.rb +1 -1
  59. data/lib/kramdown/utils.rb +6 -1
  60. data/lib/kramdown/utils/entities.rb +1 -1
  61. data/lib/kramdown/utils/html.rb +2 -2
  62. data/lib/kramdown/utils/ordered_hash.rb +1 -1
  63. data/lib/kramdown/version.rb +2 -2
  64. data/man/man1/kramdown.1 +100 -100
  65. data/test/run_tests.rb +1 -1
  66. data/test/test_files.rb +1 -1
  67. data/test/testcases/block/04_header/with_auto_ids.html +2 -0
  68. data/test/testcases/block/04_header/with_auto_ids.text +3 -0
  69. data/test/testcases/block/09_html/html5_attributes.html +13 -0
  70. data/test/testcases/block/09_html/html5_attributes.text +13 -0
  71. data/test/testcases/block/09_html/simple.text +1 -1
  72. data/test/testcases/block/15_math/normal.html +2 -2
  73. data/test/testcases/span/05_html/normal.html +1 -1
  74. data/test/testcases/span/05_html/normal.text +1 -1
  75. data/test/testcases/span/math/normal.html +4 -0
  76. data/test/testcases/span/math/normal.text +5 -1
  77. metadata +55 -35
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown.
7
7
  #
@@ -50,7 +50,7 @@ module Kramdown
50
50
 
51
51
  # Return the HTML representation of the attributes +attr+.
52
52
  def html_attributes(attr)
53
- attr.map {|k,v| v.nil? ? '' : " #{k}=\"#{escape_html(v.to_s, :attribute)}\"" }.join('')
53
+ attr.map {|k,v| v.nil? || (k == 'id' && v.strip.empty?) ? '' : " #{k}=\"#{escape_html(v.to_s, :attribute)}\"" }.join('')
54
54
  end
55
55
 
56
56
  # :stopdoc:
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown.
7
7
  #
@@ -23,6 +23,6 @@
23
23
  module Kramdown
24
24
 
25
25
  # The kramdown version.
26
- VERSION = '0.13.4'
26
+ VERSION = '0.13.5'
27
27
 
28
28
  end
data/man/man1/kramdown.1 CHANGED
@@ -33,6 +33,29 @@ Show the help.
33
33
 
34
34
  .SH KRAMDOWN OPTIONS
35
35
 
36
+ .TP
37
+ .B \-\-auto-id-prefix ARG
38
+
39
+ Prefix used for automatically generated heaer IDs
40
+
41
+ This option can be used to set a prefix for the automatically generated
42
+ header IDs so that there is no conflict when rendering multiple kramdown
43
+ documents into one output file separately. The prefix should only
44
+ contain characters that are valid in an ID!
45
+
46
+ Default: ''
47
+ Used by: HTML/Latex converter
48
+
49
+
50
+ .TP
51
+ .B \-\-coderay-line-number-start ARG
52
+
53
+ The start value for the line numbers
54
+
55
+ Default: 1
56
+ Used by: HTML converter
57
+
58
+
36
59
  .TP
37
60
  .B \-\-template ARG
38
61
 
@@ -57,29 +80,28 @@ Used by: all converters
57
80
 
58
81
 
59
82
  .TP
60
- .B \-\-[no\-]auto-ids
83
+ .B \-\-toc-levels ARG
61
84
 
62
- Use automatic header ID generation
85
+ Defines the levels that are used for the table of contents
63
86
 
64
- If this option is `true`, ID values for all headers are automatically
65
- generated if no ID is explicitly specified.
87
+ The individual levels can be specified by separating them with commas
88
+ (e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
89
+ specified levels are used for the table of contents.
66
90
 
67
- Default: true
91
+ Default: 1..6
68
92
  Used by: HTML/Latex converter
69
93
 
70
94
 
71
95
  .TP
72
- .B \-\-auto-id-prefix ARG
96
+ .B \-\-coderay-line-numbers ARG
73
97
 
74
- Prefix used for automatically generated heaer IDs
98
+ Defines how and if line numbers should be shown
75
99
 
76
- This option can be used to set a prefix for the automatically generated
77
- header IDs so that there is no conflict when rendering multiple kramdown
78
- documents into one output file separately. The prefix should only
79
- contain characters that are valid in an ID!
100
+ The possible values are :table, :inline, :list or nil. If this option is
101
+ nil, no line numbers are shown.
80
102
 
81
- Default: ''
82
- Used by: HTML/Latex converter
103
+ Default: :inline
104
+ Used by: HTML converter
83
105
 
84
106
 
85
107
  .TP
@@ -97,105 +119,108 @@ Used by: kramdown parser
97
119
 
98
120
 
99
121
  .TP
100
- .B \-\-[no\-]parse-span-html
101
-
102
- Process kramdown syntax in span HTML tags
122
+ .B \-\-coderay-tab-width ARG
103
123
 
104
- If this option is `true`, the kramdown parser processes the content of
105
- span HTML tags as text containing span-level elements.
124
+ The tab width used in highlighted code
106
125
 
107
- Default: true
108
- Used by: kramdown parser
126
+ Used by: HTML converter
109
127
 
110
128
 
111
129
  .TP
112
- .B \-\-[no\-]html-to-native
113
-
114
- Convert HTML elements to native elements
115
-
116
- If this option is `true`, the parser converts HTML elements to native
117
- elements. For example, when parsing `<em>hallo</em>` the emphasis tag
118
- would normally be converted to an `:html` element with tag type `:em`.
119
- If `html_to_native` is `true`, then the emphasis would be converted to a
120
- native `:em` element.
130
+ .B \-\-line-width ARG
121
131
 
122
- This is useful for converters that cannot deal with HTML elements.
132
+ Defines the line width to be used when outputting a document
123
133
 
124
- Default: false
125
- Used by: kramdown parser
134
+ Default: 72
135
+ Used by: kramdown converter
126
136
 
127
137
 
128
138
  .TP
129
- .B \-\-footnote-nr ARG
139
+ .B \-\-[no\-]parse-span-html
130
140
 
131
- The number of the first footnote
141
+ Process kramdown syntax in span HTML tags
132
142
 
133
- This option can be used to specify the number that is used for the first
134
- footnote.
143
+ If this option is `true`, the kramdown parser processes the content of
144
+ span HTML tags as text containing span-level elements.
135
145
 
136
- Default: 1
137
- Used by: HTML converter
146
+ Default: true
147
+ Used by: kramdown parser
138
148
 
139
149
 
140
150
  .TP
141
- .B \-\-coderay-wrap ARG
142
-
143
- Defines how the highlighted code should be wrapped
151
+ .B \-\-coderay-bold-every ARG
144
152
 
145
- The possible values are :span, :div or nil.
153
+ Defines how often a line number should be made bold
146
154
 
147
- Default: :div
155
+ Default: 10
148
156
  Used by: HTML converter
149
157
 
150
158
 
151
159
  .TP
152
- .B \-\-coderay-line-numbers ARG
160
+ .B \-\-latex-headers ARG
153
161
 
154
- Defines how and if line numbers should be shown
162
+ Defines the LaTeX commands for different header levels
155
163
 
156
- The possible values are :table, :inline, :list or nil. If this option is
157
- nil, no line numbers are shown.
164
+ The commands for the header levels one to six can be specified by
165
+ separating them with commas.
158
166
 
159
- Default: :inline
160
- Used by: HTML converter
167
+ Default: section,subsection,subsubsection,paragraph,subparagraph,subsubparagraph
168
+ Used by: Latex converter
161
169
 
162
170
 
163
171
  .TP
164
- .B \-\-coderay-line-number-start ARG
172
+ .B \-\-[no\-]html-to-native
165
173
 
166
- The start value for the line numbers
174
+ Convert HTML elements to native elements
167
175
 
168
- Default: 1
169
- Used by: HTML converter
176
+ If this option is `true`, the parser converts HTML elements to native
177
+ elements. For example, when parsing `<em>hallo</em>` the emphasis tag
178
+ would normally be converted to an `:html` element with tag type `:em`.
179
+ If `html_to_native` is `true`, then the emphasis would be converted to a
180
+ native `:em` element.
181
+
182
+ This is useful for converters that cannot deal with HTML elements.
183
+
184
+ Default: false
185
+ Used by: kramdown parser
170
186
 
171
187
 
172
188
  .TP
173
- .B \-\-coderay-tab-width ARG
189
+ .B \-\-coderay-css ARG
174
190
 
175
- The tab width used in highlighted code
191
+ Defines how the highlighted code gets styled
176
192
 
193
+ Possible values are :class (CSS classes are applied to the code
194
+ elements, one must supply the needed CSS file) or :style (default CSS
195
+ styles are directly applied to the code elements).
196
+
197
+ Default: style
177
198
  Used by: HTML converter
178
199
 
179
200
 
180
201
  .TP
181
- .B \-\-coderay-bold-every ARG
202
+ .B \-\-smart-quotes ARG
182
203
 
183
- Defines how often a line number should be made bold
204
+ Defines the HTML entity names or code points for smart quote output
184
205
 
185
- Default: 10
186
- Used by: HTML converter
206
+ The entities identified by entity name or code point that should be
207
+ used for, in order, a left single quote, a right single quote, a left
208
+ double and a right double quote are specified by separating them with
209
+ commas.
210
+
211
+ Default: lsquo,rsquo,ldquo,rdquo
212
+ Used by: HTML/Latex converter
187
213
 
188
214
 
189
215
  .TP
190
- .B \-\-coderay-css ARG
216
+ .B \-\-footnote-nr ARG
191
217
 
192
- Defines how the highlighted code gets styled
218
+ The number of the first footnote
193
219
 
194
- Possible values are :class (CSS classes are applied to the code
195
- elements, one must supply the needed CSS file) or :style (default CSS
196
- styles are directly applied to the code elements).
220
+ This option can be used to specify the number that is used for the first
221
+ footnote.
197
222
 
198
- Default: style
223
+ Default: 1
199
224
  Used by: HTML converter
200
225
 
201
226
 
@@ -215,50 +240,25 @@ Used by: HTML converter, kramdown converter
215
240
 
216
241
 
217
242
  .TP
218
- .B \-\-toc-levels ARG
219
-
220
- Defines the levels that are used for the table of contents
221
-
222
- The individual levels can be specified by separating them with commas
223
- (e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
224
- specified levels are used for the table of contents.
225
-
226
- Default: 1..6
227
- Used by: HTML/Latex converter
228
-
229
-
230
- .TP
231
- .B \-\-line-width ARG
232
-
233
- Defines the line width to be used when outputting a document
234
-
235
- Default: 72
236
- Used by: kramdown converter
237
-
238
-
239
- .TP
240
- .B \-\-latex-headers ARG
243
+ .B \-\-coderay-wrap ARG
241
244
 
242
- Defines the LaTeX commands for different header levels
245
+ Defines how the highlighted code should be wrapped
243
246
 
244
- The commands for the header levels one to six can be specified by
245
- separating them with commas.
247
+ The possible values are :span, :div or nil.
246
248
 
247
- Default: section,subsection,subsubsection,paragraph,subparagraph,subsubparagraph
248
- Used by: Latex converter
249
+ Default: :div
250
+ Used by: HTML converter
249
251
 
250
252
 
251
253
  .TP
252
- .B \-\-smart-quotes ARG
254
+ .B \-\-[no\-]auto-ids
253
255
 
254
- Defines the HTML entity names or code points for smart quote output
256
+ Use automatic header ID generation
255
257
 
256
- The entities identified by entity name or code point that should be
257
- used for, in order, a left single quote, a right single quote, a left
258
- double and a right double quote are specified by separating them with
259
- commas.
258
+ If this option is `true`, ID values for all headers are automatically
259
+ generated if no ID is explicitly specified.
260
260
 
261
- Default: lsquo,rsquo,ldquo,rdquo
261
+ Default: true
262
262
  Used by: HTML/Latex converter
263
263
 
264
264
 
data/test/run_tests.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown.
7
7
  #
data/test/test_files.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown.
7
7
  #
@@ -15,3 +15,5 @@
15
15
  <h1 id="section-1">33333</h1>
16
16
 
17
17
  <h2 id="hallo-2">hallO</h2>
18
+
19
+ <h1>Header without ID</h1>
@@ -17,3 +17,6 @@ Not now
17
17
  # 33333
18
18
 
19
19
  ## hallO
20
+
21
+ # Header without ID
22
+ {: id=""}
@@ -0,0 +1,13 @@
1
+ <p lang="en" style="nothing" class="">paragraph</p>
2
+
3
+ <p lang="en" style="nothing" class="">paragraph</p>
4
+
5
+ <p lang="en" style="nothing" class="">paragraph</p>
6
+
7
+ <p lang="en" class="" style="nothing">paragraph</p>
8
+
9
+ <p class="" lang="en" style="nothing">paragraph</p>
10
+
11
+ <p class="">paragraph</p>
12
+
13
+ <p class="">paragraph</p>
@@ -0,0 +1,13 @@
1
+ <p lang="en" style='nothing' class>paragraph</p>
2
+
3
+ <p lang='en' style="nothing" class>paragraph</p>
4
+
5
+ <p lang='en' style="nothing" class >paragraph</p>
6
+
7
+ <p lang='en' class style="nothing">paragraph</p>
8
+
9
+ <p class lang='en' style="nothing">paragraph</p>
10
+
11
+ <p cLaSs>paragraph</p>
12
+
13
+ <p class >paragraph</p>
@@ -40,7 +40,7 @@ hallo
40
40
 
41
41
  para6
42
42
 
43
- <div><div class="clear"></div>
43
+ <div><div cLASs="clear"></div>
44
44
  Another para.
45
45
  </div>
46
46
 
@@ -6,10 +6,10 @@
6
6
  <p><script type="math/tex">\lambda_\alpha > 5</script>
7
7
  This is a para.</p>
8
8
 
9
- <script type="math/tex; mode=display">\begin{align*}
9
+ <script type="math/tex; mode=display"><![CDATA[\begin{align*}
10
10
  &=5 \\
11
11
  &=6 \\
12
- \end{align*}</script>
12
+ \end{align*}]]></script>
13
13
 
14
14
  <script type="math/tex; mode=display">5+5</script>
15
15
 
@@ -1,4 +1,4 @@
1
- <p>Empty <a name="anchor" id="anchor"></a>!</p>
1
+ <p>Empty <a name="anchor" id="anchor" class=""></a>!</p>
2
2
 
3
3
  <p><a href="test">title</a> is a title.</p>
4
4
 
@@ -1,4 +1,4 @@
1
- Empty <a name="anchor" id="anchor"></A>!
1
+ Empty <a NaMe="anchor" ID="anchor" cLaSs></A>!
2
2
 
3
3
  <a href="test">title</a> is a title.
4
4
 
@@ -3,3 +3,7 @@
3
3
  <p><script type="math/tex">5+5</script> inline math, $5.00 $$no math$$</p>
4
4
 
5
5
  <p>$$5+5$$ inline math</p>
6
+
7
+ <p><script type="math/tex">5+5</script></p>
8
+
9
+ <p>$$5+5$$</p>