STRIP ALL THE NEWLINES FROM HIGHLIGHTED CODE ok just the ones at the beginning and end
This commit is contained in:
parent
2a3f0c0ec3
commit
8ccdee4035
|
@ -49,7 +49,7 @@ eos
|
||||||
render_rouge(context, code)
|
render_rouge(context, code)
|
||||||
else
|
else
|
||||||
render_codehighlighter(context, code)
|
render_codehighlighter(context, code)
|
||||||
end
|
end.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_pygments(context, code)
|
def render_pygments(context, code)
|
||||||
|
@ -107,8 +107,9 @@ eos
|
||||||
|
|
||||||
def add_code_tags(code, lang)
|
def add_code_tags(code, lang)
|
||||||
# Add nested <code> tags to code blocks
|
# Add nested <code> tags to code blocks
|
||||||
code = code.sub(/<pre>/,'<pre><code class="' + lang.to_s.gsub("+", "-") + '">')
|
code = code.sub(/<pre>\n*/,'<pre><code class="' + lang.to_s.gsub("+", "-") + '">')
|
||||||
code = code.sub(/<\/pre>/,"</code></pre>")
|
code = code.sub(/\n*<\/pre>/,"</code></pre>")
|
||||||
|
code.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "ensure post count is as expected" do
|
should "ensure post count is as expected" do
|
||||||
assert_equal 40, @site.posts.size
|
assert_equal 41, @site.posts.size
|
||||||
end
|
end
|
||||||
|
|
||||||
should "insert site.posts into the index" do
|
should "insert site.posts into the index" do
|
||||||
|
|
|
@ -33,8 +33,12 @@ 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 %}#{code}{% endhighlight %}
|
{% highlight text %}
|
||||||
{% highlight text linenos %}#{code}{% endhighlight %}
|
#{code}
|
||||||
|
{% endhighlight %}
|
||||||
|
{% highlight text linenos %}
|
||||||
|
#{code}
|
||||||
|
{% endhighlight %}
|
||||||
CONTENT
|
CONTENT
|
||||||
create_post(content, override)
|
create_post(content, override)
|
||||||
end
|
end
|
||||||
|
@ -87,11 +91,11 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render markdown with pygments" do
|
should "render markdown with pygments" do
|
||||||
assert_match %{<pre><code class="text">test\n</code></pre>}, @result
|
assert_match %{<pre><code class="text">test</code></pre>}, @result
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render markdown with pygments with line numbers" do
|
should "render markdown with pygments with line numbers" do
|
||||||
assert_match %{<pre><code class="text"><span class="lineno">1</span> test\n</code></pre>}, @result
|
assert_match %{<pre><code class="text"><span class="lineno">1</span> test</code></pre>}, @result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -101,7 +105,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not embed the file" do
|
should "not embed the file" do
|
||||||
assert_match %{<pre><code class="text">./jekyll.gemspec\n</code></pre>}, @result
|
assert_match %{<pre><code class="text">./jekyll.gemspec</code></pre>}, @result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -111,7 +115,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render markdown with pygments line handling" do
|
should "render markdown with pygments line handling" do
|
||||||
assert_match %{<pre><code class="text">Æ\n</code></pre>}, @result
|
assert_match %{<pre><code class="text">Æ</code></pre>}, @result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue