Add local file support.

Example of absolute path to local file.
```html:/home```

Example of relative path to local file.
```html:home```

1.8.7 string fix. 's'[0..0] instead of 's'[0]

Fix regex.

Add absolute and relative tests.
This commit is contained in:
bootstraponline
2012-09-10 21:37:47 -06:00
parent 424b4d3f4e
commit 05c4bf3374
5 changed files with 58 additions and 10 deletions
+29
View File
@@ -495,6 +495,35 @@ np.array([[2,2],[1,3]],np.float)
assert_match /\(\[\[/, rendered, "#{markup_class} parses out wiki links\n#{rendered}"
end
test "embed code is escaped" do
@wiki.write_page("script", :markdown, "a <script></script> b", commit_details)
@wiki.write_page("page", :markdown, "```html:script```", commit_details)
output_script = @wiki.page("script").formatted_data
output_page = @wiki.page("page").formatted_data
assert_equal %Q{<p>a b</p>}, output_script
assert_equal %Q{<div class=\"highlight\">\n<pre><span class=\"nt\">&lt;p&gt;</span>a b<span class=\"nt\">&lt;/p&gt;</span>\n</pre>\n</div>\n}, output_page
end
test "embed code page absolute link" do
@wiki.write_page("base", :markdown, "a\n!base\b", commit_details)
@wiki.write_page("a", :markdown, "a\n```html:/base```\b", commit_details)
page = @wiki.page("a")
output = page.formatted_data
assert_equal %Q{<p>a\n</p><div class=\"highlight\">\n<pre><span class=\"nt\">&lt;p&gt;</span>a\n!base<span class=\"nt\">&lt;/p&gt;</span>\n</pre>\n</div>\n\n}, output
end
test "embed code page relative link" do
@wiki.write_page("base", :markdown, "a\n!rel\b", commit_details)
@wiki.write_page("a", :markdown, "a\n```html:base```\b", commit_details)
page = @wiki.page("a")
output = page.formatted_data
assert_equal %Q{<p>a\n</p><div class=\"highlight\">\n<pre><span class=\"nt\">&lt;p&gt;</span>a\n!rel<span class=\"nt\">&lt;/p&gt;</span>\n</pre>\n</div>\n\n}, output
end
#########################################################################
#
# Web Sequence Diagrams