Class: PBSimply::Processor::PbsCommonMark
- Defined in:
- lib/pbsimply/docengine/misc.rb
Overview
CommonMark Processor
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) ⇒ PbsCommonMark
constructor
A new instance of PbsCommonMark.
- #print_fileproc_msg(filename) ⇒ Object
- #process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) ⇒ Object
Methods inherited from PBSimply
#delete_missing, #delete_turn_draft, #doc, #generate, load_config, #load_index, #main, #proc_dir, #proc_docs, #setup_config, #target_file_extensions, #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) ⇒ PbsCommonMark
Returns a new instance of PbsCommonMark.
63 64 65 66 |
# File 'lib/pbsimply/docengine/misc.rb', line 63 def initialize(config) require 'commonmarker' super end |
Instance Method Details
#print_fileproc_msg(filename) ⇒ Object
68 69 70 |
# File 'lib/pbsimply/docengine/misc.rb', line 68 def print_fileproc_msg(filename) STDERR.puts "#{filename} generate with CommonMarker (cmark-gfm)" end |
#process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/pbsimply/docengine/misc.rb', line 72 def process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) # Getting HTML string. article_body = CommonMarker.render_doc(File.read(procdoc), :DEFAULT, [:table, :strikethrough]).to_html # Process with eRuby temaplte. erb_template = ERB.new(File.read(@config["template"]), trim_mode: '%<>') doc = erb_template.result(binding) doc end |