mirror of
https://github.com/gryf/jekyll-rst.git
synced 2026-03-24 11:23:36 +01:00
Changed converted to use rst2html5
Added rst2html5.py (cherry picked from commit c12a13c9089eccb6c8ae3f72eae1e2b55bf765df)
This commit is contained in:
committed by
Roman Dobosz
parent
830d4a498d
commit
e74e57e12e
12
converter.rb
12
converter.rb
@@ -1,4 +1,5 @@
|
||||
require 'rbst'
|
||||
require 'nokogiri'
|
||||
|
||||
module Jekyll
|
||||
class RestConverter < Converter
|
||||
@@ -8,15 +9,18 @@ module Jekyll
|
||||
|
||||
def matches(ext)
|
||||
ext =~ /rst/i
|
||||
end
|
||||
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)
|
||||
# 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
|
||||
|
||||
@@ -27,4 +31,4 @@ module Jekyll
|
||||
converter.convert(input)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user