You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
602 B
Ruby
30 lines
602 B
Ruby
require 'rbst'
|
|
|
|
module Jekyll
|
|
class RestConverter < Converter
|
|
safe true
|
|
|
|
priority :low
|
|
|
|
def matches(ext)
|
|
ext =~ /rst/i
|
|
end
|
|
|
|
def output_ext(ext)
|
|
".html"
|
|
end
|
|
|
|
def convert(content)
|
|
RbST.executables = {:html => "#{File.expand_path(File.dirname(__FILE__))}/rst2html.py"}
|
|
RbST.new(content).to_html(:part => :fragment, :initial_header_level => 2)
|
|
end
|
|
end
|
|
|
|
module Filters
|
|
def restify(input)
|
|
site = @context.registers[:site]
|
|
converter = site.getConverterImpl(Jekyll::RestConverter)
|
|
converter.convert(input)
|
|
end
|
|
end
|
|
end |