kramdown 0.13.7 → 0.13.8

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.

@@ -1,11 +1,15 @@
1
1
  Count Name
2
2
  ======= ====
3
- 513 Thomas Leitner <t_leitner@gmx.at>
3
+ 528 Thomas Leitner <t_leitner@gmx.at>
4
4
  3 gettalong <t_leitner@gmx.at>
5
5
  3 Ben Armston <ben.armston@googlemail.com>
6
6
  3 Alex Marandon <contact@alexmarandon.com>
7
+ 2 Bran <m.versum@gmail.com>
7
8
  1 tomykaira <tomykaira@gmail.com>
8
9
  1 Postmodern <postmodern.mod3@gmail.com>
10
+ 1 Michal Till <michal.till@gmail.com>
9
11
  1 John Croisant <jacius@gmail.com>
10
12
  1 Joe Fiorini <joe@faithfulgeek.org>
13
+ 1 Gioele Barabucci <gioele@svario.it>
11
14
  1 Damien Pollet <damien.pollet@gmail.com>
15
+ 1 Alex Tomlins <alex.tomlins@digital.cabinet-office.gov.uk>
data/ChangeLog CHANGED
@@ -1,3 +1,228 @@
1
+ commit 69fbdcbf2b3585f92819f941f695f2ab10d2051f
2
+ Author: Thomas Leitner <t_leitner@gmx.at>
3
+ Date: Fri Aug 31 18:35:39 2012 +0200
4
+
5
+ Fixed API index page documentation
6
+
7
+ Since the README.md file now contains Markdown and RDoc markup,
8
+ the API index page documentation was moved to another file.
9
+
10
+ Rakefile
11
+ lib/kramdown/document.rb
12
+
13
+ commit 03c304e4dc8e996c48c5aa517d881985023915c3
14
+ Author: Thomas Leitner <t_leitner@gmx.at>
15
+ Date: Fri Aug 31 18:13:09 2012 +0200
16
+
17
+ Updated release notes and version number
18
+
19
+ doc/news/release_0_13_8.page
20
+ doc/sidebar.template
21
+ lib/kramdown/version.rb
22
+
23
+ commit 0daf6f3452517602590349398f743e91c95ee053
24
+ Author: Thomas Leitner <t_leitner@gmx.at>
25
+ Date: Fri Aug 31 18:06:07 2012 +0200
26
+
27
+ Fixed enable_coderay patch
28
+
29
+ * Fixed code of enable_coderay option to generate backwards-compatible
30
+ output
31
+ * Updated documentation
32
+
33
+ doc/converter/html.page
34
+ lib/kramdown/converter/html.rb
35
+ lib/kramdown/options.rb
36
+ test/test_files.rb
37
+ test/testcases/block/06_codeblock/disable-highlighting.html
38
+
39
+ commit 0b9d8fc2346b346ffc437fe546db47d500ff8415
40
+ Merge: 9085ede 4b5c0f8
41
+ Author: Thomas Leitner <t_leitner@gmx.at>
42
+ Date: Fri Aug 31 17:34:50 2012 +0200
43
+
44
+ Merge branch 'option-enable-coderay' of https://github.com/unibr/kramdown
45
+
46
+ commit 9085ede998c4a1cc7d0869a43d4ea511ce649a89
47
+ Author: Thomas Leitner <t_leitner@gmx.at>
48
+ Date: Fri Aug 31 16:35:16 2012 +0200
49
+
50
+ Updated description of :coderay_default_lang to make it clear that it is only used for code blocks
51
+
52
+ lib/kramdown/options.rb
53
+
54
+ commit f0efc41dba131cfd6965cf16f852218b7936d4b8
55
+ Author: Thomas Leitner <t_leitner@gmx.at>
56
+ Date: Fri Aug 31 16:19:28 2012 +0200
57
+
58
+ Fixed double output of markdown attribute on HTML elements in kramdown converter
59
+
60
+ lib/kramdown/converter/kramdown.rb
61
+
62
+ commit a22b5d32623b5ae7f1ce7b38684fc8bb3228caed
63
+ Merge: 46bd5f6 df8ff9d
64
+ Author: Thomas Leitner <t_leitner@gmx.at>
65
+ Date: Thu Aug 30 01:57:56 2012 -0700
66
+
67
+ Merge pull request #17 from gioele/tests-on-ruby193
68
+
69
+ Work around RakeTest problems with Ruby 1.9.3
70
+
71
+ commit 4b5c0f8d59dac123a088b73a4f3a4b4a282fb5b9
72
+ Author: Bran <m.versum@gmail.com>
73
+ Date: Thu Aug 30 10:45:44 2012 +0800
74
+
75
+ support disable coderay
76
+
77
+ + add option `:enable_coderay`, which can be used to disable coderay.
78
+ the default vaule is `true` to be compatible with current behavior
79
+ + add content about it in doc
80
+
81
+ doc/converter/html.page
82
+ lib/kramdown/converter/html.rb
83
+ lib/kramdown/options.rb
84
+ test/testcases/block/06_codeblock/disable-highlighting.html
85
+ test/testcases/block/06_codeblock/disable-highlighting.options
86
+ test/testcases/block/06_codeblock/disable-highlighting.text
87
+
88
+ commit df8ff9df6968993e73fcc3a8a08db94e4683a23d
89
+ Author: Gioele Barabucci <gioele@svario.it>
90
+ Date: Wed Aug 29 18:52:39 2012 +0200
91
+
92
+ Work around RakeTest problems with Ruby 1.9.3
93
+
94
+ Suggested by <https://github.com/jimweirich/rake/issues/51> and
95
+ <https://github.com/colszowka/simplecov/commit/9d64656555e0e75c04bd826f7a22d8cfcc58bfbd>.
96
+
97
+ Rakefile
98
+
99
+ commit 46bd5f670b674fe3dcd310069e334ac4d7a0b008
100
+ Author: Thomas Leitner <t_leitner@gmx.at>
101
+ Date: Tue Aug 28 18:12:07 2012 +0200
102
+
103
+ Fixed line breaks and links in README.md
104
+
105
+ README.md
106
+
107
+ commit 7721cb3158d88c31218977cff478a0f1b4fdbb98
108
+ Author: Bran <m.versum@gmail.com>
109
+ Date: Tue Aug 28 16:33:14 2012 +0800
110
+
111
+ Revise README
112
+
113
+ + rename README to README.md
114
+ + revise the content
115
+
116
+ README
117
+ README.md
118
+
119
+ commit 0c7ee71cde6eaf67b76ed048fda0c2dbdbd6480f
120
+ Author: Thomas Leitner <t_leitner@gmx.at>
121
+ Date: Fri Aug 10 22:09:50 2012 +0200
122
+
123
+ Fixed RF#29626: Link obfuscation did too much
124
+
125
+ The text of a link with a mailto-scheme is now only obfuscated,
126
+ if the text of the link is the same as the linked-to email address.
127
+
128
+ lib/kramdown/converter/html.rb
129
+ test/testcases/span/autolinks/url_links.html
130
+ test/testcases/span/autolinks/url_links.text
131
+
132
+ commit 3b2a3abc41ab61ff3d581e78d527c89a1d6e61ed
133
+ Author: Thomas Leitner <t_leitner@gmx.at>
134
+ Date: Fri Aug 10 00:41:39 2012 +0200
135
+
136
+ Fixed problem with multiple similar abbreviatons
137
+
138
+ When one abbreviation definition contains another (like CSS and CSS3), the
139
+ parser did not always do the right thing. Fixed that by making sure that
140
+ the longest abbreviations are replaced first.
141
+
142
+ lib/kramdown/parser/kramdown/abbreviation.rb
143
+ test/testcases/span/abbreviations/abbrev.html
144
+ test/testcases/span/abbreviations/abbrev.text
145
+
146
+ commit 0820af7cbd308fb857b93f7ca23c5c233598f696
147
+ Merge: 70d9342 b5ec9e4
148
+ Author: Thomas Leitner <t_leitner@gmx.at>
149
+ Date: Thu Aug 9 15:37:15 2012 -0700
150
+
151
+ Merge pull request #13 from alphagov/entities_in_abbr_titles
152
+
153
+ Convert HMTL entities in abbreviation titles
154
+
155
+ commit 70d9342820f6b146417a7e9b7f00d1c0d98407f0
156
+ Author: Thomas Leitner <t_leitner@gmx.at>
157
+ Date: Thu Aug 9 23:45:36 2012 +0200
158
+
159
+ Fixed invalid documentation of default value of latex_headers option
160
+
161
+ lib/kramdown/options.rb
162
+
163
+ commit 1264a17dbd04c1e6abe7510961a7a4a57c33494c
164
+ Author: Thomas Leitner <t_leitner@gmx.at>
165
+ Date: Thu Aug 9 16:22:10 2012 +0200
166
+
167
+ Updated implementation of header offsets
168
+
169
+ * Updated header_offset documentation
170
+ * Moved implementation of header level calculation into helper method
171
+ defined on Converter::Base
172
+ * Latex and kramdown converters now use the header_offset option, too
173
+
174
+ lib/kramdown/converter/base.rb
175
+ lib/kramdown/converter/html.rb
176
+ lib/kramdown/converter/kramdown.rb
177
+ lib/kramdown/converter/latex.rb
178
+ lib/kramdown/options.rb
179
+ test/test_files.rb
180
+ test/testcases/block/04_header/header_type_offset.html
181
+ test/testcases/block/04_header/header_type_offset.kramdown
182
+ test/testcases/block/04_header/header_type_offset.latex
183
+ test/testcases/block/04_header/header_type_offset.text
184
+
185
+ commit bfcd994349f7224d95b699235dc3755708112959
186
+ Merge: be56987 e1ac291
187
+ Author: Thomas Leitner <t_leitner@gmx.at>
188
+ Date: Wed Aug 8 22:49:52 2012 +0200
189
+
190
+ Merge branch 'master' of https://github.com/tillda/kramdown
191
+
192
+ commit b5ec9e4fd765da62c1bfdbb307d379d955d0b0a4
193
+ Author: Alex Tomlins <alex.tomlins@digital.cabinet-office.gov.uk>
194
+ Date: Fri Aug 3 13:01:47 2012 +0100
195
+
196
+ Convert entities in abbreviation titles
197
+
198
+ previously if entities in abbreviation titles had reserved HTML chars in
199
+ them (e.g. &), these weren't converted to entities. This causes errors
200
+ when processing the resulting markup in nokogiri and the like.
201
+
202
+ lib/kramdown/converter/html.rb
203
+ test/testcases/span/abbreviations/abbrev.html
204
+ test/testcases/span/abbreviations/abbrev.text
205
+
206
+ commit e1ac291052deb9e9e4185e13666446a8a784f533
207
+ Author: Michal Till <michal.till@gmail.com>
208
+ Date: Thu Jul 5 15:32:15 2012 +0200
209
+
210
+ Add the ability to shift levels of all <Hx> elements by :header_offset option.
211
+
212
+ lib/kramdown/converter/html.rb
213
+ lib/kramdown/options.rb
214
+ test/testcases/block/04_header/header_type_offset.html
215
+ test/testcases/block/04_header/header_type_offset.options
216
+ test/testcases/block/04_header/header_type_offset.text
217
+
218
+ commit be56987fc283db3997d47a47ba93f7b6c48d562f
219
+ Author: Thomas Leitner <t_leitner@gmx.at>
220
+ Date: Wed Jul 4 13:07:18 2012 +0200
221
+
222
+ Re-enabled MathJax on the kramdown website
223
+
224
+ doc/default.template
225
+
1
226
  commit 0914bb652dad9ab1d48abc6de6da7a5ccc0e7996
