=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: 0.6.11$" #"
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(:css, true)
attr(:charset, true)
alias charcode charset
alias charcode= charset=
attr(:lang, true)
attr(:title, true)
attr(:html_link_rel, nil)
attr(:html_link_rev, nil)
attr(:use_old_anchor, true)
# output external Label file.
attr(:output_rbl, true)
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 << "