Convert SimpleMarkup to basic TexInfo format
TODO: WTF is AttributeManager for?
# File rdoc/markup/to_texinfo.rb, line 48 def accept_blank_line(attributes, text) @text << "\n" end
# File rdoc/markup/to_texinfo.rb, line 31 def accept_heading(attributes, text) heading = ['@majorheading', '@chapheading'][text.head_level - 1] || '@heading' @text << "#{heading} #{format(text)}" end
# File rdoc/markup/to_texinfo.rb, line 40 def accept_list_end(attributes, text) @text << '@end itemize' end
# File rdoc/markup/to_texinfo.rb, line 44 def accept_list_item(attributes, text) @text << "@item\n#{format(text)}" end
# File rdoc/markup/to_texinfo.rb, line 36 def accept_list_start(attributes, text) @text << '@itemize @bullet' end
# File rdoc/markup/to_texinfo.rb, line 23 def accept_paragraph(attributes, text) @text << format(text) end
# File rdoc/markup/to_texinfo.rb, line 52 def accept_rule(attributes, text) @text << '-----' end
# File rdoc/markup/to_texinfo.rb, line 27 def accept_verbatim(attributes, text) @text << "@verb{|#{format(text)}|}" end
# File rdoc/markup/to_texinfo.rb, line 19 def end_accepting @text.join("\n") end
# File rdoc/markup/to_texinfo.rb, line 56 def format(text) text.txt. gsub(/@/, "@@"). gsub(/\{/, "@{"). gsub(/\}/, "@}"). # gsub(/,/, "@,"). # technically only required in cross-refs gsub(/\+([\w]+)\+/, "@code{\\1}"). gsub(/\<tt\>([^<]+)\<\/tt\>/, "@code{\\1}"). gsub(/\*([\w]+)\*/, "@strong{\\1}"). gsub(/\<b\>([^<]+)\<\/b\>/, "@strong{\\1}"). gsub(/_([\w]+)_/, "@emph{\\1}"). gsub(/\<em\>([^<]+)\<\/em\>/, "@emph{\\1}") end