mcbean 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,6 +1,12 @@
1
1
  = Changelog
2
2
 
3
- == HEAD
3
+ == 0.4.0 (2010-09-30)
4
+
5
+ Features:
6
+
7
+ * Support for Creole (wiki format)
8
+
9
+ == 0.3.0 (2010-04-16)
4
10
 
5
11
  Features:
6
12
 
@@ -5,9 +5,12 @@ README.rdoc
5
5
  Rakefile
6
6
  bin/mcbean
7
7
  lib/mcbean.rb
8
+ lib/mcbean/creole.rb
8
9
  lib/mcbean/markdown.rb
9
10
  lib/mcbean/textile.rb
11
+ mcbean.gemspec
10
12
  test/helper.rb
13
+ test/test_creole.rb
11
14
  test/test_markdown.rb
12
15
  test/test_mcbean.rb
13
16
  test/test_textile.rb
@@ -1,6 +1,7 @@
1
1
  = McBean
2
2
 
3
3
  * http://github.com/flavorjones/mcbean
4
+ * http://mcbean.heroku.com/doc/index.html (rdocs)
4
5
  * http://mcbean.heroku.com (live demo)
5
6
 
6
7
  == Description
@@ -10,37 +11,47 @@ McBean can convert documents from one format to another. McBean currently suppor
10
11
  * HTML
11
12
  * Markdown (a subset)
12
13
  * Textile (a subset)
14
+ * Creole (a subset)
13
15
 
14
- with the help of Loofah, Nokogiri, RDiscount and RedCloth.
16
+ with the help of Loofah, Nokogiri, RDiscount, RedCloth and Creole.
15
17
 
16
18
  "You can't teach a Sneetch." -- Sylvester McMonkey McBean
17
19
 
18
20
  == Features
19
21
 
20
- * Transforms HTML into Markdown, and Markdown into HTML (thanks to RDiscount).
21
- * Transforms HTML into Textile, and Textile into HTML (thanks to RedCloth).
22
- * Transforms Textile into Markdown, and Markdown into Textile.
22
+ * Transforms HTML into Markdown, and Markdown into HTML (with help from RDiscount).
23
+ * Transforms HTML into Textile, and Textile into HTML (with help from RedCloth).
24
+ * Transforms HTML into Creole, and Creole into HTML (with help from Creole).
25
+ * Textile <-> Markdown
26
+ * Textile <-> Creole
27
+ * Creole <-> Markdown
23
28
  * Emitted HTML is sanitized (thanks to Loofah).
24
29
  * Fancy-pants command line utility, "mcbean".
25
30
 
26
31
  == Problems
27
32
 
28
- * Only supports a limited subset of Markdown and Textile. Patches welcome.
33
+ * Only supports a limited subset of Markdown, Textile and Creole. Patches welcome.
29
34
 
30
35
  == Synopsis
31
36
 
32
37
  Wrap your document (which can be either a String or an IO object):
33
38
 
34
- mcbean = McBean.fragment(your_html_fragment)
35
- mcbean = McBean.document(your_html_document)
36
- mcbean = McBean.markdown(your_markdown)
37
- mcbean = McBean.textile(your_textile)
39
+ mcbean = McBean.fragment your_html_fragment
40
+ or
41
+ mcbean = McBean.document your_html_document
42
+ or
43
+ mcbean = McBean.markdown your_markdown
44
+ or
45
+ mcbean = McBean.textile your_textile
46
+ or
47
+ mcbean = McBean.creole your_creole
38
48
 
39
49
  And then generate the desired markup format:
40
50
 
41
51
  mcbean.to_html
42
52
  mcbean.to_markdown
43
53
  mcbean.to_textile
54
+ mcbean.to_creole
44
55
 
45
56
  Also, +mcbean+ provides a command-line utility installed into your gem path:
46
57
 
@@ -58,8 +69,9 @@ have a single root node, you have a *fragment*.
58
69
  == Requirements
59
70
 
60
71
  * Loofah >= 0.4.7 (and thusly Nokogiri)
61
- * RDiscount >= 1.3.4
62
- * RedCloth >= 4.0.0
72
+ * RDiscount >= 1.6.0
73
+ * RedCloth >= 4.2.0
74
+ * Creole >= 0.3.7
63
75
 
64
76
  == Install
65
77
 
@@ -71,6 +83,8 @@ Thanks to David Loren Parsons and Ryan Tomayko for RDiscount.
71
83
 
72
84
  Thanks to Jason Garber for RedCloth.
73
85
 
86
+ Thanks to Lars Christensen and Daniel Mendler for Creole.
87
+
74
88
  == License
75
89
 
76
90
  (The MIT License)
