Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
149 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Jekyll | ||
|
||
class IdentityConverter | ||
|
||
def initialize(config = {}) | ||
|
||
end | ||
|
||
def content_type | ||
nil | ||
end | ||
|
||
def matches(ext) | ||
true | ||
end | ||
|
||
def output_ext(ext) | ||
ext | ||
end | ||
|
||
def convert(content) | ||
content | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
module Jekyll | ||
|
||
class MarkdownConverter | ||
|
||
def initialize(config = {}) | ||
# Set the Markdown interpreter (and Maruku self.config, if necessary) | ||
case config['markdown'] | ||
when 'rdiscount' | ||
begin | ||
require 'rdiscount' | ||
|
||
def convert(content) | ||
RDiscount.new(content).to_html | ||
end | ||
|
||
rescue LoadError | ||
puts 'You must have the rdiscount gem installed first' | ||
end | ||
when 'maruku' | ||
begin | ||
require 'maruku' | ||
|
||
def convert(content) | ||
Maruku.new(content).to_html | ||
end | ||
|
||
if config['maruku']['use_divs'] | ||
require 'maruku/ext/div' | ||
puts 'Maruku: Using extended syntax for div elements.' | ||
end | ||
|
||
if config['maruku']['use_tex'] | ||
require 'maruku/ext/math' | ||
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 | ||
rescue LoadError | ||
puts "The maruku gem is required for markdown support!" | ||
end | ||
else | ||
raise "Invalid Markdown processor: '#{config['markdown']}' -- did you mean 'maruku' or 'rdiscount'?" | ||
end | ||
end | ||
|
||
def content_type | ||
"markdown" | ||
end | ||
|
||
def matches(ext) | ||
ext =~ /(markdown|mkdn?|md)/i | ||
end | ||
|
||
def output_ext(ext) | ||
".html" | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Jekyll | ||
|
||
class TextileConverter | ||
|
||
def initialize(config = {}) | ||
|
||
end | ||
|
||
def content_type | ||
"textile" | ||
end | ||
|
||
def matches(ext) | ||
ext =~ /textile/i | ||
end | ||
|
||
def output_ext(ext) | ||
".html" | ||
end | ||
|
||
def convert(content) | ||
RedCloth.new(content).to_html | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters