# encoding: utf-8
#--
# Copyright (C) 2009 Johan Sørensen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see
foo
\nbar
foo
\n\nbar
\n", r.to_html end should "convert windows lineendings" do r = MarkupRenderer.new("foo\r\nbar") assert_equal "foo \nbar", r.pre_process end should "not touch code blocks, built with html tags" do r = MarkupRenderer.new("foo\nif (true)\n return false
")
exp = "foo
\n
if (true)\n return false
\n"
assert_equal exp, r.to_html
end
should "not touch code block, built with indentation" do
r = MarkupRenderer.new("foo\n if (true)\n return false")
exp = "foo
\n
if (true)\n return false\n
\n"
assert_equal exp, r.to_html
end
should "wrap a multi line block in newlines" do
r = MarkupRenderer.new("foo\nbar\nbaz\nqux")
assert_equal "foo
\nbar
\nbaz
\nqux
foo
\nfoo
\n