mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-30 01:08:26 -05:00
STRIP ALL THE NEWLINES FROM HIGHLIGHTED CODE ok just the ones at the beginning and end
This commit is contained in:
@@ -49,7 +49,7 @@ eos
|
||||
render_rouge(context, code)
|
||||
else
|
||||
render_codehighlighter(context, code)
|
||||
end
|
||||
end.strip
|
||||
end
|
||||
|
||||
def render_pygments(context, code)
|
||||
@@ -107,8 +107,9 @@ eos
|
||||
|
||||
def add_code_tags(code, lang)
|
||||
# Add nested <code> tags to code blocks
|
||||
code = code.sub(/<pre>/,'<pre><code class="' + lang.to_s.gsub("+", "-") + '">')
|
||||
code = code.sub(/<\/pre>/,"</code></pre>")
|
||||
code = code.sub(/<pre>\n*/,'<pre><code class="' + lang.to_s.gsub("+", "-") + '">')
|
||||
code = code.sub(/\n*<\/pre>/,"</code></pre>")
|
||||
code.strip
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "ensure post count is as expected" do
|
||||
assert_equal 40, @site.posts.size
|
||||
assert_equal 41, @site.posts.size
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
{% highlight text %}#{code}{% endhighlight %}
|
||||
{% highlight text linenos %}#{code}{% endhighlight %}
|
||||
{% highlight text %}
|
||||
#{code}
|
||||
{% endhighlight %}
|
||||
{% highlight text linenos %}
|
||||
#{code}
|
||||
{% endhighlight %}
|
||||
CONTENT
|
||||
create_post(content, override)
|
||||
end
|
||||
@@ -87,11 +91,11 @@ CONTENT
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@@ -101,7 +105,7 @@ CONTENT
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@@ -111,7 +115,7 @@ CONTENT
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user