class PseudoHiki::PageComposer::PlainComposer

Public Instance Methods

create_main(toc, body, h1) click to toggle source
# File lib/pseudohiki/converter.rb, line 144
def create_main(toc, body, h1)
  contents = [body]
  contents.unshift toc unless toc.empty?
  if title = @options[:toc]
    toc_title = @options.formatter.format(BlockParser.parse("!!" + title))
    contents.unshift toc_title
  end
  contents.unshift h1 unless h1.empty?
  contents.join($/)
end
create_table_of_contents(tree) click to toggle source
# File lib/pseudohiki/converter.rb, line 136
def create_table_of_contents(tree)
  toc_lines = collect_nodes_for_table_of_contents(tree).map do |toc_node|
    ('*' * toc_node.level) + to_plain(toc_node)
  end

  @options.formatter.format(BlockParser.parse(toc_lines))
end