1
require 'rdoc/markup/formatter'
2
require 'rdoc/markup/fragments'
3
require 'rdoc/markup/inline'
6
require 'rdoc/markup/formatter'
9
# Convert SimpleMarkup to basic TexInfo format
11
# TODO: WTF is AttributeManager for?
13
class RDoc::Markup::ToTexInfo < RDoc::Markup::Formatter
23
def accept_paragraph(attributes, text)
27
def accept_verbatim(attributes, text)
28
@text << "@verb{|#{format(text)}|}"
31
def accept_heading(attributes, text)
32
heading = ['@majorheading', '@chapheading'][text.head_level - 1] || '@heading'
33
@text << "#{heading} #{format(text)}"
36
def accept_list_start(attributes, text)
37
@text << '@itemize @bullet'
40
def accept_list_end(attributes, text)
41
@text << '@end itemize'
44
def accept_list_item(attributes, text)
45
@text << "@item\n#{format(text)}"
48
def accept_blank_line(attributes, text)
52
def accept_rule(attributes, text)
61
# gsub(/,/, "@,"). # technically only required in cross-refs
62
gsub(/\+([\w]+)\+/, "@code{\\1}").
63
gsub(/\<tt\>([^<]+)\<\/tt\>/, "@code{\\1}").
64
gsub(/\*([\w]+)\*/, "@strong{\\1}").
65
gsub(/\<b\>([^<]+)\<\/b\>/, "@strong{\\1}").
66
gsub(/_([\w]+)_/, "@emph{\\1}").
67
gsub(/\<em\>([^<]+)\<\/em\>/, "@emph{\\1}")