Class: PBSimply::Processor::PbsRBase

Inherits:
PBSimply
  • Object
show all
Defined in:
lib/pbsimply/docengine/rdoc.rb

Overview

RDoc family Base

Direct Known Subclasses

PbsRDoc, PbsRMakrdown

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

#indexes

Instance Method Summary collapse

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

#read_frontmatter

Methods included from PBSimply::Plugger

#post_plugins, #pre_plugins

Methods included from PBSimply::Prayer

#autobless, #bless, #bless_cmd, #bless_ruby

Constructor Details

#initialize(config) ⇒ PbsRBase

Returns a new instance of PbsRBase.



7
8
9
10
11
12
13
14
15
# File 'lib/pbsimply/docengine/rdoc.rb', line 7

def initialize(config)
  require 'rdoc'
  require 'rdoc/markup/to_html'

  @rdoc_options = RDoc::Options.new
  @rdoc_markup = RDoc::Markup.new

  super
end

Instance Method Details

#process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pbsimply/docengine/rdoc.rb', line 17

def process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc)
  # Getting HTML string.
  rdoc = RDoc::Markup::ToHtml.new(@rdoc_options, @rdoc_markup)
  article_body = rdoc.convert(get_markup_document(procdoc))

  # Process with eRuby temaplte.
  erb_template = ERB.new(File.read(@config["template"]), trim_mode: '%<>')
  doc = erb_template.result(binding)

  doc
end