# rd2html.rb for Hiki/RD+
#
# Copyright (C) 2003,2004 Masao Mutoh #{match.to_s.escapeHTML}"
if @conf.plugin_debug
err += "
Back trace
"
$!.backtrace.each do |v|
err += v + "\n"
break if v =~ /special_parse/
end
err += ""
end
ret = err
end
ret
end
#Special Parse
if @regex
content = content.gsub(@regex) do |match|
s = StringScanner.new(match)
module_name = s.scan(@regex_modulenames)
separator = ""
lastword = ""
name = ""
option = nil
divary = div_class_method(s)
if divary
divary.flatten!
lastword = divary.pop
separator = divary.pop
if divary.size == 0
if separator == "::"
if lastword =~ LAST_WORD_RE
# Constants
target = module_name.escape
name = module_name + separator + lastword
option = lastword
else
# Class
module_name += separator + lastword
target = module_name.escape
name = module_name
end
else
# Module method
target = module_name.escape
name = module_name + separator + lastword
option = module_name + (separator + lastword).escape
end
elsif divary.size > 1
module_name += divary.join
target = module_name.escape
name = module_name + separator + lastword
if separator == "."
option = "#{target}.#{lastword.escape}"
else
option = lastword.escape
end
end
#Create result
if @db.exist?(module_name)
@references << module_name
if option
ret = @plugin.hiki_anchor(target + "#" + option, name)
else
ret = @plugin.hiki_anchor(target, name)
end
else
ret = %Q[#{name}?]
end
ret
else
match
end
end
content = content.gsub(@esc_modulenames) do |match|
match.gsub(ESC_WORD_RE, "")
end
end
content
end
def apply_to_DocumentElement(element, content)
html_body(content) + "\n"
end
def a_name_href(anchor, label)
if label.is_a? String
label.gsub!(ESC_WORD_RE, "")
else
label[0].gsub!(ESC_WORD_RE, "")
end
%Q[#{label}]
end
def apply_to_Headline(element, title)
title = special_parse(title.join)
anchor = get_anchor(element)
label = hyphen_escape(element.label)
@toc.push({'level' => element.level, 'index' => anchor, 'title' => title})
depth = element.level
depth += @conf.options['rd.header_depth'] - 1 if @conf.options['rd.header_depth']
%Q[#{content.chomp}
] end end def apply_to_DescListItem(element, term, description) anchor = get_anchor(element.term) label = hyphen_escape(element.label) if description.empty? %Q[" + term + "")}" + term + "")}