Maruku is now the only processor dependency installed by default. Closes #57.
Other processors will be lazy-loaded when necessary (and prompt the user to install them when necessary).
This commit is contained in:
parent
6932a40d17
commit
de8bd48154
|
@ -2,6 +2,9 @@
|
||||||
* Major Enhancements
|
* Major Enhancements
|
||||||
* Proper plugin system (#19, #100)
|
* Proper plugin system (#19, #100)
|
||||||
* Add safe mode so unsafe converters/generators can be added
|
* Add safe mode so unsafe converters/generators can be added
|
||||||
|
* Maruku is now the only processor dependency installed by default.
|
||||||
|
Other processors will be lazy-loaded when necessary (and prompt the
|
||||||
|
user to install them when necessary) (#57)
|
||||||
* Minor Enhancements
|
* Minor Enhancements
|
||||||
* Inclusion/exclusion of future dated posts (#59)
|
* Inclusion/exclusion of future dated posts (#59)
|
||||||
* Generation for a specific time (#59)
|
* Generation for a specific time (#59)
|
||||||
|
|
|
@ -142,7 +142,11 @@ if options['auto']
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts "Building site: #{source} -> #{destination}"
|
puts "Building site: #{source} -> #{destination}"
|
||||||
site.process
|
begin
|
||||||
|
site.process
|
||||||
|
rescue Jekyll::FatalException
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
puts "Successfully generated site: #{source} -> #{destination}"
|
puts "Successfully generated site: #{source} -> #{destination}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,16 @@ Gem::Specification.new do |s|
|
||||||
s.rdoc_options = ["--charset=UTF-8"]
|
s.rdoc_options = ["--charset=UTF-8"]
|
||||||
s.extra_rdoc_files = %w[README.textile LICENSE]
|
s.extra_rdoc_files = %w[README.textile LICENSE]
|
||||||
|
|
||||||
s.add_runtime_dependency('RedCloth', [">= 4.2.1"])
|
|
||||||
s.add_runtime_dependency('liquid', [">= 1.9.0"])
|
s.add_runtime_dependency('liquid', [">= 1.9.0"])
|
||||||
s.add_runtime_dependency('classifier', [">= 1.3.1"])
|
s.add_runtime_dependency('classifier', [">= 1.3.1"])
|
||||||
s.add_runtime_dependency('maruku', [">= 0.5.9"])
|
|
||||||
s.add_runtime_dependency('directory_watcher', [">= 1.1.1"])
|
s.add_runtime_dependency('directory_watcher', [">= 1.1.1"])
|
||||||
|
s.add_runtime_dependency('maruku', [">= 0.5.9"])
|
||||||
|
|
||||||
s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
|
s.add_development_dependency('redgreen', [">= 4.2.1"])
|
||||||
|
s.add_development_dependency('shoulda', [">= 4.2.1"])
|
||||||
|
s.add_development_dependency('rr', [">= 4.2.1"])
|
||||||
|
s.add_development_dependency('cucumber', [">= 4.2.1"])
|
||||||
|
s.add_development_dependency('RedCloth', [">= 4.2.1"])
|
||||||
|
|
||||||
# = MANIFEST =
|
# = MANIFEST =
|
||||||
s.files = %w[
|
s.files = %w[
|
||||||
|
|
|
@ -22,7 +22,7 @@ require 'yaml'
|
||||||
|
|
||||||
# 3rd party
|
# 3rd party
|
||||||
require 'liquid'
|
require 'liquid'
|
||||||
require 'redcloth'
|
require 'maruku'
|
||||||
|
|
||||||
# internal requires
|
# internal requires
|
||||||
require 'jekyll/core_ext'
|
require 'jekyll/core_ext'
|
||||||
|
@ -34,6 +34,7 @@ require 'jekyll/post'
|
||||||
require 'jekyll/filters'
|
require 'jekyll/filters'
|
||||||
require 'jekyll/albino'
|
require 'jekyll/albino'
|
||||||
require 'jekyll/static_file'
|
require 'jekyll/static_file'
|
||||||
|
require 'jekyll/errors'
|
||||||
|
|
||||||
# extensions
|
# extensions
|
||||||
require 'jekyll/plugin'
|
require 'jekyll/plugin'
|
||||||
|
|
|
@ -25,6 +25,13 @@ module Jekyll
|
||||||
@pygments_suffix
|
@pygments_suffix
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Initialize the converter.
|
||||||
|
#
|
||||||
|
# Returns an initialized Converter.
|
||||||
|
def initialize(config = {})
|
||||||
|
@config = config
|
||||||
|
end
|
||||||
|
|
||||||
# Get the pygments prefix.
|
# Get the pygments prefix.
|
||||||
#
|
#
|
||||||
# Returns the String prefix.
|
# Returns the String prefix.
|
||||||
|
|
|
@ -6,36 +6,30 @@ module Jekyll
|
||||||
pygments_prefix '\n'
|
pygments_prefix '\n'
|
||||||
pygments_suffix '\n'
|
pygments_suffix '\n'
|
||||||
|
|
||||||
def initialize(config = {})
|
def setup
|
||||||
|
return if @setup
|
||||||
# Set the Markdown interpreter (and Maruku self.config, if necessary)
|
# Set the Markdown interpreter (and Maruku self.config, if necessary)
|
||||||
case config['markdown']
|
case @config['markdown']
|
||||||
when 'rdiscount'
|
when 'rdiscount'
|
||||||
begin
|
begin
|
||||||
require 'rdiscount'
|
require 'rdiscount'
|
||||||
|
|
||||||
def convert(content)
|
|
||||||
RDiscount.new(content).to_html
|
|
||||||
end
|
|
||||||
|
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts 'You must have the rdiscount gem installed first'
|
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||||
|
STDERR.puts ' $ [sudo] gem install rdiscount'
|
||||||
|
raise FatalException.new("Missing dependency: rdiscount")
|
||||||
end
|
end
|
||||||
when 'maruku'
|
when 'maruku'
|
||||||
begin
|
begin
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
|
|
||||||
def convert(content)
|
if @config['maruku']['use_divs']
|
||||||
Maruku.new(content).to_html
|
|
||||||
end
|
|
||||||
|
|
||||||
if config['maruku']['use_divs']
|
|
||||||
require 'maruku/ext/div'
|
require 'maruku/ext/div'
|
||||||
puts 'Maruku: Using extended syntax for div elements.'
|
STDERR.puts 'Maruku: Using extended syntax for div elements.'
|
||||||
end
|
end
|
||||||
|
|
||||||
if config['maruku']['use_tex']
|
if @config['maruku']['use_tex']
|
||||||
require 'maruku/ext/math'
|
require 'maruku/ext/math'
|
||||||
puts "Maruku: Using LaTeX extension. Images in `#{config['maruku']['png_dir']}`."
|
STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
|
||||||
|
|
||||||
# Switch off MathML output
|
# Switch off MathML output
|
||||||
MaRuKu::Globals[:html_math_output_mathml] = false
|
MaRuKu::Globals[:html_math_output_mathml] = false
|
||||||
|
@ -44,16 +38,21 @@ module Jekyll
|
||||||
# Turn on math to PNG support with blahtex
|
# Turn on math to PNG support with blahtex
|
||||||
# Resulting PNGs stored in `images/latex`
|
# Resulting PNGs stored in `images/latex`
|
||||||
MaRuKu::Globals[:html_math_output_png] = true
|
MaRuKu::Globals[:html_math_output_png] = true
|
||||||
MaRuKu::Globals[:html_png_engine] = config['maruku']['png_engine']
|
MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
|
||||||
MaRuKu::Globals[:html_png_dir] = config['maruku']['png_dir']
|
MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
|
||||||
MaRuKu::Globals[:html_png_url] = config['maruku']['png_url']
|
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts "The maruku gem is required for markdown support!"
|
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||||
|
STDERR.puts ' $ [sudo] gem install maruku'
|
||||||
|
raise FatalException.new("Missing dependency: maruku")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise "Invalid Markdown processor: '#{config['markdown']}' -- did you mean 'maruku' or 'rdiscount'?"
|
STDERR.puts "Invalid Markdown processor: #{@config['markdown']}"
|
||||||
|
STDERR.puts " Valid options are [ maruku | rdiscount ]"
|
||||||
|
raise FatalException.new("Invalid Markdown process: #{@config['markdown']}")
|
||||||
end
|
end
|
||||||
|
@setup = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def matches(ext)
|
def matches(ext)
|
||||||
|
@ -64,6 +63,15 @@ module Jekyll
|
||||||
".html"
|
".html"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def convert(content)
|
||||||
|
setup
|
||||||
|
case @config['markdown']
|
||||||
|
when 'rdiscount'
|
||||||
|
RDiscount.new(content).to_html
|
||||||
|
when 'maruku'
|
||||||
|
Maruku.new(content).to_html
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,16 @@ module Jekyll
|
||||||
pygments_prefix '<notextile>'
|
pygments_prefix '<notextile>'
|
||||||
pygments_suffix '</notextile>'
|
pygments_suffix '</notextile>'
|
||||||
|
|
||||||
|
def setup
|
||||||
|
return if @setup
|
||||||
|
require 'redcloth'
|
||||||
|
@setup = true
|
||||||
|
rescue LoadError
|
||||||
|
STDERR.puts 'You are missing a library required for Textile. Please run:'
|
||||||
|
STDERR.puts ' $ [sudo] gem install RedCloth'
|
||||||
|
raise FatalException.new("Missing dependency: RedCloth")
|
||||||
|
end
|
||||||
|
|
||||||
def matches(ext)
|
def matches(ext)
|
||||||
ext =~ /textile/i
|
ext =~ /textile/i
|
||||||
end
|
end
|
||||||
|
@ -15,9 +25,9 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def convert(content)
|
def convert(content)
|
||||||
|
setup
|
||||||
RedCloth.new(content).to_html
|
RedCloth.new(content).to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
module Jekyll
|
||||||
|
|
||||||
|
class FatalException < StandardError
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -3,6 +3,9 @@ gem 'RedCloth', '>= 4.2.1'
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
|
require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
|
||||||
|
|
||||||
|
require 'RedCloth'
|
||||||
|
require 'rdiscount'
|
||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'redgreen'
|
require 'redgreen'
|
||||||
require 'shoulda'
|
require 'shoulda'
|
||||||
|
@ -10,6 +13,9 @@ require 'rr'
|
||||||
|
|
||||||
include Jekyll
|
include Jekyll
|
||||||
|
|
||||||
|
# Send STDERR into the void to suppress program output messages
|
||||||
|
STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
|
||||||
|
|
||||||
class Test::Unit::TestCase
|
class Test::Unit::TestCase
|
||||||
include RR::Adapters::TestUnit
|
include RR::Adapters::TestUnit
|
||||||
|
|
||||||
|
|
|
@ -133,18 +133,20 @@ class TestSite < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an invalid markdown processor in the configuration' do
|
context 'with an invalid markdown processor in the configuration' do
|
||||||
|
should 'not throw an error at initialization time' do
|
||||||
should 'give a meaningful error message' do
|
|
||||||
bad_processor = 'not a processor name'
|
bad_processor = 'not a processor name'
|
||||||
begin
|
assert_nothing_raised do
|
||||||
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
||||||
flunk 'Invalid markdown processors should cause a failure on site creation'
|
|
||||||
rescue RuntimeError => e
|
|
||||||
assert e.to_s =~ /invalid|bad/i
|
|
||||||
assert e.to_s =~ %r{#{bad_processor}}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should 'throw FatalException at process time' do
|
||||||
|
bad_processor = 'not a processor name'
|
||||||
|
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
||||||
|
assert_raise Jekyll::FatalException do
|
||||||
|
s.process
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue