1
0
mirror of https://github.com/gryf/jekyll-rst.git synced 2025-12-19 12:28:20 +01:00
Files
jekyll-rst/converter.rb
Nikola Igniatovic e74e57e12e Changed converted to use rst2html5
Added rst2html5.py

(cherry picked from commit c12a13c9089eccb6c8ae3f72eae1e2b55bf765df)
2019-05-03 13:39:07 -06:00

35 lines
780 B
Ruby

require 'rbst'
require 'nokogiri'
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 => "/usr/local/bin/rst2html5"}
RbST.executables = {:html => "#{File.expand_path(File.dirname(__FILE__))}/rst2html5.py"}
rst2htmlcontent = RbST.new(content).to_html(:initial_header_level => 1)
document = Nokogiri::HTML(rst2htmlcontent)
content = document.css('body').inner_html
end
end
module Filters
def restify(input)
site = @context.registers[:site]
converter = site.getConverterImpl(Jekyll::RestConverter)
converter.convert(input)
end
end
end