Class: PBSimply::Processor::Docutils
- Defined in:
- lib/pbsimply/docengine/docutils.rb
Overview
Docutils processor (rst2html5 command)
Constant Summary
Constants included from ACCS
ACCS::DEFINITIONS, ACCS::INDEX
Constants included from PBSimply::Plugger
PBSimply::Plugger::POST_PROCESSORS
Instance Attribute Summary
Attributes inherited from PBSimply
Instance Method Summary collapse
-
#initialize(config) ⇒ Docutils
constructor
A new instance of Docutils.
-
#print_fileproc_msg(filename) ⇒ Object
Invoke pandoc, parse and format and write out.
- #process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) ⇒ Object
- #setup_config(dir) ⇒ Object
- #target_file_extensions ⇒ Object
Methods inherited from PBSimply
#delete_missing, #delete_turn_draft, #doc, find_docroot, #generate, load_config, #load_index, #main, #proc_dir, #proc_docs, #treat_cmdline
Methods included from ACCS
#accsmode, #process_accs, #single_accs
Methods included from Frontmatter
Methods included from PBSimply::Plugger
Methods included from PBSimply::Prayer
#autobless, #bless, #bless_cmd, #bless_ruby
Constructor Details
#initialize(config) ⇒ Docutils
Returns a new instance of Docutils.
7 8 9 10 |
# File 'lib/pbsimply/docengine/docutils.rb', line 7 def initialize(config) = [] super end |
Instance Method Details
#print_fileproc_msg(filename) ⇒ Object
Invoke pandoc, parse and format and write out.
32 33 34 |
# File 'lib/pbsimply/docengine/docutils.rb', line 32 def print_fileproc_msg(filename) $stderr.puts "#{filename} is going Docutils." end |
#process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pbsimply/docengine/docutils.rb', line 36 def process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) doc = nil # Go Docutils cmdline = ["rst2html5"] cmdline += cmdline += [ procdoc ] IO.popen((cmdline)) do |io| doc = io.read end # Abort if pandoc returns non-zero status if $?.exitstatus != 0 abort "Docutils (rst2html5) returns exit code #{$?.exitstatus}" end doc end |
#setup_config(dir) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pbsimply/docengine/docutils.rb', line 12 def setup_config(dir) super .push("--template=#{@config["template"]}") if @config["template"] if @config["css"] if @config["css"].kind_of?(String) .push("--stylesheet=#{@config["css"]}") elsif @config["css"].kind_of?(Array) .push("--stylesheet=#{@config["css"].join(",")}") else abort "css in Config should be a String or an Array." end end if Array === @config["docutils_options"] .concat! @config["docutils_options"] end end |
#target_file_extensions ⇒ Object
55 56 57 |
# File 'lib/pbsimply/docengine/docutils.rb', line 55 def target_file_extensions [".rst"] end |