=begin
= rd2html-lib.rb
=end
require "cgi"
require "rd/rdvisitor"
require "rd/version"
module RD
class RD2HTMLVisitor < RDVisitor
include MethodParse
SYSTEM_NAME = "RDtool -- RD2HTMLVisitor"
SYSTEM_VERSION = "$Version: "+ RD::VERSION+"$"
VERSION = Version.new_from_version_string(SYSTEM_NAME, SYSTEM_VERSION)
def self.version
VERSION
end
# must-have constants
OUTPUT_SUFFIX = "html"
INCLUDE_SUFFIX = ["html"]
METACHAR = { "<" => "<", ">" => ">", "&" => "&" }
attr_accessor :css
attr_accessor :charset
alias charcode charset
alias charcode= charset=
attr_accessor :lang
attr_accessor :title
attr_reader :html_link_rel
attr_reader :html_link_rev
attr_accessor :use_old_anchor
# output external Label file.
attr_accessor :output_rbl
attr_reader :footnotes
attr_reader :foottexts
def initialize
@css = nil
@charset = nil
@lang = nil
@title = nil
@html_link_rel = {}
@html_link_rev = {}
@footnotes = []
@index = {}
# @use_old_anchor = nil
@use_old_anchor = true # MUST -> nil
@output_rbl = nil
super
end
def visit(tree)
prepare_labels(tree, "label-")
prepare_footnotes(tree)
tmp = super(tree)
make_rbl_file(@filename) if @output_rbl and @filename
tmp
end
def apply_to_DocumentElement(element, content)
ret = ""
ret << xml_decl + "\n"
ret << doctype_decl + "\n"
ret << html_open_tag + "\n"
ret << html_head + "\n"
ret << html_body(content) + "\n"
ret << "