class RD::RD2HTML5Visitor
Constants
- SYSTEM_NAME
- SYSTEM_VERSION
- VERSION
Public Class Methods
Public Instance Methods
Source
# File lib/rd/rd2html5-lib.rb, line 56 def apply_to_DescListItem(element, term, description) anchor = get_anchor(element.term) label = hyphen_escape(element.label) term = term.join("") if description.empty? %Q[<dt id="#{anchor}">#{term}</dt><!-- RDLabel: "#{label}" -->] else %Q[<dt id="#{anchor}">#{term}</dt><!-- RDLabel: "#{label}" -->\n] + %Q[<dd>\n#{description.join("\n").chomp}\n</dd>] end end
Source
# File lib/rd/rd2html5-lib.rb, line 22 def apply_to_DocumentElement(element, content) ret = "" ret << doctype_decl + "\n" ret << html_open_tag + "\n" ret << html_head + "\n" ret << html_body(content) + "\n" ret << "</html>\n" ret end
Source
# File lib/rd/rd2html5-lib.rb, line 95 def apply_to_Footnote(element, content) num = get_footnote_num(element) raise ArgumentError, "[BUG?] #{element} is not registered." unless num add_foottext(num, content) anchor = a_name("footmark", num) href = a_name("foottext", num) %Q|<a id="#{anchor}" href="##{href}"><sup><small>*#{num}</small></sup></a>| end
Source
# File lib/rd/rd2html5-lib.rb, line 105 def apply_to_Foottext(element, content) num = get_footnote_num(element) raise ArgumentError, "[BUG] #{element} isn't registered." unless num anchor = a_name("foottext", num) href = a_name("footmark", num) content = content.join("") %|<a id="#{anchor}" href="##{href}"><sup><small>*#{num}</small></sup></a>| + %|<small>#{content}</small><br>| end
Source
# File lib/rd/rd2html5-lib.rb, line 48 def apply_to_Headline(element, title) anchor = get_anchor(element) label = hyphen_escape(element.label) title = title.join("") %Q[<h#{element.level} id="#{anchor}">#{title}</h#{element.level}>] + %Q[<!-- RDLabel: "#{label}" -->] end
Source
# File lib/rd/rd2html5-lib.rb, line 80 def apply_to_Index(element, content) tmp = [] element.each do |i| tmp.push(i) if i.is_a?(String) end key = meta_char_escape(tmp.join("")) if @index.has_key?(key) %Q[<!-- Index, but conflict -->#{content.join("")}<!-- Index end -->] else num = @index[key] = @index.size anchor = a_name("index", num) %Q[<span id="#{anchor}">#{content.join("")}</span>] end end
Source
# File lib/rd/rd2html5-lib.rb, line 68 def apply_to_MethodListItem(element, term, description) term = parse_method(term) anchor = get_anchor(element.term) label = hyphen_escape(element.label) if description.empty? %Q[<dt id="#{anchor}"><code>#{term}</code></dt><!-- RDLabel: "#{label}" -->] else %Q[<dt id="#{anchor}"><code>#{term}</code></dt><!-- RDLabel: "#{label}" -->\n] + %Q[<dd>\n#{description.join("\n")}</dd>] end end
Private Instance Methods
Source
# File lib/rd/rd2html5-lib.rb, line 32 def doctype_decl "<!DOCTYPE html>" end
Source
# File lib/rd/rd2html5-lib.rb, line 43 def html_content_type %Q[<meta charset="#{@charset}">] if @charset end
Source
# File lib/rd/rd2html5-lib.rb, line 37 def html_open_tag lang_attr = %[ lang="#{@lang}"] if @lang %|<html#{lang_attr}>| end