Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update to maruku 0.7 #1775

Merged
merged 3 commits into from

5 participants

@Ivoz

I do not believe there's been any major API change, AFAIK

Maruku Changelog

Gemspec now asks for 0.7.0 (final), which has been released.

It has changed some output behaviour after transitioning to its own output engine.

The parser will now do a .strip to take out any newlines Maruku has added surrounding html produced.

Maruku now produces " for attribute (src) quotes and uses the !CDATA tag inside script so that it will produce valid XHTML.

I updated the tests to account for these.

@Ivoz Ivoz referenced this pull request
Closed

Trying out Maruku 0.7.0 #1558

0 of 2 tasks complete
@mattr-
Owner

The parser will now do a .strip to take out any newlines Maruku has added surrounding html produced.

Can you take this out? It's a change we've rejected before, I believe.

@Ivoz

It's a change we've rejected before, I believe.

I'd love to know when/where (to see why)?

AFAIK html should never be invalidated / structurally changed by removing such newlines between full elements.

Otherwise you get these test failures:

  1) Failure:
test: An extracted excerpt #content after render should be the first paragraph of the page. (TestExcerpt) [/home/ivo/code/jekyll-dev/test/test_excerpt.rb:69]:
<"<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>"> expected but was
<"\n<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n">.

  2) Failure:
test: filters should markdownify with simple string. (TestFilters) [/home/ivo/code/jekyll-dev/test/test_filters.rb:25]:
<"<p>something <strong>really</strong> simple</p>"> expected but was
<"\n<p>something <strong>really</strong> simple</p>\n">.

  3) Failure:
test: A Post initializing posts rendering should include templates. (TestPost) [/home/ivo/code/jekyll-dev/test/test_post.rb:507]:
<"<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>"> expected but was
<"<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p>\n >>>">.

  4) Failure:
test: A Post processing posts #excerpt should return rendered HTML. (TestPost) [/home/ivo/code/jekyll-dev/test/test_post.rb:287]:
<"<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>"> expected but was
<"\n<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n">.

Which imho altering for would just be testing for maruku-specific output

An alternative would be to strip the test case output instead, I guess

@mattr-
Owner

Oh, so the newlines are something new added in Maruku 0.7.0? If that's the case, then let's leave it in.

@parkr parkr commented on the diff
test/test_tags.rb
@@ -252,7 +252,7 @@ def fill_post(code, override = {})
end
should "write script tag" do
- assert_match "<script src='https://gist.github.com/#{@gist}.js'>\s</script>", @result
+ assert_match "<script src='https://gist.github.com/#{@gist}.js'><![CDATA[\s]]></script>", @result
@parkr Owner
parkr added a note

This new CDATA declaration is kind of strange. I wonder if it interferes with the gist visually.

@Ivoz
Ivoz added a note

Maruku 0.7 added them as they are technically needed to surround inline javascript for valid XHTML, which is what it aims to produce.

@parkr Owner
parkr added a note

Ok, cool! I don't this will be a blocker so :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@parkr
Owner

I :heart: the call to String#strip for sure. Anything to reduce the change in behaviour, the better.

As long as 100% of the tests pass, I'm :+1:.

This supercedes #1558.

@konklone

Also :+1:, for what that's worth. Thanks for bringing this home.

@parkr
Owner

Ok so I can't see any of the build histories on GitHub (wtf?), luckily TravisCI gives a listing of PRs and their build histories.

@mattr- I'm :+1: on this, as tests are passing and there aren't any incompatibilities from a site perspective that I can think of.

@zoul

FWIW, Maruku 0.7 also contains a fix for an undesired shortening of HTML tags that makes Jekyll screw up the output with some simple markup.

@mattr- mattr- merged commit 9f15932 into from
@Ivoz

Awesome, cheers

@mattr-
Owner

Updated history in 8b0ea62

@konklone

