Merge pull request #3655 from alfredxing/sunset-maruku
Merge pull request 3655
This commit is contained in:
commit
7d3a5f82be
1
Gemfile
1
Gemfile
|
@ -14,7 +14,6 @@ gem 'rdoc', '~> 3.11'
|
|||
gem 'redgreen', '~> 1.2'
|
||||
gem 'shoulda', '~> 3.5'
|
||||
gem 'cucumber', '1.3.18'
|
||||
gem 'maruku', '~> 0.7.0'
|
||||
gem 'rdiscount', '~> 2.0'
|
||||
gem 'launchy', '~> 2.3'
|
||||
gem 'simplecov', '~> 0.9'
|
||||
|
|
|
@ -30,41 +30,3 @@ Feature: Markdown
|
|||
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"
|
||||
|
||||
Scenario: Maruku fenced codeblocks
|
||||
Given I have a configuration file with "markdown" set to "maruku"
|
||||
And I have an "index.markdown" file with content:
|
||||
"""
|
||||
---
|
||||
title: My title
|
||||
---
|
||||
|
||||
# My title
|
||||
|
||||
```
|
||||
My awesome code
|
||||
```
|
||||
"""
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "My awesome code" in "_site/index.html"
|
||||
And I should see "<pre><code>My awesome code</code></pre>" in "_site/index.html"
|
||||
|
||||
Scenario: Maruku fenced codeblocks with syntax highlighting
|
||||
Given I have a configuration file with "markdown" set to "maruku"
|
||||
And I have an "index.markdown" file with content:
|
||||
"""
|
||||
---
|
||||
title: My title
|
||||
---
|
||||
|
||||
# My title
|
||||
|
||||
```ruby
|
||||
puts "My awesome string"
|
||||
```
|
||||
"""
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "My awesome string" in "_site/index.html"
|
||||
And I should see "<pre class="ruby"><code class="ruby">puts "My awesome string"</code></pre>" in "_site/index.html"
|
||||
|
|
|
@ -83,13 +83,6 @@ Feature: Site configuration
|
|||
Then the _site directory should exist
|
||||
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 build
|
||||
Then the _site directory should exist
|
||||
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" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
||||
When I run jekyll build
|
||||
|
|
|
@ -56,15 +56,6 @@ module Jekyll
|
|||
'quiet' => false,
|
||||
'defaults' => [],
|
||||
|
||||
'maruku' => {
|
||||
'use_tex' => false,
|
||||
'use_divs' => false,
|
||||
'png_engine' => 'blahtex',
|
||||
'png_dir' => 'images/latex',
|
||||
'png_url' => '/images/latex',
|
||||
'fenced_code_blocks' => true
|
||||
},
|
||||
|
||||
'rdiscount' => {
|
||||
'extensions' => []
|
||||
},
|
||||
|
@ -257,9 +248,11 @@ module Jekyll
|
|||
end
|
||||
|
||||
if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
|
||||
Jekyll::Deprecator.deprecation_message "You're using the 'maruku' " +
|
||||
"Markdown processor. Maruku support has been deprecated and will " +
|
||||
"be removed in 3.0.0. We recommend you switch to Kramdown."
|
||||
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " +
|
||||
"Markdown processor, which has been removed as of 3.0.0. " +
|
||||
"We recommend you switch to Kramdown. To do this, replace " +
|
||||
"`markdown: maruku` with `markdown: kramdown` in your " +
|
||||
"`_config.yml` file."
|
||||
end
|
||||
|
||||
config
|
||||
|
|
|
@ -13,7 +13,6 @@ module Jekyll
|
|||
when 'redcarpet' then RedcarpetParser.new(@config)
|
||||
when 'kramdown' then KramdownParser.new(@config)
|
||||
when 'rdiscount' then RDiscountParser.new(@config)
|
||||
when 'maruku' then MarukuParser.new(@config)
|
||||
else
|
||||
# So they can't try some tricky bullshit or go down the ancestor chain, I hope.
|
||||
if allowed_custom_class?(@config['markdown'])
|
||||
|
@ -29,7 +28,6 @@ module Jekyll
|
|||
|
||||
def valid_processors
|
||||
%w[
|
||||
maruku
|
||||
rdiscount
|
||||
kramdown
|
||||
redcarpet
|
||||
|
@ -39,7 +37,6 @@ module Jekyll
|
|||
def third_party_processors
|
||||
self.class.constants - %w[
|
||||
KramdownParser
|
||||
MarukuParser
|
||||
RDiscountParser
|
||||
RedcarpetParser
|
||||
PRIORITIES
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
module Jekyll
|
||||
module Converters
|
||||
class Markdown
|
||||
class MarukuParser
|
||||
def initialize(config)
|
||||
require 'maruku'
|
||||
@config = config
|
||||
@errors = []
|
||||
load_divs_library if @config['maruku']['use_divs']
|
||||
load_blahtext_library if @config['maruku']['use_tex']
|
||||
|
||||
# allow fenced code blocks (new in Maruku 0.7.0)
|
||||
MaRuKu::Globals[:fenced_code_blocks] = !!@config['maruku']['fenced_code_blocks']
|
||||
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install maruku'
|
||||
raise Errors::FatalException.new("Missing dependency: maruku")
|
||||
end
|
||||
|
||||
def load_divs_library
|
||||
require 'maruku/ext/div'
|
||||
STDERR.puts 'Maruku: Using extended syntax for div elements.'
|
||||
end
|
||||
|
||||
def load_blahtext_library
|
||||
require 'maruku/ext/math'
|
||||
STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
|
||||
|
||||
# Switch off MathML output
|
||||
MaRuKu::Globals[:html_math_output_mathml] = false
|
||||
MaRuKu::Globals[:html_math_engine] = 'none'
|
||||
|
||||
# Turn on math to PNG support with blahtex
|
||||
# Resulting PNGs stored in `images/latex`
|
||||
MaRuKu::Globals[:html_math_output_png] = true
|
||||
MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
|
||||
MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
|
||||
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
|
||||
end
|
||||
|
||||
def print_errors_and_fail
|
||||
print @errors.join
|
||||
raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
converted = Maruku.new(content, :error_stream => @errors).to_html.strip
|
||||
print_errors_and_fail unless @errors.empty?
|
||||
converted
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -514,14 +514,6 @@ quiet: false
|
|||
defaults: []
|
||||
|
||||
# Markdown Processors
|
||||
maruku:
|
||||
use_tex: false
|
||||
use_divs: false
|
||||
png_engine: blahtex
|
||||
png_dir: images/latex
|
||||
png_url: /images/latex
|
||||
fenced_code_blocks: true
|
||||
|
||||
rdiscount:
|
||||
extensions: []
|
||||
|
||||
|
|
|
@ -114,21 +114,6 @@ The various markup engines that Jekyll uses may have some issues. This
|
|||
page will document them to help others who may run into the same
|
||||
problems.
|
||||
|
||||
### Maruku
|
||||
|
||||
If your link has characters that need to be escaped, you need to use
|
||||
this syntax:
|
||||
|
||||
{% highlight text %}
|
||||

|
||||
{% endhighlight %}
|
||||
|
||||
If you have an empty tag, i.e. `<script src="js.js"></script>`, Maruku
|
||||
transforms this into `<script src="js.js" />`. This causes problems in
|
||||
Firefox and possibly other browsers and is [discouraged in
|
||||
XHTML.](http://www.w3.org/TR/xhtml1/#C_3) An easy fix is to put a space
|
||||
between the opening and closing tags.
|
||||
|
||||
### Liquid
|
||||
|
||||
The latest version, version 2.0, seems to break the use of `{{ "{{" }}` in
|
||||
|
|
|
@ -30,7 +30,7 @@ class TestTags < JekyllUnitTest
|
|||
title: This is a test
|
||||
---
|
||||
|
||||
This document results in a markdown error with maruku
|
||||
This document has some highlighted code in it.
|
||||
|
||||
{% highlight text %}
|
||||
#{code}
|
||||
|
@ -338,7 +338,7 @@ EOS
|
|||
setup do
|
||||
@content = <<CONTENT
|
||||
---
|
||||
title: Maruku vs. RDiscount
|
||||
title: Kramdown vs. RDiscount vs. Redcarpet
|
||||
---
|
||||
|
||||
_FIGHT!_
|
||||
|
@ -351,17 +351,6 @@ puts "3..2..1.."
|
|||
CONTENT
|
||||
end
|
||||
|
||||
context "using Maruku" do
|
||||
setup do
|
||||
create_post(@content)
|
||||
end
|
||||
|
||||
should "parse correctly" do
|
||||
assert_match %r{<em>FIGHT!</em>}, @result
|
||||
assert_match %r{<em>FINISH HIM</em>}, @result
|
||||
end
|
||||
end
|
||||
|
||||
context "using RDiscount" do
|
||||
setup do
|
||||
create_post(@content, 'markdown' => 'rdiscount')
|
||||
|
@ -604,25 +593,6 @@ CONTENT
|
|||
end
|
||||
end
|
||||
|
||||
context "with fenced code blocks with backticks" do
|
||||
|
||||
setup do
|
||||
content = <<CONTENT
|
||||
```ruby
|
||||
puts "Hello world"
|
||||
```
|
||||
CONTENT
|
||||
create_post(content, {
|
||||
'markdown' => 'maruku',
|
||||
'maruku' => {'fenced_code_blocks' => true}}
|
||||
)
|
||||
end
|
||||
|
||||
should "render fenced code blocks" do
|
||||
assert_match %r{<pre class=\"ruby\"><code class=\"ruby\">puts "Hello world"</code></pre>}, @result.strip
|
||||
end
|
||||
end
|
||||
|
||||
context "include missing file" do
|
||||
setup do
|
||||
@content = <<CONTENT
|
||||
|
|
Loading…
Reference in New Issue