Class: PBSimply::Processor::PbsKramdown
- Defined in:
- lib/pbsimply/docengine/misc.rb
Overview
Kramdown 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) ⇒ PbsKramdown
constructor
A new instance of PbsKramdown.
- #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, find_docroot, #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) ⇒ PbsKramdown
Returns a new instance of PbsKramdown.
36 37 38 39 |
# File 'lib/pbsimply/docengine/misc.rb', line 36 def initialize(config) require 'kramdown' super end |
Instance Method Details
#print_fileproc_msg(filename) ⇒ Object
41 42 43 |
# File 'lib/pbsimply/docengine/misc.rb', line 41 def print_fileproc_msg(filename) STDERR.puts "#{filename} generate with Kramdown" end |
#process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pbsimply/docengine/misc.rb', line 45 def process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) # Set feature options features = @config["kramdown_features"] || {} # Getting HTML string. markdown = Kramdown::Document.new(File.read(procdoc), **features) article_body = markdown.to_html # Process with eRuby temaplte. erb_template = ERB.new(File.read(@config["template"]), trim_mode: '%<>') doc = erb_template.result(binding) doc end |