[BUILD BROKEN] BlueCloth the original distribution has some bugs. Digged out a patched-up version from Instiki 0.9

This commit is contained in:
Alexey Verkhovsky 2005-04-10 17:48:50 +00:00
parent 6f36e53290
commit a251b658f1
5 changed files with 1149 additions and 4 deletions

View file

@ -1,6 +1,7 @@
$: << File.dirname(__FILE__) + "../../lib" $: << File.dirname(__FILE__) + "../../lib"
require 'redcloth' require 'redcloth'
require 'bluecloth_tweaked'
require 'rdocsupport' require 'rdocsupport'
require 'chunks/chunk' require 'chunks/chunk'
@ -27,7 +28,10 @@ module Engines
class Textile < AbstractEngine class Textile < AbstractEngine
def mask def mask
RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts]).to_html(:textile) redcloth = RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts])
redcloth.filter_html = false
redcloth.no_span_caps = false
redcloth.to_html(:textile)
end end
end end
@ -39,7 +43,8 @@ module Engines
class Mixed < AbstractEngine class Mixed < AbstractEngine
def mask def mask
RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts]).to_html RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts]).to_html(
:textile, :markdown)
end end
end end

View file

@ -38,7 +38,6 @@ unless defined? ADDITIONAL_LOAD_PATHS
vendor/rails/actionwebservice/lib vendor/rails/actionwebservice/lib
vendor/madeleine-0.7.1/lib vendor/madeleine-0.7.1/lib
vendor/RedCloth-3.0.3/lib vendor/RedCloth-3.0.3/lib
vendor/BlueCloth-1.0.0/lib
vendor/rubyzip-0.5.8/lib vendor/rubyzip-0.5.8/lib
).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}" ).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}"
}.delete_if { |dir| not File.exist?(dir) } }.delete_if { |dir| not File.exist?(dir) }

View file

@ -26,7 +26,6 @@ spec = Gem::Specification.new do |s|
s.add_dependency('madeleine', '= 0.7.1') s.add_dependency('madeleine', '= 0.7.1')
s.add_dependency('RedCloth', '= 3.0.3') s.add_dependency('RedCloth', '= 3.0.3')
s.add_dependency('BlueCloth', '= 1.0.0')
s.add_dependency('rubyzip', '= 0.5.8') s.add_dependency('rubyzip', '= 0.5.8')
s.add_dependency('rails', '= 0.11.1') s.add_dependency('rails', '= 0.11.1')
s.requirements << 'none' s.requirements << 'none'

1127
lib/bluecloth_tweaked.rb Normal file

File diff suppressed because it is too large Load diff

View file

@ -71,6 +71,9 @@ class RevisionTest < Test::Unit::TestCase
%{<p>This is a code block:</p>\n\n<pre><code>def a_method(arg)\n} + %{<p>This is a code block:</p>\n\n<pre><code>def a_method(arg)\n} +
%{return ThatWay\n</code></pre>\n\n<p>Nice!</p>}, %{return ThatWay\n</code></pre>\n\n<p>Nice!</p>},
code_block) code_block)
end
def test_mixed_formatting
textile_and_markdown = [ textile_and_markdown = [
'Markdown heading', 'Markdown heading',
@ -84,6 +87,7 @@ class RevisionTest < Test::Unit::TestCase
'* list 2' '* list 2'
].join("\n") ].join("\n")
@web.markup = :markdown
assert_markup_parsed_as( assert_markup_parsed_as(
"<h1>Markdown heading</h1>\n\n" + "<h1>Markdown heading</h1>\n\n" +
"<p>h2. Textile heading</p>\n\n" + "<p>h2. Textile heading</p>\n\n" +
@ -91,6 +95,17 @@ class RevisionTest < Test::Unit::TestCase
"<ul>\n<li>list 1</li>\n<li>list 2</li>\n</ul>", "<ul>\n<li>list 1</li>\n<li>list 2</li>\n</ul>",
textile_and_markdown) textile_and_markdown)
@web.markup = :textile
assert_markup_parsed_as(
"<p>Markdown heading<br />================</p>\n\n\n\t<h2>Textile heading</h2>" +
"\n\n\n\t<p><strong>some</strong> <b>text</b> <em>with</em> <del>styles</del></p>" +
"\n\n\n\t<ul>\n\t<li>list 1</li>\n\t\t<li>list 2</li>\n\t</ul>",
textile_and_markdown)
@web.markup = :mixed
assert_markup_parsed_as(
"<h1>Markdown heading</h1>\n\n\n\t<h2>Textile heading</h2>",
textile_and_markdown)
end end
def test_rdoc def test_rdoc