[DRE-commits] [jekyll] 06/07: Attempt to fix jekyll with rouge2 (incomplete, WIP)

Cédric Boutillier boutil at moszumanska.debian.org
Wed Aug 24 15:24:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

boutil pushed a commit to branch master
in repository jekyll.

commit db6c83e9c0c8835fcb506cd7468fef9bc79f5a66
Author: Cédric Boutillier <boutil at debian.org>
Date:   Wed Aug 24 17:21:48 2016 +0200

    Attempt to fix jekyll with rouge2 (incomplete, WIP)
---
 debian/patches/0015_skip_test_kramdown_rouge.patch |  28 +++++
 debian/patches/rouge2.patch                        | 119 +++++++++++++++++++++
 debian/patches/series                              |   2 +
 3 files changed, 149 insertions(+)

diff --git a/debian/patches/0015_skip_test_kramdown_rouge.patch b/debian/patches/0015_skip_test_kramdown_rouge.patch
new file mode 100644
index 0000000..289131e
--- /dev/null
+++ b/debian/patches/0015_skip_test_kramdown_rouge.patch
@@ -0,0 +1,28 @@
+--- a/test/test_kramdown.rb
++++ b/test/test_kramdown.rb
+@@ -53,16 +53,16 @@
+       end
+     end
+ 
+-    should "render fenced code blocks with syntax highlighting" do
+-      result = nokogiri_fragment(@markdown.convert(Utils.strip_heredoc(<<-MARKDOWN)))
+-        ~~~ruby
+-        puts "Hello World"
+-        ~~~
+-      MARKDOWN
++    #should "render fenced code blocks with syntax highlighting" do
++    #  result = nokogiri_fragment(@markdown.convert(Utils.strip_heredoc(<<-MARKDOWN)))
++    #    ~~~ruby
++    #    puts "Hello World"
++    #    ~~~
++    #  MARKDOWN
+ 
+-      selector = "div.highlighter-rouge>pre.highlight>code"
+-      refute result.css(selector).empty?
+-    end
++    #  selector = "div.highlighter-rouge>pre.highlight>code"
++    #  refute result.css(selector).empty?
++    #end
+ 
+     context "when a custom highlighter is chosen" do
+       should "use the chosen highlighter if it's available" do
diff --git a/debian/patches/rouge2.patch b/debian/patches/rouge2.patch
new file mode 100644
index 0000000..9c61fa3
--- /dev/null
+++ b/debian/patches/rouge2.patch
@@ -0,0 +1,119 @@
+From 648bb60aab4fb709dbb2c721c62246d91bbcd551 Mon Sep 17 00:00:00 2001
+From: Florian Thomas <flo at florianthomas.net>
+Date: Thu, 11 Aug 2016 22:43:36 +0200
+Subject: [PATCH] bump rouge to 2.0.x
+
+---
+ jekyll.gemspec                                     |  2 +-
+ lib/jekyll.rb                                      |  1 +
+ lib/jekyll/converters/markdown/redcarpet_parser.rb |  2 +-
+ lib/jekyll/tags/highlight.rb                       |  7 ++++--
+ test/test_kramdown.rb                              |  5 ++++-
+ test/test_tags.rb                                  | 26 +++++++++++-----------
+ 6 files changed, 25 insertions(+), 18 deletions(-)
+
+--- a/jekyll.gemspec
++++ b/jekyll.gemspec
+@@ -507,7 +507,7 @@
+   s.add_runtime_dependency('mercenary', '~> 0.3.3')
+   s.add_runtime_dependency('safe_yaml', '~> 1.0')
+   s.add_runtime_dependency('colorator', '~> 1.0')
+-  s.add_runtime_dependency('rouge', '~> 1.7')
++  s.add_runtime_dependency('rouge', '~> 2.0.5')
+   s.add_runtime_dependency('jekyll-sass-converter', '~> 1.0')
+   s.add_runtime_dependency('jekyll-watch', '~> 1.1')
+   s.add_runtime_dependency("pathutil", "~> 0.9")
+--- a/lib/jekyll.rb
++++ b/lib/jekyll.rb
+@@ -30,6 +30,7 @@
+ require "liquid"
+ require "kramdown"
+ require "colorator"
++require "rouge"
+ 
+ SafeYAML::OPTIONS[:suppress_warnings] = true
+ 
+--- a/lib/jekyll/converters/markdown/redcarpet_parser.rb
++++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb
+@@ -55,7 +55,7 @@
+ 
+     protected
+     def rouge_formatter(_lexer)
+-      Rouge::Formatters::HTML.new(:wrap => false)
++      Rouge::Formatters::HTMLLegacy.new(:wrap => false)
+     end
+   end
+ 
+--- a/lib/jekyll/tags/highlight.rb
++++ b/lib/jekyll/tags/highlight.rb
+@@ -110,9 +110,12 @@
+ 
+       def render_rouge(code)
+         Jekyll::External.require_with_graceful_fail("rouge")
+-        formatter = Rouge::Formatters::HTML.new(
++        formatter = Rouge::Formatters::HTMLLegacy.new(
+           :line_numbers => @highlight_options[:linenos],
+-          :wrap         => false
++          :wrap         => false,
++          :css_class    => "highlight",
++          :gutter_class => "gutter",
++          :code_class   => "code"
+         )
+         lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
+         formatter.format(lexer.lex(code))
+--- a/test/test_kramdown.rb
++++ b/test/test_kramdown.rb
+@@ -16,7 +16,10 @@
+ 
+           "syntax_highlighter"      => "rouge",
+           "syntax_highlighter_opts" => {
+-            "bold_every" => 8, "css" => :class
++            "bold_every" => 8,
++            "css"        => :class,
++            "css_class"  => "highlight",
++            "formatter"  => ::Rouge::Formatters::HTMLLegacy
+           }
+         }
+       }
+--- a/test/test_tags.rb
++++ b/test/test_tags.rb
+@@ -317,10 +317,10 @@
+ 
+       should "render markdown with rouge with line numbers" do
+         assert_match(
+-          %(<table style="border-spacing: 0"><tbody>) +
+-            %(<tr><td class="gutter gl" style="text-align: right">) +
+-            %(<pre class="lineno">1</pre></td>) +
+-            %(<td class="code"><pre>test<span class="w">\n</span></pre></td></tr>) +
++          %(<table class="rouge-table"><tbody>) +
++            %(<tr><td class="gutter gl">) +
++            %(<pre class="lineno">1\n</pre></td>) +
++            %(<td class="code"><pre>test</pre></td></tr>) +
+             %(</tbody></table>),
+           @result
+         )
+@@ -415,15 +415,15 @@
+       end
+ 
+       should "should stop highlighting at boundary" do
+-        expected = <<-EOS
+-<p>This is not yet highlighted</p>
+-
+-<figure class="highlight"><pre><code class="language-php" data-lang="php"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre>test<span class="w">
+-</span></pre></td></tr></tbody></table></code></pre></figure>
+-
+-<p>This should not be highlighted, right?</p>
+-EOS
+-        assert_match(expected, @result)
++        assert_match(
++          %(<p>This is not yet highlighted</p>\n\n<figure class="highlight">) +
++            %(<pre><code class="language-php" data-lang="php">) +
++            %(<table class="rouge-table"><tbody><tr><td class="gutter gl">) +
++            %(<pre class="lineno">1\n</pre></td><td class="code"><pre>test</pre></td>) +
++            %(</tr></tbody></table></code></pre></figure>\n\n) +
++            %(<p>This should not be highlighted, right?</p>),
++          @result
++        )
+       end
+     end
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 46f8377..a320f90 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,5 @@
 0014_skip_test_autopkgtest.patch
 #adapt_test_rouge2.patch
 #relax-colorator.patch
+#0015_skip_test_kramdown_rouge.patch
+rouge2.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/jekyll.git



More information about the Pkg-ruby-extras-commits mailing list