\n?(.*?)\n?<\/div>\Z/m, '\1')
end
-
end
end
class Mixed < AbstractEngine
def mask
- require 'sanitize'
require 'redcloth'
redcloth = RedCloth.new(@content, @content.options[:engine_opts])
redcloth.filter_html = false
redcloth.no_span_caps = false
html = redcloth.to_html
- sanitize_xhtml(html)
end
end
class RDoc < AbstractEngine
def mask
- require 'sanitize'
require_dependency 'rdocsupport'
html = RDocSupport::RDocFormatter.new(@content).to_html
- sanitize_xhtml(html)
end
end
diff --git a/lib/wiki_content.rb b/lib/wiki_content.rb
index 94e3e3f3..c3e9de1e 100644
--- a/lib/wiki_content.rb
+++ b/lib/wiki_content.rb
@@ -4,8 +4,8 @@ require 'chunks/category'
require_dependency 'chunks/include'
require_dependency 'chunks/wiki'
require_dependency 'chunks/literal'
-#require_dependency 'chunks/uri'
require 'chunks/nowiki'
+require 'sanitize'
# Wiki content is just a string that can process itself with a chain of
# actions. The actions can modify wiki content so that certain parts of
@@ -192,7 +192,7 @@ class WikiContent < String
chunk.unmask_text
end
end
- self
+ self.replace sanitize_xhtml(self)
end
def page_name
diff --git a/test/functional/file_controller_test.rb b/test/functional/file_controller_test.rb
index 6a05b0d8..ac18d831 100755
--- a/test/functional/file_controller_test.rb
+++ b/test/functional/file_controller_test.rb
@@ -80,7 +80,7 @@ class FileControllerTest < Test::Unit::TestCase
renderer = PageRenderer.new
@wiki.revise_page('wiki1', 'HomePage', '[[rails-e2e.gif:pic]]',
Time.now, 'AnonymousBrave', renderer)
- assert_equal "
",
rendered_content(@web.page("SecondPage")))
end
@@ -42,17 +42,17 @@ class PageRendererTest < Test::Unit::TestCase
end
def test_content_with_wiki_links
- assert_equal '
His Way? ' +
- 'would be My Way ' +
- ' in kinda ' +
- 'That Way in ' +
- 'His Way? ' +
- %{though My Way OverThere \xE2\x80\x93 see } +
- 'Smart Engine in that ' +
- 'Smart Engine GUI' +
- '?
',
+ assert_equal "
His Way? " +
+ "would be My Way " +
+ " in kinda " +
+ "That Way in " +
+ "His Way? " +
+ %{though My Way OverThere \xE2\x80\x93 see } +
+ "Smart Engine in that " +
+ "Smart Engine GUI" +
+ "?
",
test_renderer(@revision).display_content
end
@@ -60,31 +60,31 @@ class PageRendererTest < Test::Unit::TestCase
set_web_property :markup, :markdownMML
assert_markup_parsed_as(
- %{
',
'_should we go ThatWay or ThisWay _')
end
@@ -213,15 +212,15 @@ class PageRendererTest < Test::Unit::TestCase
# wikiwords are invalid as styles, must be in "name: value" form
def test_content_with_wikiword_in_style_tag
assert_markup_parsed_as(
- '
That is some Stylish Emphasis
',
- 'That is some Stylish Emphasis')
+ "
That is some Stylish Emphasis
",
+ "That is some Stylish Emphasis")
end
# validates format of style..
def test_content_with_valid_style_in_style_tag
assert_markup_parsed_as(
- '
That is some Stylish Emphasis
',
- 'That is some Stylish Emphasis')
+ "
That is some Stylish Emphasis
",
+ "That is some Stylish Emphasis")
end
def test_content_with_escaped_wikiword
@@ -248,24 +247,24 @@ class PageRendererTest < Test::Unit::TestCase
def test_content_with_link_in_parentheses
assert_markup_parsed_as(
- '
",
'([What is a wiki?](http://wiki.org/wiki.cgi?WhatIsWiki))')
end
def test_content_with_image_link
assert_markup_parsed_as(
- '
This is a Markdown image link.
',
+ "
This is a Markdown image link.
",
'This ![](http://hobix.com/sample.jpg) is a Markdown image link.')
end
def test_content_with_inlined_img_tag
assert_markup_parsed_as(
- '
This is an inline image link.
',
+ "
This is an inline image link.
",
'This is an inline image link.')
# currently, upper case HTML elements are not allowed
assert_markup_parsed_as(
- '
This <IMG SRC="http://hobix.com/sample.jpg" alt=""></IMG> is an inline image link.
',
+ "
This <IMG SRC=\"http://hobix.com/sample.jpg\" alt=\"\"/> is an inline image link.
",
'This is an inline image link.')
end
@@ -279,7 +278,7 @@ class PageRendererTest < Test::Unit::TestCase
def test_multiline_nowiki_tag
assert_markup_parsed_as(
"
Do not mark \n up [[this text]] \nand http://this.url.com but markup " +
- 'this?
",
"Do not mark \n up [[this text]] \n" +
"and http://this.url.com but markup [[this]]")
end
@@ -293,45 +292,45 @@ class PageRendererTest < Test::Unit::TestCase
def test_content_with_bracketted_wiki_word
set_web_property :brackets_only, true
assert_markup_parsed_as(
- '
This is a WikiWord and a tricky name ' +
- 'Sperberg-McQueen?.
',
+ "
This is a WikiWord and a tricky name " +
+ "Sperberg-McQueen?.
",
'This is a WikiWord and a tricky name [[Sperberg-McQueen]].')
end
def test_content_for_export
- assert_equal '
His Way would be ' +
- 'My Way ' +
- ' in kinda ' +
- 'That Way in ' +
- 'His Way though ' +
- %{My Way OverThere \xE2\x80\x93 see } +
- 'Smart Engine in that ' +
- 'Smart Engine GUI
',
+ assert_equal "
His Way would be " +
+ "My Way " +
+ " in kinda " +
+ "That Way in " +
+ "His Way though " +
+ %{My Way OverThere \xE2\x80\x93 see } +
+ "Smart Engine in that " +
+ "Smart Engine GUI