Parent

DocBookPrinter

Attributes

output_dir[RW]

Public Class Methods

new() click to toggle source
# File lib/doc_book_printer.rb, line 9
def initialize
  super()
  @output_dir = "docbook"
  @xml_examples = Hash.new
  @xml_schemas = Hash.new
  @section = 0

  @html_tag_mapping = {
    "tt" => nil,
    "em" => "emphasis",
    "b" => "emphasis",
  }
end

Public Instance Methods

do_finish() click to toggle source
# File lib/doc_book_printer.rb, line 42
def do_finish
  @xml << "</appendix>\n"
  puts "Written #{@index.path}"
  @index.close
end
do_prepare() click to toggle source
# File lib/doc_book_printer.rb, line 23
def do_prepare
  unless File.exists? @output_dir
    Dir.mkdir @output_dir
  end

  @index = File.new @output_dir + "/rest_api_appendix.xml", "w"
  @xml = Builder::XmlMarkup.new :target => @index, :indent => 2
  @xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
  @xml.declare! :DOCTYPE, :appendix, :PUBLIC, "-//Novell//DTD NovDoc XML V1.0//EN", "novdocx.dtd" do |x|
    x.declare! :ENTITY, :%, :'NOVDOC.DEACTIVATE.IDREF', "IGNORE"
    x.declare! :ENTITY, :%, :entities, :SYSTEM, "entity-decl.ent"
    x << "  %entities;\n"
  end

  @xml.comment! "This file was generated by restility at #{Time.now}"

  @xml << "<appendix xml:base=\"rest_api_appendix.xml\" id=\"app.rest_api_doc\">\n"
end
replace_html_tags(text) click to toggle source
# File lib/doc_book_printer.rb, line 91
def replace_html_tags text
  @html_tag_mapping.each do |html, docbook|
    if docbook.nil?
      text.gsub! "<#{html}>", ""
    else
      text.gsub! "<#{html}>", "<#{docbook}>"
      text.gsub! "</#{html}>", "</#{docbook}>"
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.