data/Rakefile CHANGED
@@ -5,6 +5,8 @@ gem 'hoe', '>= 2.5.0'
5
5
  require 'hoe'
6
6
 
7
7
  Hoe.plugin :git
8
+ Hoe.plugin :gemspec
9
+ Hoe.plugin :bundler
8
10
 
9
11
  Hoe.spec 'mcbean' do
10
12
  developer "Mike Dalessio", "mike.dalessio@gmail.com"
@@ -14,9 +16,13 @@ Hoe.spec 'mcbean' do
14
16
  self.readme_file = "README.rdoc"
15
17
 
16
18
  self.extra_deps << ["loofah", ">= 0.4.7"]
17
- self.extra_deps << ["rdiscount", ">= 1.3.4"]
18
- self.extra_deps << ["RedCloth", ">= 4.0.0"]
19
+ self.extra_deps << ["rdiscount", ">= 1.6.0"]
20
+ self.extra_deps << ["RedCloth", ">= 4.2.0"]
21
+ self.extra_deps << ["creole", ">= 0.3.7"]
19
22
  self.extra_dev_deps << ["minitest", ">= 1.6.0"]
23
+ self.extra_dev_deps << ["hoe-git"]
24
+ self.extra_dev_deps << ["hoe-gemspec"]
25
+ self.extra_dev_deps << ["hoe-bundler"]
20
26
 
21
27
  self.testlib = :minitest
22
28
  end
@@ -7,7 +7,7 @@ require "loofah"
7
7
  #
8
8
  class McBean
9
9
  # Current version of McBean
10
- VERSION = "0.3.0"
10
+ VERSION = "0.4.0"
11
11
 
12
12
  # Minimum required version of Loofah
13
13
  REQUIRED_LOOFAH_VERSION = "0.4.7"
@@ -76,6 +76,7 @@ Mcbean = McBean
76
76
 
77
77
  require "mcbean/markdown"
78
78
  require "mcbean/textile"
79
+ require "mcbean/creole"
79
80
 
80
81
  if Loofah::VERSION < McBean::REQUIRED_LOOFAH_VERSION
81
82
  raise RuntimeError, "McBean requires Loofah #{McBean::REQUIRED_LOOFAH_VERSION} or later (currently #{Loofah::VERSION})"