Woo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
8 features/markdown.feature
@@ -13,8 +13,8 @@ Feature: Markdown
When I run jekyll
Then the _site directory should exist
And I should see "Index" in "_site/index.html"
- And I should see "<h1 id='my_title'>My Title</h1>" in "_site/2009/03/27/hackers.html"
- And I should see "<h1 id='my_title'>My Title</h1>" in "_site/index.html"
+ And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/2009/03/27/hackers.html"
+ And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/index.html"
Scenario: Markdown in pagination on index
Given I have a configuration file with "paginate" set to "5"
@@ -26,5 +26,5 @@ Feature: Markdown
When I run jekyll
Then the _site directory should exist
And I should see "Index" in "_site/index.html"
- And I should see "<h1 id='my_title'>My Title</h1>" in "_site/index.html"
-
+ And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/index.html"
+
View
8 features/site_configuration.feature
@@ -67,28 +67,28 @@ Feature: Site configuration
And I have a configuration file with "markdown" set to "rdiscount"
When I run jekyll
Then the _site directory should exist
- And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
+ And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Use Kramdown for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "kramdown"
When I run jekyll
Then the _site directory should exist
- And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
+ And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Use Redcarpet for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "redcarpet"
When I run jekyll
Then the _site directory should exist
- And I should see "<a href="http://google.com">Google</a>" in "_site/index.html"
+ And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Use Maruku for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "maruku"
When I run jekyll
Then the _site directory should exist
- And I should see "<a href='http://google.com'>Google</a>" in "_site/index.html"
+ And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Highlight code with pygments
Given I have an "index.html" file that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
View
2  jekyll.gemspec
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('liquid', "~> 2.5.2")
s.add_runtime_dependency('classifier', "~> 1.3")
s.add_runtime_dependency('listen', "~> 1.3")
- s.add_runtime_dependency('maruku', "~> 0.6.0")
+ s.add_runtime_dependency('maruku', "~> 0.7.0")
s.add_runtime_dependency('pygments.rb', "~> 0.5.0")
s.add_runtime_dependency('commander', "~> 4.1.3")
s.add_runtime_dependency('safe_yaml', "~> 0.9.7")
View
2  lib/jekyll/converters/markdown/maruku_parser.rb
@@ -41,7 +41,7 @@ def print_errors_and_fail
end
def convert(content)
- converted = Maruku.new(content, :error_stream => @errors).to_html
+ converted = Maruku.new(content, :error_stream => @errors).to_html.strip
print_errors_and_fail unless @errors.empty?
converted
end
View
2  test/test_excerpt.rb
@@ -66,7 +66,7 @@ def do_render(post)
end
should "be the first paragraph of the page" do
- assert_equal "<p>First paragraph with <a href='http://www.jekyllrb.com/'>link ref</a>.</p>", @extracted_excerpt.content
+ assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>", @extracted_excerpt.content
end
should "link properly" do
View
2  test/test_post.rb
@@ -284,7 +284,7 @@ def do_render(post)
end
should "return rendered HTML" do
- assert_equal "<p>First paragraph with <a href='http://www.jekyllrb.com/'>link ref</a>.</p>",
+ assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>",
@post.excerpt
end
View
6 test/test_tags.rb
@@ -252,7 +252,7 @@ def fill_post(code, override = {})
end
should "write script tag" do
- assert_match "<script src='https://gist.github.com/#{@gist}.js'>\s</script>", @result
+ assert_match "<script src='https://gist.github.com/#{@gist}.js'><![CDATA[\s]]></script>", @result
@parkr Owner
parkr added a note

This new CDATA declaration is kind of strange. I wonder if it interferes with the gist visually.

@Ivoz
Ivoz added a note

Maruku 0.7 added them as they are technically needed to surround inline javascript for valid XHTML, which is what it aims to produce.

@parkr Owner
parkr added a note

Ok, cool! I don't this will be a blocker so :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
end
@@ -272,7 +272,7 @@ def fill_post(code, override = {})
end
should "write script tag with specific file in gist" do
- assert_match "<script src='https://gist.github.com/#{@gist}.js?file=#{@filename}'>\s</script>", @result
+ assert_match "<script src='https://gist.github.com/#{@gist}.js?file=#{@filename}'><![CDATA[\s]]></script>", @result
end
end
@@ -308,7 +308,7 @@ def fill_post(code, override = {})
end
should "write script tag with specific file in gist" do
- assert_match "<script src='https://gist.github.com/#{@gist}.js?file=#{@filename}'>\s</script>", @result
+ assert_match "<script src='https://gist.github.com/#{@gist}.js?file=#{@filename}'><![CDATA[\s]]></script>", @result
end
end
Something went wrong with that request. Please try again.