2
227
  Author: Thomas Leitner <t_leitner@gmx.at>
3
228
  Date: Sun Jun 3 09:48:58 2012 +0200
@@ -0,0 +1,50 @@
1
+ # kramdown
2
+
3
+ ## Introduction
4
+
5
+ kramdown is yet-another-markdown-parser but fast, pure Ruby, using a strict syntax definition and
6
+ supporting several common extensions.
7
+
8
+ The syntax definition for the kramdown syntax can be found in **doc/syntax.page** (or online at
9
+ <http://kramdown.rubyforge.org/syntax.html>) and a quick reference is available in
10
+ **doc/quickref.page** or online at <http://kramdown.rubyforge.org/quickref.html>.
11
+
12
+ The kramdown library is mainly written to support the kramdown-to-HTML conversion chain. However,
13
+ due to its flexibility it supports other input and output formats as well. Here is a list of the
14
+ supported formats:
15
+
16
+ * input formats: kramdown (a Markdown superset), Markdown, HTML
17
+ * output formats: HTML, kramdown, LaTeX (and therefore PDF)
18
+
19
+ All the documentation on the available input and output formats is available in the **doc/**
20
+ directory and online at <http://kramdown.rubyforge.org>.
21
+
22
+
23
+ ## Usage
24
+
25
+ kramdown has a basic *Cloth API, so using kramdown is as easy as
26
+
27
+ ```ruby
28
+ require 'kramdown'
29
+
30
+ Kramdown::Document.new(text).to_html
31
+ ```
32
+
33
+ For detailed information have a look at the API documentation of the `Kramdown::Document` class.
34
+
35
+ The full API documentation is available at <http://kramdown.rubyforge.org/rdoc/>, other sites with an
36
+ API documentation for kramdown probably don't provide the complete documentation!
37
+
38
+
39
+ ## Development
40
+
41
+ Just clone the git repository as described in **doc/installation.page** and you are good to go. You
42
+ probably want to install `rake` so that you can use the provided rake tasks. Aside from that:
43
+
44
+ * The `tidy` binary needs to be installed for the automatically derived tests to work.
45
+ * The `latex` binary needs to be installed for the latex-compilation tests to work.
46
+
47
+
48
+ ## License
49
+
50
+ GPLv3 - see the **COPYING** file.
data/Rakefile CHANGED
@@ -85,6 +85,7 @@ if defined? Webgen
85
85
  Webgen::WebgenTask.new('htmldoc') do |site|
86
86
  site.clobber_outdir = true
87
87
  site.config_block = lambda do |config|
88
+ YAML::ENGINE.yamler = 'syck'
88
89
  config['sources'] = [['/', "Webgen::Source::FileSystem", 'doc']]
89
90
  config['output'] = ['Webgen::Output::FileSystem', 'htmldoc']
90
91
  config.default_processing_pipeline('Page' => 'erb,tags,kramdown,blocks,fragments')
@@ -103,8 +104,8 @@ if defined? RDoc::Task
103
104
  rd = RDoc::Task.new do |rdoc|
104
105
  rdoc.rdoc_dir = 'htmldoc/rdoc'
105
106
  rdoc.title = 'kramdown'
106
- rdoc.main = 'README'
107
- rdoc.rdoc_files.include('lib', 'README')
107
+ rdoc.main = 'lib/kramdown/document.rb'
108
+ rdoc.rdoc_files.include('lib')
108
109
  end
109
110
  end
110
111
 
@@ -116,6 +117,7 @@ end
116
117
  tt = Rake::TestTask.new do |test|
117
118
  test.warning = true
118
119
  test.libs << 'test'
120
+ test.test_files = FileList['test/test_*.rb']
119
121
  end
120
122
 
121
123
  # Release tasks and development tasks ############################################
@@ -137,7 +139,7 @@ EOF
137
139
  PKG_FILES = FileList.new([
138
140
  'Rakefile',
139
141
  'setup.rb',
140
- 'COPYING', 'GPL', 'README', 'AUTHORS',
142
+ 'COPYING', 'GPL', 'README.md', 'AUTHORS',
141
143
  'VERSION', 'ChangeLog', 'CONTRIBUTERS',
142
144
  'bin/*',
143
145
  'benchmark/*',
@@ -202,8 +204,7 @@ EOF
202
204
  #### Documentation
203
205
 
204
206
  s.has_rdoc = true
205
- s.rdoc_options = ['--main', 'README']
206
- s.extra_rdoc_files = 'README'
207
+ s.rdoc_options = ['--main', 'lib/kramdown/document.rb']
207
208
 
208
209
  #### Author and project details
209
210
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.13.7
1
+ 0.13.8
@@ -8,7 +8,7 @@
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" />
10
10
  <link href="{relocatable: news.atom}" type="application/atom+xml" rel="alternate" />
11
- <!-- <script src="http://kramdown.rubyforge.org/MathJax/MathJax.js" type="text/javascript"></script> -->
11
+ <script src="http://kramdown.rubyforge.org/MathJax/MathJax.js" type="text/javascript"></script>
12
12
  <title>{title:} | kramdown</title>
13
13
  </head>
14
14
  <body>
@@ -1,7 +1,7 @@
1
1
  <h2>News</h2>
2
2
 
3
- <p>The latest version of kramdown is <b>0.13.7</b> and it was released
4
- on <b>2012-06-03</b>.</p>
3
+ <p>The latest version of kramdown is <b>0.13.8</b> and it was released
4
+ on <b>2012-08-31</b>.</p>
5
5
 
6
6
  <p>More <a href="{relocatable: news.html}">news</a>…</p>
7
7
 
@@ -135,6 +135,13 @@ module Kramdown
135
135
  @options[:toc_levels].include?(el.options[:level])
136
136
  end
137
137
 
138
+ # Return the output header level given a level.
139
+ #
140
+ # Uses the +header_offset+ option for adjusting the header level.
141
+ def output_header_level(level)
142
+ [[level + @options[:header_offset], 6].min, 1].max
143
+ end
144
+
138
145
  # Generate an unique alpha-numeric ID from the the string +str+ for use as a header ID.
139
146
  #
140
147
  # Uses the option +auto_id_prefix+: the value of this option is prepended to every generated
@@ -64,6 +64,7 @@ module Kramdown
64
64
  @toc_code = nil
65
65
  @indent = 2
66
66
  @stack = []
67
+ @coderay_enabled = @options[:enable_coderay] && HIGHLIGHTING_AVAILABLE
67
68
  end
68
69
 
69
70
  # The mapping of element type to conversion method.
@@ -108,7 +109,7 @@ module Kramdown
108
109
  end
109
110
 
110
111
  def convert_codeblock(el, indent)
111
- if (el.attr['lang'] || @options[:coderay_default_lang]) && HIGHLIGHTING_AVAILABLE
112
+ if @coderay_enabled && (el.attr['lang'] || @options[:coderay_default_lang])
112
113
  attr = el.attr.dup
113
114
  opts = {:wrap => @options[:coderay_wrap], :line_numbers => @options[:coderay_line_numbers],
114
115
  :line_number_start => @options[:coderay_line_number_start], :tab_width => @options[:coderay_tab_width],
@@ -144,7 +145,8 @@ module Kramdown
144
145
  attr['id'] = generate_id(el.options[:raw_text])
145
146
  end
146
147
  @toc << [el.options[:level], attr['id'], el.children] if attr['id'] && in_toc?(el)
147
- "#{' '*indent}<h#{el.options[:level]}#{html_attributes(attr)}>#{inner(el, indent)}</h#{el.options[:level]}>\n"
148
+ level = output_header_level(el.options[:level])
149
+ "#{' '*indent}<h#{level}#{html_attributes(attr)}>#{inner(el, indent)}</h#{level}>\n"
148
150
  end
149
151
 
150
152
  def convert_hr(el, indent)
@@ -253,8 +255,9 @@ module Kramdown
253
255
  res = inner(el, indent)
254
256
  attr = el.attr.dup
255
257
  if attr['href'] =~ /^mailto:/
256
- attr['href'] = obfuscate('mailto') << ":" << obfuscate(attr['href'].sub(/^mailto:/, ''))
257
- res = obfuscate(res)
258
+ mail_addr = attr['href'].sub(/^mailto:/, '')
259
+ attr['href'] = obfuscate('mailto') << ":" << obfuscate(mail_addr)
260
+ res = obfuscate(res) if res == mail_addr
258
261
  end
259
262
  "<a#{html_attributes(attr)}>#{res}</a>"
260
263
  end
@@ -264,7 +267,7 @@ module Kramdown
264
267
  end
265
268
 
266
269
  def convert_codespan(el, indent)
267
- if el.attr['lang'] && HIGHLIGHTING_AVAILABLE
270
+ if @coderay_enabled && el.attr['lang']
268
271
  attr = el.attr.dup
269
272
  result = CodeRay.scan(el.value, attr.delete('lang').to_sym).html(:wrap => :span, :css => @options[:coderay_css]).chomp
270
273
  "<code#{html_attributes(attr)}>#{result}</code>"
@@ -322,7 +325,7 @@ module Kramdown
322
325
 
323
326
  def convert_abbreviation(el, indent)
324
327
  title = @root.options[:abbrev_defs][el.value]
325
- "<abbr#{!title.empty? ? " title=\"#{title}\"" : ''}>#{el.value}</abbr>"
328
+ "<abbr#{!title.empty? ? html_attributes(:title => title) : ''}>#{el.value}</abbr>"
326
329
  end
327
330
 
328
331
  def convert_root(el, indent)
@@ -117,7 +117,7 @@ module Kramdown
117
117
 
118
118
  def convert_header(el, opts)
119
119
  res = ''
120
- res << "#{'#' * el.options[:level]} #{inner(el, opts)}"
120
+ res << "#{'#' * output_header_level(el.options[:level])} #{inner(el, opts)}"
121
121
  res << " {##{el.attr['id']}}" if el.attr['id'] && !el.attr['id'].strip.empty?
122
122
  res << "\n"
123
123
  end
@@ -201,8 +201,9 @@ module Kramdown
201
201
  "<#{el.value}#{html_attributes(el.attr)}" << (!res.empty? || HTML_TAGS_WITH_BODY.include?(el.value) ? ">#{res}</#{el.value}>" : " />")
202
202
  else
203
203
  output = ''
204
- output << "<#{el.value}#{html_attributes(el.attr)}"
205
- output << " markdown=\"1\"" if markdown_attr
204
+ attr = el.attr.dup
205
+ attr['markdown'] = '1' if markdown_attr
206
+ output << "<#{el.value}#{html_attributes(attr)}"
206
207
  if !res.empty? && el.options[:content_model] != :block
207
208
  output << ">#{res}</#{el.value}>"
208
209
  elsif !res.empty?