@@ -0,0 +1,133 @@
1
+ require 'creole'
2
+
3
+ class McBean
4
+ attr_writer :__creole__ # :nodoc:
5
+
6
+ @@__formats__ << "creole"
7
+
8
+ ##
9
+ # Create a McBean from a Creole document string (or IO object)
10
+ #
11
+ def McBean.creole string_or_io
12
+ mcbean = new
13
+ mcbean.__creole__ = McBean::Creolize::Antidote.new(string_or_io.respond_to?(:read) ? string_or_io.read : string_or_io)
14
+ mcbean
15
+ end
16
+
17
+ ##
18
+ # Generate a Creole string representation of the McBeaned document.
19
+ #
20
+ # So you can convert documents in other formats to Creole as follows:
21
+ #
22
+ # McBean.fragment(File.read(path_to_html_file)).to_creole
23
+ #
24
+ def to_creole
25
+ __creole__.to_s
26
+ end
27
+
28
+ def __creole__ generate_from_html_if_necessary=true # :nodoc:
29
+ @__creole__ ||= nil
30
+ if @__creole__.nil? && generate_from_html_if_necessary
31
+ @__creole__ = McBean::Creolize::Antidote.new(
32
+ Loofah::Helpers.remove_extraneous_whitespace(
33
+ __html__.dup.scrub!(:escape).scrub!(Creolize.new).text(:encode_special_chars => false)
34
+ ))
35
+ end
36
+ @__creole__
37
+ end
38
+
39
+ # :stopdoc:
40
+ class Creolize < Loofah::Scrubber
41
+ class Antidote
42
+ attr_accessor :string
43
+ def initialize string
44
+ @string = string
45
+ end
46
+
47
+ def to_html
48
+ # interesting (or not) that the Creole authors use 'creolize'
49
+ # in the opposite sense that I do.
50
+ Creole.creolize string, :extensions => false
51
+ end
52
+
53
+ def to_s
54
+ string
55
+ end
56
+ end
57
+
58
+ def initialize
59
+ @direction = :bottom_up
60
+ @link_references = nil
61
+ @link_reference_count = 0
62
+ end
63
+
64
+ def scrub(node)
65
+ return CONTINUE if node.text?
66
+ replacement_killer = \
67
+ case node.name
68
+ when "h1"
69
+ new_text node, "\n= #{node.content.gsub("\n"," ")} =\n"
70
+ when "h2"
71
+ new_text node, "\n== #{node.content.gsub("\n"," ")} ==\n"
72
+ when "h3"
73
+ new_text node, "\n=== #{node.content.gsub("\n"," ")} ===\n"
74
+ when "h4"
75
+ new_text node, "\n==== #{node.content.gsub("\n"," ")} ====\n"
76
+ # when "blockquote"
77
+ # new_text node, "\nbq. #{node.content.gsub(/\n\n/, "\n").sub(/^\n/,'')}"
78
+ when "li"
79
+ nil # handled by parent list tag
80
+ when "ul"
81
+ fragment = []
82
+ node.xpath("./li").each do |li|
83
+ fragment << " * #{li.text}" if li.text =~ /\S/
84
+ end
85
+ new_text node, "\n#{fragment.join("\n")}\n"
86
+ when "ol"
87
+ fragment = []
88
+ node.xpath("./li").each do |li|
89
+ fragment << " # #{li.text}" if li.text =~ /\S/
90
+ end
91
+ new_text node, "\n#{fragment.join("\n")}\n"
92
+ when "tt"
93
+ new_text node, "{{{#{node.content}}}}"
94
+ when "b", "strong"
95
+ new_text node, "**#{node.content}**"
96
+ when "i", "em"
97
+ new_text node, "//#{node.content}//"
98
+ when "hr"
99
+ new_text node, "\n----\n"
100
+ when "code"
101
+ if node.parent.name == "pre"
102
+ new_text node, node.content
103
+ else
104
+ new_text node, "{{{#{node.content}}}}"
105
+ end
106
+ when "pre"
107
+ new_text node, "\n{{{\n#{node.content}\n}}}\n"
108
+ when "br"
109
+ new_text node, "\\\\"
110
+ when "a"
111
+ if node['href'].nil?
112
+ new_text node, node.content
113
+ else
114
+ new_text node, %Q{[[#{node['href']}|#{node.text}]]}
115
+ end
116
+ else
117
+ if Loofah::HashedElements::BLOCK_LEVEL[node.name]
118
+ new_text node, "\n#{node.content}\n"
119
+ else
120
+ nil
121
+ end
122
+ end
123
+ node.replace(replacement_killer) if replacement_killer
124
+ end
125
+
126
+ private
127
+
128
+ def new_text(node, text)
129
+ Nokogiri::XML::Text.new(text, node.document)
130
+ end
131
+ end
132
+ # :startdoc:
133
+ end
@@ -0,0 +1,71 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{mcbean}
5
+ s.version = "0.3.0.20100930005041"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Mike Dalessio"]
9
+ s.date = %q{2010-09-30}
10
+ s.default_executable = %q{mcbean}
11
+ s.description = %q{McBean can convert documents from one format to another. McBean currently supports:
12
+
13
+ * HTML
14
+ * Markdown (a subset)
15
+ * Textile (a subset)
16
+
17
+ with the help of Loofah, Nokogiri, RDiscount and RedCloth.
18
+
19
+ "You can't teach a Sneetch." -- Sylvester McMonkey McBean}
20
+ s.email = ["mike.dalessio@gmail.com"]
21
+ s.executables = ["mcbean"]
22
+ s.extra_rdoc_files = ["Manifest.txt", "CHANGELOG.rdoc", "README.rdoc"]
23
+ s.files = [".autotest", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "bin/mcbean", "lib/mcbean.rb", "lib/mcbean/markdown.rb", "lib/mcbean/textile.rb", "test/helper.rb", "test/test_markdown.rb", "test/test_mcbean.rb", "test/test_textile.rb", "test/test_creole.rb"]
24
+ s.homepage = %q{http://github.com/flavorjones/mcbean}
25
+ s.rdoc_options = ["--main", "README.rdoc"]
26
+ s.require_paths = ["lib"]
27
+ s.rubyforge_project = %q{mcbean}
28
+ s.rubygems_version = %q{1.3.7}
29
+ s.summary = %q{McBean can convert documents from one format to another}
30
+ s.test_files = ["test/test_markdown.rb", "test/test_mcbean.rb", "test/test_textile.rb", "test/test_creole.rb"]
31
+
32
+ if s.respond_to? :specification_version then
33
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
34
+ s.specification_version = 3
35
+
36
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
37
+ s.add_runtime_dependency(%q<loofah>, [">= 0.4.7"])
38
+ s.add_runtime_dependency(%q<rdiscount>, [">= 1.6.0"])
39
+ s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.0"])
40
+ s.add_runtime_dependency(%q<creole>, [">= 0.3.7"])
41
+ s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
42
+ s.add_development_dependency(%q<minitest>, [">= 1.6.0"])
43
+ s.add_development_dependency(%q<hoe-git>, [">= 0"])
44
+ s.add_development_dependency(%q<hoe-gemspec>, [">= 0"])
45
+ s.add_development_dependency(%q<hoe-bundler>, [">= 0"])
46
+ s.add_development_dependency(%q<hoe>, [">= 2.6.1"])
47
+ else
48
+ s.add_dependency(%q<loofah>, [">= 0.4.7"])
49
+ s.add_dependency(%q<rdiscount>, [">= 1.6.0"])
50
+ s.add_dependency(%q<RedCloth>, [">= 4.2.0"])
51
+ s.add_dependency(%q<creole>, [">= 0.3.7"])
52
+ s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
53
+ s.add_dependency(%q<minitest>, [">= 1.6.0"])
54
+ s.add_dependency(%q<hoe-git>, [">= 0"])
55
+ s.add_dependency(%q<hoe-gemspec>, [">= 0"])
56
+ s.add_dependency(%q<hoe-bundler>, [">= 0"])
57
+ s.add_dependency(%q<hoe>, [">= 2.6.1"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<loofah>, [">= 0.4.7"])
61
+ s.add_dependency(%q<rdiscount>, [">= 1.6.0"])
62
+ s.add_dependency(%q<RedCloth>, [">= 4.2.0"])
63
+ s.add_dependency(%q<creole>, [">= 0.3.7"])
64
+ s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
65
+ s.add_dependency(%q<minitest>, [">= 1.6.0"])
66
+ s.add_dependency(%q<hoe-git>, [">= 0"])
67
+ s.add_dependency(%q<hoe-gemspec>, [">= 0"])
68
+ s.add_dependency(%q<hoe-bundler>, [">= 0"])
69
+ s.add_dependency(%q<hoe>, [">= 2.6.1"])
70
+ end
71
+ end
@@ -0,0 +1,191 @@
1
+ require File.dirname(__FILE__) + "/helper"
2
+
3
+ describe McBean::Creolize do
4
+ describe ".creole" do
5
+ describe "passed a string" do
6
+ it "sets #__creole__ to be a Creolize::Antidote" do
7
+ McBean.creole("= hello =").__creole__.must_be_instance_of McBean::Creolize::Antidote
8
+ end
9
+ end
10
+
11
+ describe "passed an IO" do
12
+ it "sets #__creole__ to be a Creolize::Antidote" do
13
+ io = StringIO.new "= hello ="
14
+ McBean.creole(io).__creole__.must_be_instance_of McBean::Creolize::Antidote
15
+ end
16
+ end
17
+ end
18
+
19
+ describe "#to_html" do
20
+ attr_accessor :mcbean
21
+
22
+ describe "on an instance created by .creole" do
23
+ before do
24
+ @mcbean = McBean.creole "= ohai! =\n\n"
25
+ end
26
+
27
+ it "returns an html string" do
28
+ html = mcbean.to_html
29
+ html.must_be_instance_of String
30
+ html.must_match %r{<h1>ohai!</h1>}
31
+ end
32
+ end
33
+ end
34
+
35
+ describe "#to_creole" do
36
+ it "adds whitespace around block elements" do
37
+ assert_creole "before<div>inner</div>after", "before\ninner\nafter", false
38
+ end
39
+
40
+ it "converts h1 tag" do
41
+ assert_creole "<h1>Foo</h1>", "\n= Foo =\n"
42
+ end
43
+
44
+ it "removes newlines from header tags" do
45
+ assert_creole "<h1>Foo\nBar</h1>", "\n= Foo Bar =\n", false
46
+ end
47
+
48
+ it "converts h2 tag" do
49
+ assert_creole "<h2>Foo</h2>", "\n== Foo ==\n"
50
+ end
51
+
52
+ it "converts h3 tag" do
53
+ assert_creole "<h3>Foo</h3>", "\n=== Foo ===\n"
54
+ end
55
+
56
+ it "converts h4 tag" do
57
+ assert_creole "<h4>Foo</h4>", "\n==== Foo ====\n"
58
+ end
59
+
60
+ # it "converts blockquote tag" do
61
+ # assert_creole "<blockquote>\n<p>foo fazz<br />\nbizz buzz<br />\nwang wong</p>\n</blockquote>", "\n foo fazz\n bizz buzz\n wang wong\n"
62
+ # end
63
+
64
+ it "converts ul lists" do
65
+ html = "<ul><li>foo</li><li>wuxx</li></ul>"
66
+ # leading space used for moinmoin compatibility
67
+ creole = "\n * foo\n * wuxx\n"
68
+ assert_equal creole, McBean.fragment(html).to_creole
69
+ end
70
+
71
+ it "converts ol lists" do
72
+ html = "<ol><li>foo</li><li>wuxx</li></ol>"
73
+ # leading space used for moinmoin compatibility
74
+ creole = "\n # foo\n # wuxx\n"
75
+ assert_equal creole, McBean.fragment(html).to_creole
76
+ end
77
+
78
+ it "ignores empty unordered list items" do
79
+ assert_equal \
80
+ McBean.fragment("<ul>\n<li>one</li>\n<li></li>\n<li>three</li>\n</ul>\n").to_creole,
81
+ "\n * one\n * three\n"
82
+ end
83
+
84
+ it "ignores empty ordered list items" do
85
+ assert_equal \
86
+ McBean.fragment("<ol>\n<li>one</li>\n<li></li>\n<li>three</li>\n</ol>\n").to_creole,
87
+ "\n # one\n # three\n"
88
+ end
89
+
90
+ it "converts pre/code blocks" do
91
+ assert_creole "<pre><code>This is a code block\ncontinued</code></pre>",
92
+ "\n{{{\nThis is a code block\ncontinued\n}}}\n", false
93
+ end
94
+
95
+ it "converts code blocks" do
96
+ assert_creole "<code>This is code</code>",
97
+ "{{{This is code}}}", false
98
+ end
99
+
100
+ it "converts tt blocks" do
101
+ assert_creole "<p>hello <tt>This is tt</tt> goodbye</p>",
102
+ "\nhello {{{This is tt}}} goodbye\n"
103
+ end
104
+
105
+ it "converts b tag" do
106
+ assert_creole "<p>hello <b>there</b> pilgrim</p>", "\nhello **there** pilgrim\n", false
107
+ end
108
+
109
+ it "converts strong tag" do
110
+ assert_creole "<p>hello <strong>there</strong> pilgrim</p>", "\nhello **there** pilgrim\n"
111
+ end
112
+
113
+ it "converts i tag" do
114
+ assert_creole "<p>hello <i>there</i> pilgrim</p>", "\nhello //there// pilgrim\n", false
115
+ end
116
+
117
+ it "converts em tag" do
118
+ assert_creole "<p>hello <em>there</em> pilgrim</p>", "\nhello //there// pilgrim\n"
119
+ end
120
+
121
+ it "converts hr tag" do
122
+ assert_creole "<p>hello</p><hr/><p>there</p>", "\nhello\n\n----\n\nthere\n"
123
+ end
124
+
125
+ it "converts pre blocks" do
126
+ assert_creole "<pre>This is a pre block\ncontinued</pre>",
127
+ "\n{{{\nThis is a pre block\ncontinued\n}}}\n"
128
+ end
129
+
130
+ it "converts <br> tags to '\\'" do
131
+ assert_creole "<p>hello<br>there</p>", "\nhello\\\\there\n", false
132
+ assert_creole "<p>hello<br/>there</p>", "\nhello\\\\there\n"
133
+ end
134
+
135
+ describe "anchors" do
136
+ it "converts <a> tags" do
137
+ assert_creole "<p>Yes, magic helmet. And <a href=\"http://sample.com/\">I will give you a sample</a>.</p>",
138
+ %Q{\nYes, magic helmet. And [[http://sample.com/|I will give you a sample]].\n}
139
+ end
140
+
141
+ describe "<a> tags without hrefs" do
142
+ it "ignores them" do
143
+ assert_creole "<div><a name='link-target'>target title</a></div>",
144
+ "\ntarget title\n",
145
+ false
146
+
147
+ assert_creole "<div><a id='link-target'>target title</a></div>",
148
+ "\ntarget title\n",
149
+ false
150
+ end
151
+ end
152
+
153
+ describe "<a> tags with titles" do
154
+ it "ignores the title" do
155
+ assert_creole %Q{<p>Yes, magic helmet. And <a href="http://sample.com/" title="Fudd">I will give you a sample</a>.</p>},
156
+ %Q{\nYes, magic helmet. And [[http://sample.com/|I will give you a sample]].\n}, false
157
+ end
158
+ end
159
+ end
160
+ end
161
+
162
+ def assert_creole html, creole, roundtrip=true
163
+ assert_equal(html, McBean::Creolize::Antidote.new(creole).to_html, "creole roundtrip failed") if roundtrip
164
+ assert_equal(creole, McBean.fragment(html).to_creole, "fragment transformation failed")
165
+ assert_equal(Loofah::Helpers.remove_extraneous_whitespace("\n#{creole}\n"),
166
+ McBean.document("<div>#{html}</div>").to_creole, "document transformation failed")
167
+ end
168
+
169
+ end
170
+
171
+ describe McBean::Creolize::Antidote do
172
+ describe "given that creole is already pretty well tested, let's limit ourselves to a token test case" do
173
+ it "convert creole into html" do
174
+ McBean.creole("= hello =\n").to_html.must_match %r{<body><h1>hello</h1></body>}
175
+ end
176
+ end
177
+
178
+ describe "given creole with an unsafe tag" do
179
+ it "escapes the tag" do
180
+ creole = "= hello =\n\n<script>alert('ohai!');</script>\n\nlol\n"
181
+ McBean.creole(creole).to_html.must_include "&lt;script&gt;alert('ohai!');&lt;/script&gt;"
182
+ end
183
+ end
184
+
185
+ describe "given creole with an invalid tag" do
186
+ it "escapes the tag" do
187
+ creole = "= hello =\n\n<xyzzy>Adventure!</xyzzy>\n\nlol\n"
188
+ McBean.creole(creole).to_html.must_match %r{&lt;xyzzy&gt;Adventure!&lt;/xyzzy&gt;}
189
+ end
190
+ end
191
+ end
@@ -55,7 +55,7 @@ describe McBean::Markdownify do
55
55
 
56
56
  it "convert blockquote tag" do
57
57
  assert_markdown "<blockquote><p>Hello\nGoodbye</p></blockquote>",
58
- "> Hello\n> Goodbye\n"
58
+ "> Hello\n> Goodbye"
59
59
  end
60
60
 
61
61
  # it "convert nested blockquote tag" do
@@ -83,8 +83,8 @@ describe McBean::Textilify do
83
83
  end
84
84
 
85
85
  it "converts code blocks" do
86
- assert_textile "<pre><code>This is a code block\ncontinued</code></pre>",
87
- "\nbc. This is a code block\ncontinued\n"
86
+ assert_textile "<pre><code>This is a code block\ncontinued\n</code></pre>",
87
+ "\nbc. This is a code block\ncontinued\n\n", false
88
88
  end
89
89
 
90
90
  it "converts <br> tags to newlines" do
@@ -125,7 +125,6 @@ describe McBean::Textilify do
125
125
  assert_equal(Loofah::Helpers.remove_extraneous_whitespace("\n#{textile}\n"),
126
126
  McBean.document("<div>#{html}</div>").to_textile, "document transformation failed")
127
127
  end
128
-
129
128
  end
130
129
 
131
130
  describe McBean::Textilify::Antidote do
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcbean
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 15
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 3
8
+ - 4
8
9
  - 0
9
- version: 0.3.0
10
+ version: 0.4.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mike Dalessio
@@ -17,34 +18,36 @@ cert_chain:
17
18
  -----BEGIN CERTIFICATE-----
18
19
  MIIDPDCCAiSgAwIBAgIBADANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1taWtl
19
20
  LmRhbGVzc2lvMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
20
- FgNjb20wHhcNMDkwODExMDU0MjQ5WhcNMTAwODExMDU0MjQ5WjBEMRYwFAYDVQQD
21
+ FgNjb20wHhcNMTAwOTMwMDYyNjQ3WhcNMTEwOTMwMDYyNjQ3WjBEMRYwFAYDVQQD
21
22
  DA1taWtlLmRhbGVzc2lvMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
22
- k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDANjr7
23
- lZ1DKtK8YvNp+5kBzIpwrpClHRrosqo01qmWfGBxZckQUtrJUwGPxpzvIHVq1VKp
24
- a9FXU/QWYek/1S0vhkOf9XGmFBnVCtbJhwGeyzsQFFSoQIfs2hd5gO0dSRpuKdi3
25
- slfJAXzFKg1u/7OCVPgrY/mkdh34MzL5p0gSDzPt7vLPibctHg0GoepYT5Fh1tMQ
26
- luzgrN0weTw/QoEWTMQcNk6CyUpzv0pOe7d0qEPQ9Lx7Lz64gIym3f0pKFpWLfME
27
- l7PFLeR95zw2zsuZQwCR5ma5zjXD3mo2jk1mVqiI8qplOL1u30FU7hRhTV5n/Qe9
28
- elDQoZW9Xz0R5JGDAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
29
- A1UdDgQWBBRXWlUJZXcR1jkZPE24+mjUTCqNxjANBgkqhkiG9w0BAQUFAAOCAQEA
30
- jDh5M41sg1MZKG1DXzQmo/IADeWRmXyb3EZaED9lhFFpoQqaralgpgmvuc0GswvO
31
- QIZijh03tPQz8lgp1U1OFZod2ZwbEVTtVZpxs1ssjMraOA6KzlsNROH0XonIiy6j
32
- r2Q0UF35ax8pvr3D5Y6AKzIW1F3aeiREylUDJlb/i1dPQ2PVK0yRrSQoK2epwM9E
33
- zoczlHTTJc/tRvH5Up3Agcv9y+J0U9a1Af9NRsnHPVBdo2H32MsJ99x5NRDWJmJg
34
- ohH37UR7njcc6j4fo22IwTqXaaXJdtVdAWjXP/xs5B3cPYSP6uqFnR46Jf86Iqj1
35
- FlqnTjy13J3nD30uxy9a1g==
23
+ k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDLv4nl
24
+ BGRtliYy5s5MhlFO88UvkkETFcS79OCaGFKorxPTmcfDrR2/2x0mAySXJ6I1uPEU
25
+ WSAWaPb1at61NEOvp5kRNzUNdwGakBA/fd1vZ1N2rwHRtjk/8t6DX8yiflr6T761
26
+ 9ZMYPE+t85NvlPt0/WpT778imNZXwGQNcQJwNESDiBTgyjN8bOWpvRrVADVdOCme
27
+ DW3AfJnF/kdMYuSiUuFMZpyOlULEbOsrvOfUoEKjoFaVNv7FJ28/kLH1UgmtucOD
28
+ m5bZ/qy5b2+CWzzsmUfysaGnLQ4LjvAFpmgZGAjIE9TnyjU0jw+2e7dq8uRjdnFJ
29
+ gfWQlnJuwAlZXR1nAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
30
+ A1UdDgQWBBRbc4XnK6it228clp2DjyqaVjKW+DANBgkqhkiG9w0BAQUFAAOCAQEA
31
+ xPtSPtMl9qsgNGcnSDLSTjwGouwsjOB19IbtdODFTabUpRPCk7OFHeYGdJik4iiZ
32
+ fk10t3vzr6uWMAyOfwpWWFRnEYAvy9ZaMGDIZPKD8xWxaRTLwmi+pQsS8Lo2IpDC
33
+ Lb+l0lUiRiYS3/Ez7tA6pS122cvuQroWfuqh5Mi3pNAi1nuBTlhCNJuR5XUaOjqs
34
+ DAoZLfYEEW+4bmkAb6ky2TPUslaln56PO3/JG+IfWZwCvTFFVdKRBKXqLaAxO9rv
35
+ 7nflCv7xpUSUGGZ6hoPG8dil+Mp/kKV8cb1kxZz+C8660hC93dJ3FQ3adX30ylvZ
36
+ C4THW+6HEQDCdOkiArif8A==
36
37
  -----END CERTIFICATE-----
37
38
 
38
- date: 2010-04-18 00:00:00 -04:00
39
+ date: 2010-09-30 00:00:00 -04:00
39
40
  default_executable:
40
41
  dependencies:
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: loofah
43
44
  prerelease: false
44
45
  requirement: &id001 !ruby/object:Gem::Requirement
46
+ none: false
45
47
  requirements:
46
48
  - - ">="
47
49
  - !ruby/object:Gem::Version
50
+ hash: 1
48
51
  segments:
49
52
  - 0
50
53
  - 4
@@ -56,80 +59,149 @@ dependencies:
56
59
  name: rdiscount
57
60
  prerelease: false
58
61
  requirement: &id002 !ruby/object:Gem::Requirement
62
+ none: false
59
63
  requirements:
60
64
  - - ">="
61
65
  - !ruby/object:Gem::Version
66
+ hash: 15
62
67
  segments:
63
68
  - 1
64
- - 3
65
- - 4
66
- version: 1.3.4
69
+ - 6
70
+ - 0
71
+ version: 1.6.0
67
72
  type: :runtime
68
73
  version_requirements: *id002
69
74
  - !ruby/object:Gem::Dependency
70
75
  name: RedCloth
71
76
  prerelease: false
72
77
  requirement: &id003 !ruby/object:Gem::Requirement
78
+ none: false
73
79
  requirements:
74
80
  - - ">="
75
81
  - !ruby/object:Gem::Version
82
+ hash: 55
76
83
  segments:
77
84
  - 4
85
+ - 2
78
86
  - 0
79
- - 0
80
- version: 4.0.0
87
+ version: 4.2.0
81
88
  type: :runtime
82
89
  version_requirements: *id003
83
90
  - !ruby/object:Gem::Dependency
84
- name: rubyforge
91
+ name: creole
85
92
  prerelease: false
86
93
  requirement: &id004 !ruby/object:Gem::Requirement
94
+ none: false
87
95
  requirements:
88
96
  - - ">="
89
97
  - !ruby/object:Gem::Version
98
+ hash: 29
90
99
  segments:
91
- - 2
92
100
  - 0
93
101
  - 3
94
- version: 2.0.3
95
- type: :development
102
+ - 7
103
+ version: 0.3.7
104
+ type: :runtime
96
105
  version_requirements: *id004
97
106
  - !ruby/object:Gem::Dependency
98
- name: minitest
107
+ name: rubyforge
99
108
  prerelease: false
100
109
  requirement: &id005 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 7
115
+ segments:
116
+ - 2
117
+ - 0
118
+ - 4
119
+ version: 2.0.4
120
+ type: :development
121
+ version_requirements: *id005
122
+ - !ruby/object:Gem::Dependency
123
+ name: minitest
124
+ prerelease: false
125
+ requirement: &id006 !ruby/object:Gem::Requirement
126
+ none: false
101
127
  requirements:
102
128
  - - ">="
103
129
  - !ruby/object:Gem::Version
130
+ hash: 15
104
131
  segments:
105
132
  - 1
106
133
  - 6
107
134
  - 0
108
135
  version: 1.6.0
109
136
  type: :development
110
- version_requirements: *id005
137
+ version_requirements: *id006
138
+ - !ruby/object:Gem::Dependency
139
+ name: hoe-git
140
+ prerelease: false
141
+ requirement: &id007 !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ hash: 3
147
+ segments:
148
+ - 0
149
+ version: "0"
150
+ type: :development
151
+ version_requirements: *id007
152
+ - !ruby/object:Gem::Dependency
153
+ name: hoe-gemspec
154
+ prerelease: false
155
+ requirement: &id008 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ type: :development
165
+ version_requirements: *id008
166
+ - !ruby/object:Gem::Dependency
167
+ name: hoe-bundler
168
+ prerelease: false
169
+ requirement: &id009 !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ hash: 3
175
+ segments:
176
+ - 0
177
+ version: "0"
178
+ type: :development
179
+ version_requirements: *id009
111
180
  - !ruby/object:Gem::Dependency
112
181
  name: hoe
113
182
  prerelease: false
114
- requirement: &id006 !ruby/object:Gem::Requirement
183
+ requirement: &id010 !ruby/object:Gem::Requirement
184
+ none: false
115
185
  requirements:
116
186
  - - ">="
117
187
  - !ruby/object:Gem::Version
188
+ hash: 21
118
189
  segments:
119
190
  - 2
120
191
  - 6
121
- - 0
122
- version: 2.6.0
192
+ - 1
193
+ version: 2.6.1
123
194
  type: :development
124
- version_requirements: *id006
195
+ version_requirements: *id010
125
196
  description: |-
126
197
  McBean can convert documents from one format to another. McBean currently supports:
127
198
 
128
199
  * HTML
129
200
  * Markdown (a subset)
130
201
  * Textile (a subset)
202
+ * Creole (a subset)
131
203
 
132
- with the help of Loofah, Nokogiri, RDiscount and RedCloth.
204
+ with the help of Loofah, Nokogiri, RDiscount, RedCloth and Creole.
133
205
 
134
206
  "You can't teach a Sneetch." -- Sylvester McMonkey McBean
135
207
  email:
@@ -150,9 +222,12 @@ files:
150
222
  - Rakefile
151
223
  - bin/mcbean
152
224
  - lib/mcbean.rb
225
+ - lib/mcbean/creole.rb
153
226
  - lib/mcbean/markdown.rb
154
227
  - lib/mcbean/textile.rb
228
+ - mcbean.gemspec
155
229
  - test/helper.rb
230
+ - test/test_creole.rb
156
231
  - test/test_markdown.rb
157
232
  - test/test_mcbean.rb
158
233
  - test/test_textile.rb
@@ -167,27 +242,32 @@ rdoc_options:
167
242
  require_paths:
168
243
  - lib
169
244
  required_ruby_version: !ruby/object:Gem::Requirement
245
+ none: false
170
246
  requirements:
171
247
  - - ">="
172
248
  - !ruby/object:Gem::Version
249
+ hash: 3
173
250
  segments:
174
251
  - 0
175
252
  version: "0"
176
253
  required_rubygems_version: !ruby/object:Gem::Requirement
254
+ none: false
177
255
  requirements:
178
256
  - - ">="
179
257
  - !ruby/object:Gem::Version
258
+ hash: 3
180
259
  segments:
181
260
  - 0
182
261
  version: "0"
183
262
  requirements: []
184
263
 
185
264
  rubyforge_project: mcbean
186
- rubygems_version: 1.3.6
265
+ rubygems_version: 1.3.7
187
266
  signing_key:
188
267
  specification_version: 3
189
268
  summary: McBean can convert documents from one format to another
190
269
  test_files:
191
- - test/test_mcbean.rb
192
270
  - test/test_markdown.rb
271
+ - test/test_mcbean.rb
193
272
  - test/test_textile.rb
273
+ - test/test_creole.rb
metadata.gz.sig CHANGED
Binary file