[DRE-commits] [ruby-kramdown] 01/03: Imported Upstream version 1.2.0
Youhei SASAKI
uwabami-guest at alioth.debian.org
Wed Sep 4 09:06:30 UTC 2013
This is an automated email from the git hooks/post-receive script.
uwabami-guest pushed a commit to branch master
in repository ruby-kramdown.
commit 4ee7a2d22afdb3e150d59ffa479df01e14888741
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date: Wed Sep 4 16:51:08 2013 +0900
Imported Upstream version 1.2.0
---
CONTRIBUTERS | 6 +-
Rakefile | 4 +-
VERSION | 2 +-
checksums.yaml.gz | Bin 427 -> 270 bytes
data/kramdown/document.html | 4 ++
doc/documentation.page | 2 +-
doc/installation.page | 4 +-
doc/sidebar.template | 4 +-
doc/syntax.page | 9 ++-
lib/kramdown/converter/base.rb | 2 +-
lib/kramdown/converter/html.rb | 2 +-
lib/kramdown/converter/latex.rb | 4 +-
lib/kramdown/parser.rb | 1 +
lib/kramdown/parser/gfm.rb | 40 +++++++++++
lib/kramdown/parser/html.rb | 1 +
lib/kramdown/parser/kramdown/codeblock.rb | 8 +--
lib/kramdown/parser/kramdown/extensions.rb | 2 +-
lib/kramdown/parser/kramdown/header.rb | 2 +-
lib/kramdown/utils/unidecoder.rb | 11 ++-
lib/kramdown/version.rb | 2 +-
metadata.yml | 25 ++++---
test/test_files.rb | 74 ++++++++++++++++++++
.../testcases/block/03_paragraph/indented.html.gfm | 18 +++++
test/testcases/block/04_header/atx_header.html | 6 +-
test/testcases/block/04_header/atx_header.text | 6 +-
test/testcases/block/04_header/setext_header.html | 4 +-
test/testcases/block/04_header/setext_header.text | 5 +-
.../testcases/block/07_horizontal_rule/normal.html | 2 +
.../testcases/block/07_horizontal_rule/normal.text | 3 +
.../backticks_disable_highlighting.html | 2 +
.../backticks_disable_highlighting.options | 1 +
.../backticks_disable_highlighting.text | 3 +
test/testcases_gfm/backticks_syntax.html | 20 ++++++
test/testcases_gfm/backticks_syntax.text | 19 +++++
test/testcases_gfm/two_para_hard_line_breaks.html | 4 ++
test/testcases_gfm/two_para_hard_line_breaks.text | 4 ++
36 files changed, 264 insertions(+), 42 deletions(-)
diff --git a/CONTRIBUTERS b/CONTRIBUTERS
index 4c40f29..3b316f9 100644
--- a/CONTRIBUTERS
+++ b/CONTRIBUTERS
@@ -1,17 +1,19 @@
Count Name
======= ====
- 592 Thomas Leitner <t_leitner at gmx.at>
+ 603 Thomas Leitner <t_leitner at gmx.at>
6 Gioele Barabucci <gioele at svario.it>
4 Ted Pak <powerpak006 at gmail.com>
+ 4 Arne Brasseur <arne at arnebrasseur.net>
+ 3 Henning Perl <perl at fast-sicher.de>
3 gettalong <t_leitner at gmx.at>
3 Ben Armston <ben.armston at googlemail.com>
3 Alex Marandon <contact at alexmarandon.com>
- 2 Henning Perl <perl at fast-sicher.de>
2 Bran <m.versum at gmail.com>
1 Trevor Wennblom <trevor at well.com>
1 tomykaira <tomykaira at gmail.com>
1 Tim Besard <tim.besard at gmail.com>
1 Tim Bates <tim at rumpuslabs.com>
+ 1 Simon Lydell <simon.lydell at gmail.com>
1 Postmodern <postmodern.mod3 at gmail.com>
1 myqlarson <myqlarson at gmail.com>
1 Michal Till <michal.till at gmail.com>
diff --git a/Rakefile b/Rakefile
index 94a5e00..594743a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -218,7 +218,7 @@ EOF
rf.configure
rf.login
- rf.userconfig["release_notes"] = REL_PAGE.blocks['content'].content.force_encoding("BINARY")
+ rf.userconfig["release_notes"] = REL_PAGE.blocks['content']
rf.userconfig["preformatted"] = false
files = %w[.gem .tgz .zip].collect {|ext| "pkg/kramdown-#{Kramdown::VERSION}" + ext}
@@ -239,7 +239,7 @@ EOF
content = REL_PAGE.blocks['content']
content += "\n\n\nAbout kramdown\n\n#{SUMMARY}\n\n#{DESCRIPTION}"
- rf.post_news('kramdown', "kramdown #{Kramdown::VERSION} released", content).force_encoding("BINARY")
+ rf.post_news('kramdown', "kramdown #{Kramdown::VERSION} released", content)
puts "done"
end
end
diff --git a/VERSION b/VERSION
index 9084fa2..26aaba0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.0
+1.2.0
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
index 31559ef..96621ca 100644
Binary files a/checksums.yaml.gz and b/checksums.yaml.gz differ
diff --git a/data/kramdown/document.html b/data/kramdown/document.html
index 26872a8..6c30334 100644
--- a/data/kramdown/document.html
+++ b/data/kramdown/document.html
@@ -1,5 +1,9 @@
+<!DOCTYPE html>
<html>
<head>
+ <% if @converter.root.options[:encoding] %>
+ <meta http-equiv="Content-type" content="text/html;<%= @converter.root.options[:encoding] %>">
+ <% end %>
<%
extend ::Kramdown::Utils::Html
title = ''
diff --git a/doc/documentation.page b/doc/documentation.page
index c9cc6e5..ebafaaf 100644
--- a/doc/documentation.page
+++ b/doc/documentation.page
@@ -12,7 +12,7 @@ HTML. However, due to its modular architecture it is able to support additional
formats. The following input and output formats are currently supported:
* Input: [kramdown](parser/kramdown.html) (a superset of Markdown),
- [Markdown](parser/markdown.html), [HTML](parser/html.html)
+ [Markdown](parser/markdown.html), [Github Flavored Markdown](parser/gfm.html), [HTML](parser/html.html)
* Output: [HTML](converter/html.html), [LaTeX](converter/latex.html),
[kramdown](converter/kramdown.html), [RemoveHtmlTags](converter/remove_html_tags.html) (a special
diff --git a/doc/installation.page b/doc/installation.page
index 0f1e707..63c1b12 100644
--- a/doc/installation.page
+++ b/doc/installation.page
@@ -8,7 +8,7 @@ sort_info: 5
## Dependencies
Since kramdown is written in Ruby, you just need the [Ruby interpreter](http://www.ruby-lang.org),
-version 1.8.5, 1.8.6, 1.8.7, 1.9.2 or 1.9.3. There are no other dependencies.
+version 1.8.5, 1.8.6, 1.8.7, 1.9.2, 1.9.3 or 2.0.0. There are no other dependencies.
## Compatibility Notes
@@ -16,7 +16,7 @@ version 1.8.5, 1.8.6, 1.8.7, 1.9.2 or 1.9.3. There are no other dependencies.
kramdown should work on any platform which supports Ruby. It has been successfully tested on the
following platforms:
-* Linux with Ruby 1.8.5, 1.8.6, 1.8.7, 1.9.2, 1.9.3 and jruby 1.6.0.
+* Linux with Ruby 1.8.5, 1.8.6, 1.8.7, 1.9.2, 1.9.3, 2.0.0 and jruby 1.7.3.
See the platform specific installation notes for more information!
diff --git a/doc/sidebar.template b/doc/sidebar.template
index 838ee6f..6d7f131 100644
--- a/doc/sidebar.template
+++ b/doc/sidebar.template
@@ -1,7 +1,7 @@
<h2>News</h2>
-<p>The latest version of kramdown is <span class="inline-important">1.1.0</span> and it was released
-on <span class="inline-important">2013-07-02</span></p>
+<p>The latest version of kramdown is <span class="inline-important">1.2.0</span> and it was released
+on <span class="inline-important">2013-08-31</span></p>
<p>More <a href="{relocatable: news.html}">news</a>…</p>
diff --git a/doc/syntax.page b/doc/syntax.page
index 4ea2d23..aa47d4f 100644
--- a/doc/syntax.page
+++ b/doc/syntax.page
@@ -1543,11 +1543,10 @@ key-value pairs
ID name
-: An ID name is defined by using a hash and then the identifier name which needs to start with a
- word character or a digit, optionally followed by other word characters, digits, dashes or colons.
- This is a short hand for the key-value pair `id="IDNAME"` since this is often used. The ID name
- specifies the unique ID of a block or span-level element. For example, an ID name looks like
- `#myid`.
+: An ID name is defined by using a hash and then the identifier name which needs to start with an
+ ASCII character, optionally followed by other ASCII characters, digits, dashes or colons. This is
+ a short hand for the key-value pair `id="IDNAME"` since this is often used. The ID name specifies
+ the unique ID of a block or span-level element. For example, an ID name looks like `#myid`.
class names
diff --git a/lib/kramdown/converter/base.rb b/lib/kramdown/converter/base.rb
index 30a3708..76b1b23 100644
--- a/lib/kramdown/converter/base.rb
+++ b/lib/kramdown/converter/base.rb
@@ -77,8 +77,8 @@ module Kramdown
def self.convert(tree, options = {})
converter = new(tree, ::Kramdown::Options.merge(options.merge(tree.options[:options] || {})))
result = converter.convert(tree)
- result = apply_template(converter, result) if !converter.options[:template].empty?
result.encode!(tree.options[:encoding]) if result.respond_to?(:encode!)
+ result = apply_template(converter, result) if !converter.options[:template].empty?
[result, converter.warnings]
end
diff --git a/lib/kramdown/converter/html.rb b/lib/kramdown/converter/html.rb
index f51ca7f..d873f38 100644
--- a/lib/kramdown/converter/html.rb
+++ b/lib/kramdown/converter/html.rb
@@ -142,7 +142,7 @@ module Kramdown
end
def convert_hr(el, indent)
- "#{' '*indent}<hr />\n"
+ "#{' '*indent}<hr#{html_attributes(el.attr)} />\n"
end
def convert_ul(el, indent)
diff --git a/lib/kramdown/converter/latex.rb b/lib/kramdown/converter/latex.rb
index 7f809c7..b16254b 100644
--- a/lib/kramdown/converter/latex.rb
+++ b/lib/kramdown/converter/latex.rb
@@ -206,9 +206,9 @@ module Kramdown
def convert_a(el, opts)
url = el.attr['href']
if url =~ /^#/
- "\\hyperlink{#{url[1..-1]}}{#{inner(el, opts)}}"
+ "\\hyperlink{#{escape(url[1..-1])}}{#{inner(el, opts)}}"
else
- "\\href{#{url}}{#{inner(el, opts)}}"
+ "\\href{#{escape(url)}}{#{inner(el, opts)}}"
end
end
diff --git a/lib/kramdown/parser.rb b/lib/kramdown/parser.rb
index 7106a70..f331647 100644
--- a/lib/kramdown/parser.rb
+++ b/lib/kramdown/parser.rb
@@ -20,6 +20,7 @@ module Kramdown
autoload :Kramdown, 'kramdown/parser/kramdown'
autoload :Html, 'kramdown/parser/html'
autoload :Markdown, 'kramdown/parser/markdown'
+ autoload :GFM, 'kramdown/parser/gfm'
end
diff --git a/lib/kramdown/parser/gfm.rb b/lib/kramdown/parser/gfm.rb
new file mode 100644
index 0000000..1814ad5
--- /dev/null
+++ b/lib/kramdown/parser/gfm.rb
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+require 'kramdown/parser/kramdown'
+
+module Kramdown
+ module Parser
+ class GFM < Kramdown::Parser::Kramdown
+
+ def initialize(source, options)
+ super
+ i = @block_parsers.index(:codeblock_fenced)
+ @block_parsers.delete(:codeblock_fenced)
+ @block_parsers.insert(i, :codeblock_fenced_gfm)
+ end
+
+ FENCED_CODEBLOCK_MATCH = /^(([~`]){3,})\s*?(\w+)?\s*?\n(.*?)^\1\2*\s*?\n/m
+
+ define_parser(:codeblock_fenced_gfm, /^[~`]{3,}/, nil, 'parse_codeblock_fenced')
+
+ def parse_paragraph
+ result = @src.scan(PARAGRAPH_MATCH)
+ while !@src.match?(self.class::PARAGRAPH_END)
+ result << @src.scan(PARAGRAPH_MATCH)
+ end
+ result.chomp!
+ unless @tree.children.last && @tree.children.last.type == :p
+ @tree.children << new_block_el(:p)
+ end
+ lines = result.lstrip.split(/\n/)
+ lines.each_with_index do |line, index|
+ @tree.children.last.children << Element.new(@text_type, line) << Element.new(:br) << Element.new(@text_type, "\n")
+ end
+ @tree.children.last.children.pop # added one \n too many
+ @tree.children.last.children.pop # added one :br too many
+ true
+ end
+
+ end
+ end
+end
diff --git a/lib/kramdown/parser/html.rb b/lib/kramdown/parser/html.rb
index 6eb2df8..3f37a97 100644
--- a/lib/kramdown/parser/html.rb
+++ b/lib/kramdown/parser/html.rb
@@ -9,6 +9,7 @@
require 'rexml/parsers/baseparser'
require 'strscan'
+require 'kramdown/utils'
module Kramdown
diff --git a/lib/kramdown/parser/kramdown/codeblock.rb b/lib/kramdown/parser/kramdown/codeblock.rb
index 1431803..80016e3 100644
--- a/lib/kramdown/parser/kramdown/codeblock.rb
+++ b/lib/kramdown/parser/kramdown/codeblock.rb
@@ -31,14 +31,14 @@ module Kramdown
FENCED_CODEBLOCK_START = /^~{3,}/
- FENCED_CODEBLOCK_MATCH = /^(~{3,})\s*?(\w+)?\s*?\n(.*?)^\1~*\s*?\n/m
+ FENCED_CODEBLOCK_MATCH = /^((~){3,})\s*?(\w+)?\s*?\n(.*?)^\1\2*\s*?\n/m
# Parse the fenced codeblock at the current location.
def parse_codeblock_fenced
- if @src.check(FENCED_CODEBLOCK_MATCH)
+ if @src.check(self.class::FENCED_CODEBLOCK_MATCH)
@src.pos += @src.matched_size
- el = new_block_el(:codeblock, @src[3])
- lang = @src[2].to_s.strip
+ el = new_block_el(:codeblock, @src[4])
+ lang = @src[3].to_s.strip
el.attr['class'] = "language-#{lang}" unless lang.empty?
@tree.children << el
true
diff --git a/lib/kramdown/parser/kramdown/extensions.rb b/lib/kramdown/parser/kramdown/extensions.rb
index 5121d96..c8f80eb 100644
--- a/lib/kramdown/parser/kramdown/extensions.rb
+++ b/lib/kramdown/parser/kramdown/extensions.rb
@@ -129,7 +129,7 @@ module Kramdown
ALD_ID_NAME = /\w#{ALD_ID_CHARS}*/
ALD_TYPE_KEY_VALUE_PAIR = /(#{ALD_ID_NAME})=("|')((?:\\\}|\\\2|[^\}\2])*?)\2/
ALD_TYPE_CLASS_NAME = /\.(#{ALD_ID_NAME})/
- ALD_TYPE_ID_NAME = /#(\w[\w:-]*)/
+ ALD_TYPE_ID_NAME = /#([A-Za-z][\w:-]*)/
ALD_TYPE_ID_OR_CLASS = /#{ALD_TYPE_ID_NAME}|#{ALD_TYPE_CLASS_NAME}/
ALD_TYPE_ID_OR_CLASS_MULTI = /((?:#{ALD_TYPE_ID_NAME}|#{ALD_TYPE_CLASS_NAME})+)/
ALD_TYPE_REF = /(#{ALD_ID_NAME})/
diff --git a/lib/kramdown/parser/kramdown/header.rb b/lib/kramdown/parser/kramdown/header.rb
index cf0a583..fc4718c 100644
--- a/lib/kramdown/parser/kramdown/header.rb
+++ b/lib/kramdown/parser/kramdown/header.rb
@@ -13,7 +13,7 @@ module Kramdown
module Parser
class Kramdown
- HEADER_ID=/(?:[ \t]+\{#(\w[\w-]*)\})?/
+ HEADER_ID=/(?:[ \t]+\{#([A-Za-z][\w:-]*)\})?/
SETEXT_HEADER_START = /^(#{OPT_SPACE}[^ \t].*?)#{HEADER_ID}[ \t]*?\n(-|=)+\s*?\n/
# Parse the Setext header at the current location.
diff --git a/lib/kramdown/utils/unidecoder.rb b/lib/kramdown/utils/unidecoder.rb
index e227714..f146e5d 100644
--- a/lib/kramdown/utils/unidecoder.rb
+++ b/lib/kramdown/utils/unidecoder.rb
@@ -15,20 +15,25 @@ module Kramdown
# Provides the ability to tranliterate Unicode strings into plain ASCII ones.
module Unidecoder
- if RUBY_VERSION <= '1.8.6'
+ gem 'stringex' if defined?(Gem)
+ path = $:.find {|dir| File.directory?(File.join(File.expand_path(dir), "stringex", "unidecoder_data"))}
+
+ if RUBY_VERSION <= '1.8.6' || !path
def self.decode(string)
string
end
else
- require 'stringex/unidecoder' # dummy require so that we can get at the data files
+ CODEPOINTS = Hash.new do |h, k|
+ h[k] = YAML.load_file(File.join(path, "stringex", "unidecoder_data", "#{k}.yml"))
+ end
# Transliterate string from Unicode into ASCII.
def self.decode(string)
string.gsub(/[^\x00-\x7f]/u) do |codepoint|
begin
unpacked = codepoint.unpack("U")[0]
- Stringex::Unidecoder::CODEPOINTS["x%02x" % (unpacked >> 8)][unpacked & 255]
+ CODEPOINTS["x%02x" % (unpacked >> 8)][unpacked & 255]
rescue
"?"
end
diff --git a/lib/kramdown/version.rb b/lib/kramdown/version.rb
index d5a9fe9..4dc1f43 100644
--- a/lib/kramdown/version.rb
+++ b/lib/kramdown/version.rb
@@ -10,6 +10,6 @@
module Kramdown
# The kramdown version.
- VERSION = '1.1.0'
+ VERSION = '1.2.0'
end
diff --git a/metadata.yml b/metadata.yml
index 6034bf6..09fc91e 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: kramdown
version: !ruby/object:Gem::Version
- version: 1.1.0
+ version: 1.2.0
platform: ruby
authors:
- Thomas Leitner
autorequire:
bindir: bin
cert_chain: []
-date: 2013-07-02 00:00:00.000000000 Z
+date: 2013-08-31 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: coderay
@@ -38,11 +38,9 @@ dependencies:
- - ~>
- !ruby/object:Gem::Version
version: 1.5.1
-description: ! 'kramdown is yet-another-markdown-parser but fast, pure Ruby,
-
+description: |
+ kramdown is yet-another-markdown-parser but fast, pure Ruby,
using a strict syntax definition and supporting several common extensions.
-
-'
email: t_leitner at gmx.at
executables:
- kramdown
@@ -79,6 +77,7 @@ files:
- lib/kramdown/options.rb
- lib/kramdown/parser.rb
- lib/kramdown/parser/base.rb
+- lib/kramdown/parser/gfm.rb
- lib/kramdown/parser/html.rb
- lib/kramdown/parser/kramdown.rb
- lib/kramdown/parser/kramdown/abbreviation.rb
@@ -146,6 +145,7 @@ files:
- test/testcases/block/02_eob/middle.html
- test/testcases/block/02_eob/middle.text
- test/testcases/block/03_paragraph/indented.html
+- test/testcases/block/03_paragraph/indented.html.gfm
- test/testcases/block/03_paragraph/indented.text
- test/testcases/block/03_paragraph/no_newline_at_end.html
- test/testcases/block/03_paragraph/no_newline_at_end.text
@@ -490,6 +490,13 @@ files:
- test/testcases/span/text_substitutions/typography.html
- test/testcases/span/text_substitutions/typography.options
- test/testcases/span/text_substitutions/typography.text
+- test/testcases_gfm/backticks_disable_highlighting.html
+- test/testcases_gfm/backticks_disable_highlighting.options
+- test/testcases_gfm/backticks_disable_highlighting.text
+- test/testcases_gfm/backticks_syntax.html
+- test/testcases_gfm/backticks_syntax.text
+- test/testcases_gfm/two_para_hard_line_breaks.html
+- test/testcases_gfm/two_para_hard_line_breaks.text
homepage: http://kramdown.rubyforge.org
licenses:
- MIT
@@ -502,17 +509,17 @@ require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - - ! '>='
+ - - '>='
- !ruby/object:Gem::Version
version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - - ! '>='
+ - - '>='
- !ruby/object:Gem::Version
version: '0'
requirements: []
rubyforge_project: kramdown
-rubygems_version: 2.0.0
+rubygems_version: 2.0.3
signing_key:
specification_version: 4
summary: kramdown is a fast, pure-Ruby Markdown-superset converter.
diff --git a/test/test_files.rb b/test/test_files.rb
index 2d92b5a..c6274bf 100644
--- a/test/test_files.rb
+++ b/test/test_files.rb
@@ -171,6 +171,80 @@ class TestFiles < Test::Unit::TestCase
end
end
+ EXCLUDE_GFM_FILES = [
+ 'test/testcases/block/03_paragraph/no_newline_at_end.text',
+ 'test/testcases/block/03_paragraph/indented.text',
+ 'test/testcases/block/03_paragraph/two_para.text',
+ 'test/testcases/block/04_header/atx_header.text',
+ 'test/testcases/block/04_header/setext_header.text',
+ 'test/testcases/block/05_blockquote/indented.text',
+ 'test/testcases/block/05_blockquote/lazy.text',
+ 'test/testcases/block/05_blockquote/nested.text',
+ 'test/testcases/block/05_blockquote/no_newline_at_end.text',
+ 'test/testcases/block/06_codeblock/error.text',
+ 'test/testcases/block/07_horizontal_rule/error.text',
+ 'test/testcases/block/08_list/escaping.text',
+ 'test/testcases/block/08_list/item_ial.text',
+ 'test/testcases/block/08_list/lazy.text',
+ 'test/testcases/block/08_list/list_and_others.text',
+ 'test/testcases/block/08_list/other_first_element.text',
+ 'test/testcases/block/08_list/simple_ul.text',
+ 'test/testcases/block/08_list/special_cases.text',
+ 'test/testcases/block/09_html/comment.text',
+ 'test/testcases/block/09_html/html_to_native/code.text',
+ 'test/testcases/block/09_html/html_to_native/emphasis.text',
+ 'test/testcases/block/09_html/html_to_native/typography.text',
+ 'test/testcases/block/09_html/parse_as_raw.text',
+ 'test/testcases/block/09_html/simple.text',
+ 'test/testcases/block/12_extension/comment.text',
+ 'test/testcases/block/12_extension/ignored.text',
+ 'test/testcases/block/12_extension/nomarkdown.text',
+ 'test/testcases/block/13_definition_list/item_ial.text',
+ 'test/testcases/block/13_definition_list/multiple_terms.text',
+ 'test/testcases/block/13_definition_list/no_def_list.text',
+ 'test/testcases/block/13_definition_list/simple.text',
+ 'test/testcases/block/13_definition_list/with_blocks.text',
+ 'test/testcases/block/14_table/errors.text',
+ 'test/testcases/block/14_table/escaping.text',
+ 'test/testcases/block/14_table/simple.text',
+ 'test/testcases/block/15_math/normal.text',
+ 'test/testcases/encoding.text',
+ 'test/testcases/span/01_link/inline.text',
+ 'test/testcases/span/01_link/link_defs.text',
+ 'test/testcases/span/01_link/reference.text',
+ 'test/testcases/span/02_emphasis/normal.text',
+ 'test/testcases/span/03_codespan/normal.text',
+ 'test/testcases/span/04_footnote/definitions.text',
+ 'test/testcases/span/04_footnote/markers.text',
+ 'test/testcases/span/05_html/across_lines.text',
+ 'test/testcases/span/05_html/markdown_attr.text',
+ 'test/testcases/span/05_html/normal.text',
+ 'test/testcases/span/autolinks/url_links.text',
+ 'test/testcases/span/extension/comment.text',
+ 'test/testcases/span/ial/simple.text',
+ 'test/testcases/span/line_breaks/normal.text',
+ 'test/testcases/span/text_substitutions/entities_as_char.text',
+ 'test/testcases/span/text_substitutions/entities.text',
+ 'test/testcases/span/text_substitutions/typography.text'
+ ]
+
+ # Generate test methods for gfm-to-html conversion
+ Dir[File.dirname(__FILE__) + '/{testcases,testcases_gfm}/**/*.text'].each do |text_file|
+ next if EXCLUDE_GFM_FILES.any? {|f| text_file =~ /#{f}$/}
+ basename = text_file.sub(/\.text$/, '')
+
+ html_file = [(".html.19" if RUBY_VERSION >= '1.9'), ".html"].compact.
+ map {|ext| basename + ext }.
+ detect {|file| File.exist?(file) }
+
+ define_method('test_gfm_' + text_file.tr('.', '_') + "_to_html") do
+ opts_file = basename + '.options'
+ opts_file = File.join(File.dirname(html_file), 'options') if !File.exist?(opts_file)
+ options = File.exist?(opts_file) ? YAML::load(File.read(opts_file)) : {:auto_ids => false, :footnote_nr => 1}
+ doc = Kramdown::Document.new(File.read(text_file), options.merge(:input => 'GFM'))
+ assert_equal(File.read(html_file), doc.to_html)
+ end
+ end
# Generate test methods for asserting that converters don't modify the document tree.
diff --git a/test/testcases/block/03_paragraph/indented.html.gfm b/test/testcases/block/03_paragraph/indented.html.gfm
new file mode 100644
index 0000000..4440c62
--- /dev/null
+++ b/test/testcases/block/03_paragraph/indented.html.gfm
@@ -0,0 +1,18 @@
+<p>This is a para.</p>
+
+<p>This is a para.</p>
+
+<p>This is a para.</p>
+
+<p>This is a para.</p>
+
+<pre><code>This is a code block.
+</code></pre>
+
+<p>And this is another.</p>
+
+<p>A para
+<br /> with
+<br /> mixed
+<br />indents.
+<br /> and with much indent</p>
diff --git a/test/testcases/block/04_header/atx_header.html b/test/testcases/block/04_header/atx_header.html
index 321cf96..95a20d4 100644
--- a/test/testcases/block/04_header/atx_header.html
+++ b/test/testcases/block/04_header/atx_header.html
@@ -34,10 +34,14 @@
<h3 id="id">Header</h3>
-<h3 id="id">Header</h3>
+<h3 id="Id">Header</h3>
<h3 id="id">Header</h3>
+<h3 id="A-Za-z0-9_:t">Header</h3>
+
+<h3>Header {#9ab}</h3>
+
<h3>Header{#noid}</h3>
<h3>Header ##{#noid}</h3>
diff --git a/test/testcases/block/04_header/atx_header.text b/test/testcases/block/04_header/atx_header.text
index 4f84709..d7240c1 100644
--- a/test/testcases/block/04_header/atx_header.text
+++ b/test/testcases/block/04_header/atx_header.text
@@ -32,10 +32,14 @@ paragraph
### Header {#id}
-### Header ## {#id}
+### Header ## {#Id}
### Header ## {#id}
+### Header {#A-Za-z0-9_:t}
+
+### Header {#9ab}
+
### Header{#noid}
### Header ##{#noid}
diff --git a/test/testcases/block/04_header/setext_header.html b/test/testcases/block/04_header/setext_header.html
index 848cac7..147c345 100644
--- a/test/testcases/block/04_header/setext_header.html
+++ b/test/testcases/block/04_header/setext_header.html
@@ -23,7 +23,9 @@ Not a Header
<h2 id="id">header</h2>
-<h1 id="id">header</h1>
+<h1 id="Id">header</h1>
+
+<h2 id="A-Za-z0-9_:">header</h2>
<h2>header{#noid}</h2>
diff --git a/test/testcases/block/04_header/setext_header.text b/test/testcases/block/04_header/setext_header.text
index 221a109..ae94ecd 100644
--- a/test/testcases/block/04_header/setext_header.text
+++ b/test/testcases/block/04_header/setext_header.text
@@ -26,9 +26,12 @@ Not a Header
header {#id}
------------
-header {#id}
+header {#Id}
======
+header {#A-Za-z0-9_:}
+------
+
header{#noid}
-----
diff --git a/test/testcases/block/07_horizontal_rule/normal.html b/test/testcases/block/07_horizontal_rule/normal.html
index 98d4e7a..e74b6e6 100644
--- a/test/testcases/block/07_horizontal_rule/normal.html
+++ b/test/testcases/block/07_horizontal_rule/normal.html
@@ -15,3 +15,5 @@
<pre><code>- - -
</code></pre>
+
+<hr class="test" />
diff --git a/test/testcases/block/07_horizontal_rule/normal.text b/test/testcases/block/07_horizontal_rule/normal.text
index 6ead6ad..986101a 100644
--- a/test/testcases/block/07_horizontal_rule/normal.text
+++ b/test/testcases/block/07_horizontal_rule/normal.text
@@ -15,3 +15,6 @@ text
* * *
- - -
+
+* * *
+{:.test}
diff --git a/test/testcases_gfm/backticks_disable_highlighting.html b/test/testcases_gfm/backticks_disable_highlighting.html
new file mode 100644
index 0000000..8390d09
--- /dev/null
+++ b/test/testcases_gfm/backticks_disable_highlighting.html
@@ -0,0 +1,2 @@
+<pre><code class="language-ruby">Kramdown::Document.new(text, :input => 'GFM')
+</code></pre>
diff --git a/test/testcases_gfm/backticks_disable_highlighting.options b/test/testcases_gfm/backticks_disable_highlighting.options
new file mode 100644
index 0000000..72e9bc1
--- /dev/null
+++ b/test/testcases_gfm/backticks_disable_highlighting.options
@@ -0,0 +1 @@
+:enable_coderay: false
diff --git a/test/testcases_gfm/backticks_disable_highlighting.text b/test/testcases_gfm/backticks_disable_highlighting.text
new file mode 100644
index 0000000..98cf3a8
--- /dev/null
+++ b/test/testcases_gfm/backticks_disable_highlighting.text
@@ -0,0 +1,3 @@
+```ruby
+Kramdown::Document.new(text, :input => 'GFM')
+```
diff --git a/test/testcases_gfm/backticks_syntax.html b/test/testcases_gfm/backticks_syntax.html
new file mode 100644
index 0000000..3cac9f5
--- /dev/null
+++ b/test/testcases_gfm/backticks_syntax.html
@@ -0,0 +1,20 @@
+<pre><code>Three backticks
+</code></pre>
+
+<pre><code>Four backticks
+</code></pre>
+
+<pre><code>Unbalanced bottom heavy
+</code></pre>
+
+<div><div class="CodeRay">
+ <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>language no space
+</pre></div>
+</div>
+</div>
+
+<div><div class="CodeRay">
+ <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>language with space
+</pre></div>
+</div>
+</div>
diff --git a/test/testcases_gfm/backticks_syntax.text b/test/testcases_gfm/backticks_syntax.text
new file mode 100644
index 0000000..fb5c611
--- /dev/null
+++ b/test/testcases_gfm/backticks_syntax.text
@@ -0,0 +1,19 @@
+```
+Three backticks
+```
+
+````
+Four backticks
+````
+
+```
+Unbalanced bottom heavy
+``````
+
+````ruby
+language no space
+````
+
+```` ruby
+language with space
+````
diff --git a/test/testcases_gfm/two_para_hard_line_breaks.html b/test/testcases_gfm/two_para_hard_line_breaks.html
new file mode 100644
index 0000000..a7470bc
--- /dev/null
+++ b/test/testcases_gfm/two_para_hard_line_breaks.html
@@ -0,0 +1,4 @@
+<p>This is just a normal paragraph.<br />
+Containing a line break.</p>
+
+<p>Another paragraph.</p>
diff --git a/test/testcases_gfm/two_para_hard_line_breaks.text b/test/testcases_gfm/two_para_hard_line_breaks.text
new file mode 100644
index 0000000..e152d5d
--- /dev/null
+++ b/test/testcases_gfm/two_para_hard_line_breaks.text
@@ -0,0 +1,4 @@
+This is just a normal paragraph.
+Containing a line break.
+
+Another paragraph.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-kramdown.git
More information about the Pkg-ruby-extras-commits
mailing list