Highlight should not be able to render local files.

This commit is contained in:
Tom Preston-Werner 2010-08-24 15:05:28 -07:00
parent 5e997cae21
commit d9bc00c804
3 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,7 @@
== HEAD
* Bug Fixes
* Highlight should not be able to render local files
== 0.6.2 / 2010-06-25 == 0.6.2 / 2010-06-25
* Bug Fixes * Bug Fixes
* Fix Rakefile 'release' task (tag pushing was missing origin) * Fix Rakefile 'release' task (tag pushing was missing origin)

View File

@ -54,7 +54,7 @@ class Albino
end end
def initialize(target, lexer = :text, format = :html) def initialize(target, lexer = :text, format = :html)
@target = File.exists?(target) ? File.read(target) : target rescue target @target = target
@options = { :l => lexer, :f => format, :O => 'encoding=utf-8' } @options = { :l => lexer, :f => format, :O => 'encoding=utf-8' }
end end

View File

@ -24,9 +24,7 @@ title: This is a test
This document results in a markdown error with maruku This document results in a markdown error with maruku
{% highlight text %} {% highlight text %}#{code}{% endhighlight %}
#{code}
{% endhighlight %}
CONTENT CONTENT
create_post(content, override) create_post(content, override)
end end
@ -45,6 +43,16 @@ CONTENT
end end
end end
context "post content has highlight with file reference" do
setup do
fill_post("./jekyll.gemspec")
end
should "not embed the file" do
assert_match %{<pre><code class='text'>./jekyll.gemspec\n</code></pre>}, @result
end
end
context "post content has highlight tag with UTF character" do context "post content has highlight tag with UTF character" do
setup do setup do
fill_post("Æ") fill_post("Æ")