rdoc 6.17.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +193 -0
  3. data/LEGAL.rdoc +6 -0
  4. data/LICENSE.rdoc +4 -0
  5. data/README.md +132 -8
  6. data/RI.md +75 -75
  7. data/doc/markup_reference/markdown.md +659 -0
  8. data/doc/markup_reference/rdoc.rdoc +1169 -0
  9. data/exe/rdoc +2 -2
  10. data/lib/rdoc/code_object/alias.rb +70 -74
  11. data/lib/rdoc/code_object/any_method.rb +308 -293
  12. data/lib/rdoc/code_object/attr.rb +150 -142
  13. data/lib/rdoc/code_object/class_module.rb +802 -715
  14. data/lib/rdoc/code_object/constant.rb +181 -144
  15. data/lib/rdoc/code_object/context/section.rb +140 -130
  16. data/lib/rdoc/code_object/context.rb +925 -941
  17. data/lib/rdoc/code_object/extend.rb +7 -5
  18. data/lib/rdoc/code_object/include.rb +7 -5
  19. data/lib/rdoc/code_object/method_attr.rb +328 -315
  20. data/lib/rdoc/code_object/mixin.rb +97 -92
  21. data/lib/rdoc/code_object/normal_class.rb +77 -78
  22. data/lib/rdoc/code_object/normal_module.rb +61 -59
  23. data/lib/rdoc/code_object/require.rb +23 -39
  24. data/lib/rdoc/code_object/single_class.rb +21 -19
  25. data/lib/rdoc/code_object/top_level.rb +215 -202
  26. data/lib/rdoc/code_object.rb +305 -305
  27. data/lib/rdoc/comment.rb +274 -337
  28. data/lib/rdoc/cross_reference.rb +195 -206
  29. data/lib/rdoc/encoding.rb +105 -103
  30. data/lib/rdoc/erb_partial.rb +13 -11
  31. data/lib/rdoc/erbio.rb +29 -27
  32. data/lib/rdoc/generator/aliki.rb +196 -30
  33. data/lib/rdoc/generator/darkfish.rb +647 -629
  34. data/lib/rdoc/generator/json_index.rb +233 -229
  35. data/lib/rdoc/generator/markup.rb +165 -122
  36. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  37. data/lib/rdoc/generator/pot/po.rb +52 -51
  38. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  39. data/lib/rdoc/generator/pot.rb +85 -81
  40. data/lib/rdoc/generator/ri.rb +23 -19
  41. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  42. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  43. data/lib/rdoc/generator/template/aliki/_footer.rhtml +2 -2
  44. data/lib/rdoc/generator/template/aliki/_head.rhtml +15 -10
  45. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  46. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  47. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  48. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  49. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +3 -3
  50. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
  51. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  52. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  53. data/lib/rdoc/generator/template/aliki/class.rhtml +71 -61
  54. data/lib/rdoc/generator/template/aliki/css/rdoc.css +796 -323
  55. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/js/aliki.js +119 -113
  57. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  58. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
  59. data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
  60. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  61. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  62. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  63. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  64. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  68. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  69. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +2 -2
  70. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  71. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  72. data/lib/rdoc/generator/template/darkfish/class.rhtml +29 -32
  73. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -1
  74. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  75. data/lib/rdoc/generator.rb +48 -46
  76. data/lib/rdoc/i18n/locale.rb +99 -95
  77. data/lib/rdoc/i18n/text.rb +109 -105
  78. data/lib/rdoc/i18n.rb +7 -5
  79. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  80. data/lib/rdoc/markdown.kpeg +52 -33
  81. data/lib/rdoc/markdown.rb +365 -177
  82. data/lib/rdoc/markup/blank_line.rb +25 -23
  83. data/lib/rdoc/markup/block_quote.rb +12 -8
  84. data/lib/rdoc/markup/document.rb +127 -123
  85. data/lib/rdoc/markup/element.rb +21 -0
  86. data/lib/rdoc/markup/formatter.rb +220 -203
  87. data/lib/rdoc/markup/hard_break.rb +30 -27
  88. data/lib/rdoc/markup/heading.rb +163 -77
  89. data/lib/rdoc/markup/include.rb +33 -29
  90. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  91. data/lib/rdoc/markup/inline_parser.rb +316 -0
  92. data/lib/rdoc/markup/list.rb +80 -88
  93. data/lib/rdoc/markup/list_item.rb +73 -85
  94. data/lib/rdoc/markup/paragraph.rb +23 -19
  95. data/lib/rdoc/markup/parser.rb +501 -497
  96. data/lib/rdoc/markup/pre_process.rb +284 -305
  97. data/lib/rdoc/markup/raw.rb +52 -55
  98. data/lib/rdoc/markup/rule.rb +16 -12
  99. data/lib/rdoc/markup/table.rb +48 -40
  100. data/lib/rdoc/markup/to_ansi.rb +143 -92
  101. data/lib/rdoc/markup/to_bs.rb +86 -102
  102. data/lib/rdoc/markup/to_html.rb +608 -506
  103. data/lib/rdoc/markup/to_html_crossref.rb +219 -210
  104. data/lib/rdoc/markup/to_html_snippet.rb +210 -205
  105. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  106. data/lib/rdoc/markup/to_label.rb +64 -51
  107. data/lib/rdoc/markup/to_markdown.rb +212 -184
  108. data/lib/rdoc/markup/to_rdoc.rb +341 -277
  109. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  110. data/lib/rdoc/markup/to_test.rb +62 -50
  111. data/lib/rdoc/markup/to_tt_only.rb +83 -92
  112. data/lib/rdoc/markup/verbatim.rb +62 -58
  113. data/lib/rdoc/markup.rb +196 -215
  114. data/lib/rdoc/options.rb +1063 -1076
  115. data/lib/rdoc/parser/c.rb +1039 -1036
  116. data/lib/rdoc/parser/changelog.rb +320 -287
  117. data/lib/rdoc/parser/markdown.rb +17 -13
  118. data/lib/rdoc/parser/rbs.rb +279 -0
  119. data/lib/rdoc/parser/rd.rb +17 -13
  120. data/lib/rdoc/parser/ruby.rb +1231 -2222
  121. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  122. data/lib/rdoc/parser/simple.rb +31 -27
  123. data/lib/rdoc/parser/text.rb +12 -8
  124. data/lib/rdoc/parser.rb +230 -221
  125. data/lib/rdoc/rbs_helper.rb +186 -0
  126. data/lib/rdoc/rd/inline.rb +57 -53
  127. data/lib/rdoc/rd.rb +90 -88
  128. data/lib/rdoc/rdoc.rb +547 -366
  129. data/lib/rdoc/ri/driver.rb +1141 -1130
  130. data/lib/rdoc/ri/formatter.rb +7 -3
  131. data/lib/rdoc/ri/paths.rb +140 -136
  132. data/lib/rdoc/ri/servlet.rb +456 -0
  133. data/lib/rdoc/ri/store.rb +4 -2
  134. data/lib/rdoc/ri/task.rb +55 -51
  135. data/lib/rdoc/ri.rb +14 -11
  136. data/lib/rdoc/rubygems_hook.rb +194 -192
  137. data/lib/rdoc/server.rb +462 -0
  138. data/lib/rdoc/stats/normal.rb +46 -42
  139. data/lib/rdoc/stats/quiet.rb +39 -35
  140. data/lib/rdoc/stats/verbose.rb +35 -31
  141. data/lib/rdoc/stats.rb +363 -338
  142. data/lib/rdoc/store.rb +919 -725
  143. data/lib/rdoc/task.rb +260 -255
  144. data/lib/rdoc/text.rb +164 -240
  145. data/lib/rdoc/token_stream.rb +88 -106
  146. data/lib/rdoc/tom_doc.rb +203 -201
  147. data/lib/rdoc/version.rb +1 -1
  148. data/lib/rdoc.rb +35 -7
  149. data/lib/rubygems_plugin.rb +2 -11
  150. data/rdoc-logo.svg +43 -0
  151. data/rdoc.gemspec +9 -7
  152. metadata +46 -32
  153. data/CONTRIBUTING.rdoc +0 -219
  154. data/ExampleMarkdown.md +0 -39
  155. data/ExampleRDoc.rdoc +0 -210
  156. data/lib/rdoc/code_object/anon_class.rb +0 -10
  157. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  158. data/lib/rdoc/code_object/meta_method.rb +0 -6
  159. data/lib/rdoc/markdown/literals.kpeg +0 -21
  160. data/lib/rdoc/markdown/literals.rb +0 -454
  161. data/lib/rdoc/markup/attr_changer.rb +0 -22
  162. data/lib/rdoc/markup/attr_span.rb +0 -35
  163. data/lib/rdoc/markup/attribute_manager.rb +0 -405
  164. data/lib/rdoc/markup/attributes.rb +0 -70
  165. data/lib/rdoc/markup/regexp_handling.rb +0 -40
  166. data/lib/rdoc/parser/prism_ruby.rb +0 -1100
  167. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  168. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  169. data/lib/rdoc/servlet.rb +0 -452
data/lib/rdoc/markup.rb CHANGED
@@ -1,127 +1,128 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # RDoc::Markup parses plain text documents and attempts to decompose them into
4
- # their constituent parts. Some of these parts are high-level: paragraphs,
5
- # chunks of verbatim text, list entries and the like. Other parts happen at
6
- # the character level: a piece of bold text, a word in code font. This markup
7
- # is similar in spirit to that used on WikiWiki webs, where folks create web
8
- # pages using a simple set of formatting rules.
9
- #
10
- # RDoc::Markup and other markup formats do no output formatting, this is
11
- # handled by the RDoc::Markup::Formatter subclasses.
12
- #
13
- # = Markup Formats
14
- #
15
- # +RDoc+ supports these markup formats:
16
- #
17
- # - +rdoc+:
18
- # the +RDoc+ markup format;
19
- # see RDoc::MarkupReference.
20
- # - +markdown+:
21
- # The +markdown+ markup format as described in
22
- # the {Markdown Guide}[https://www.markdownguide.org];
23
- # see RDoc::Markdown.
24
- # - +rd+:
25
- # the +rd+ markup format format;
26
- # see RDoc::RD.
27
- # - +tomdoc+:
28
- # the TomDoc format as described in
29
- # {TomDoc for Ruby}[http://tomdoc.org];
30
- # see RDoc::TomDoc.
31
- #
32
- # You can choose a markup format using the following methods:
33
- #
34
- # per project::
35
- # If you build your documentation with rake use RDoc::Task#markup.
36
- #
37
- # If you build your documentation by hand run:
38
- #
39
- # rdoc --markup your_favorite_format --write-options
40
- #
41
- # and commit <tt>.rdoc_options</tt> and ship it with your packaged gem.
42
- # per file::
43
- # At the top of the file use the <tt>:markup:</tt> directive to set the
44
- # default format for the rest of the file.
45
- # per comment::
46
- # Use the <tt>:markup:</tt> directive at the top of a comment you want
47
- # to write in a different format.
48
- #
49
- # = RDoc::Markup
50
- #
51
- # RDoc::Markup is extensible at runtime: you can add \new markup elements to
52
- # be recognized in the documents that RDoc::Markup parses.
53
- #
54
- # RDoc::Markup is intended to be the basis for a family of tools which share
55
- # the common requirement that simple, plain-text should be rendered in a
56
- # variety of different output formats and media. It is envisaged that
57
- # RDoc::Markup could be the basis for formatting RDoc style comment blocks,
58
- # Wiki entries, and online FAQs.
59
- #
60
- # == Synopsis
61
- #
62
- # This code converts +input_string+ to HTML. The conversion takes place in
63
- # the +convert+ method, so you can use the same RDoc::Markup converter to
64
- # convert multiple input strings.
65
- #
66
- # require 'rdoc'
67
- #
68
- # h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
69
- #
70
- # puts h.convert(input_string)
71
- #
72
- # You can extend the RDoc::Markup parser to recognize new markup
73
- # sequences, and to add regexp handling. Here we make WikiWords significant to
74
- # the parser, and also make the sequences {word} and \<no>text...</no> signify
75
- # strike-through text. We then subclass the HTML output class to deal
76
- # with these:
77
- #
78
- # require 'rdoc'
79
- #
80
- # class WikiHtml < RDoc::Markup::ToHtml
81
- # def handle_regexp_WIKIWORD(target)
82
- # "<font color=red>" + target.text + "</font>"
83
- # end
84
- # end
85
- #
86
- # markup = RDoc::Markup.new
87
- # markup.add_word_pair("{", "}", :STRIKE)
88
- # markup.add_html("no", :STRIKE)
89
- #
90
- # markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
91
- #
92
- # wh = WikiHtml.new RDoc::Options.new, markup
93
- # wh.add_tag(:STRIKE, "<strike>", "</strike>")
94
- #
95
- # puts "<body>#{wh.convert ARGF.read}</body>"
96
- #
97
- # == Encoding
98
- #
99
- # Where Encoding support is available, RDoc will automatically convert all
100
- # documents to the same output encoding. The output encoding can be set via
101
- # RDoc::Options#encoding and defaults to Encoding.default_external.
102
- #
103
- # = \RDoc Markup Reference
104
- #
105
- # See RDoc::MarkupReference.
106
- #
107
- #--
108
- # Original Author:: Dave Thomas, dave@pragmaticprogrammer.com
109
- # License:: Ruby license
110
-
111
- class RDoc::Markup
112
-
2
+ module RDoc
113
3
  ##
114
- # An AttributeManager which handles inline markup.
4
+ # RDoc::Markup parses plain text documents and attempts to decompose them into
5
+ # their constituent parts. Some of these parts are high-level: paragraphs,
6
+ # chunks of verbatim text, list entries and the like. Other parts happen at
7
+ # the character level: a piece of bold text, a word in code font. This markup
8
+ # is similar in spirit to that used on WikiWiki webs, where folks create web
9
+ # pages using a simple set of formatting rules.
10
+ #
11
+ # RDoc::Markup and other markup formats do no output formatting, this is
12
+ # handled by the RDoc::Markup::Formatter subclasses.
13
+ #
14
+ # = Markup Formats
15
+ #
16
+ # +RDoc+ supports these markup formats:
17
+ #
18
+ # - +rdoc+:
19
+ # the +RDoc+ markup format;
20
+ # see {RDoc Markup Reference}[rdoc-ref:doc/markup_reference/rdoc.rdoc]
21
+ # - +markdown+:
22
+ # The +markdown+ markup format as described in
23
+ # the {Markdown Guide}[https://www.markdownguide.org];
24
+ # see RDoc::Markdown.
25
+ # - +rd+:
26
+ # the +rd+ markup format format;
27
+ # see RDoc::RD.
28
+ # - +tomdoc+:
29
+ # the TomDoc format as described in
30
+ # {TomDoc for Ruby}[http://tomdoc.org];
31
+ # see RDoc::TomDoc.
32
+ #
33
+ # You can choose a markup format using the following methods:
34
+ #
35
+ # per project::
36
+ # If you build your documentation with rake use RDoc::Task#markup.
37
+ #
38
+ # If you build your documentation by hand run:
39
+ #
40
+ # rdoc --markup your_favorite_format --write-options
41
+ #
42
+ # and commit <tt>.rdoc_options</tt> and ship it with your packaged gem.
43
+ # per file::
44
+ # At the top of the file use the <tt>:markup:</tt> directive to set the
45
+ # default format for the rest of the file.
46
+ # per comment::
47
+ # Use the <tt>:markup:</tt> directive at the top of a comment you want
48
+ # to write in a different format.
49
+ #
50
+ # = RDoc::Markup
51
+ #
52
+ # RDoc::Markup is extensible at runtime: you can add \new markup elements to
53
+ # be recognized in the documents that RDoc::Markup parses.
54
+ #
55
+ # RDoc::Markup is intended to be the basis for a family of tools which share
56
+ # the common requirement that simple, plain-text should be rendered in a
57
+ # variety of different output formats and media. It is envisaged that
58
+ # RDoc::Markup could be the basis for formatting RDoc style comment blocks,
59
+ # Wiki entries, and online FAQs.
60
+ #
61
+ # == Synopsis
62
+ #
63
+ # This code converts +input_string+ to HTML. The conversion takes place in
64
+ # the +convert+ method, so you can use the same RDoc::Markup converter to
65
+ # convert multiple input strings.
66
+ #
67
+ # require 'rdoc'
68
+ #
69
+ # h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
70
+ #
71
+ # puts h.convert(input_string)
72
+ #
73
+ # You can extend the RDoc::Markup parser to recognize new markup
74
+ # sequences, and to add regexp handling. Here we make WikiWords significant to
75
+ # the parser, and also make the sequences {word} and \<no>text...</no> signify
76
+ # strike-through text. We then subclass the HTML output class to deal
77
+ # with these:
78
+ #
79
+ # require 'rdoc'
80
+ #
81
+ # class WikiHtml < RDoc::Markup::ToHtml
82
+ # def handle_regexp_WIKIWORD(target)
83
+ # "<font color=red>" + target + "</font>"
84
+ # end
85
+ # end
86
+ #
87
+ # markup = RDoc::Markup.new
88
+ # markup.add_word_pair("{", "}", :STRIKE)
89
+ # markup.add_html("no", :STRIKE)
90
+ #
91
+ # markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
92
+ #
93
+ # wh = WikiHtml.new RDoc::Options.new, markup
94
+ # wh.add_tag(:STRIKE, "<strike>", "</strike>")
95
+ #
96
+ # puts "<body>#{wh.convert ARGF.read}</body>"
97
+ #
98
+ # == Encoding
99
+ #
100
+ # Where Encoding support is available, RDoc will automatically convert all
101
+ # documents to the same output encoding. The output encoding can be set via
102
+ # RDoc::Options#encoding and defaults to Encoding.default_external.
103
+ #
104
+ # = \RDoc Markup Reference
105
+ #
106
+ # See {RDoc Markup Reference}[rdoc-ref:doc/markup_reference/rdoc.rdoc]
107
+ #
108
+ #--
109
+ # Original Author:: Dave Thomas, dave@pragmaticprogrammer.com
110
+ # License:: Ruby license
115
111
 
116
- attr_reader :attribute_manager
112
+ class Markup
117
113
 
118
- ##
119
- # Parses +str+ into an RDoc::Markup::Document.
114
+ # Array of regexp handling pattern and its name. A regexp handling
115
+ # sequence is something like a WikiWord
116
+
117
+ attr_reader :regexp_handlings
120
118
 
121
- def self.parse(str)
122
- RDoc::Markup::Parser.parse str
123
- rescue RDoc::Markup::Parser::Error => e
124
- $stderr.puts <<-EOF
119
+ ##
120
+ # Parses +str+ into an RDoc::Markup::Document.
121
+
122
+ def self.parse(str)
123
+ Markup::Parser.parse str
124
+ rescue Markup::Parser::Error => e
125
+ $stderr.puts <<-EOF
125
126
  While parsing markup, RDoc encountered a #{e.class}:
126
127
 
127
128
  #{e}
@@ -131,7 +132,7 @@ While parsing markup, RDoc encountered a #{e.class}:
131
132
  #{text}
132
133
  ---8<---
133
134
 
134
- RDoc #{RDoc::VERSION}
135
+ RDoc #{VERSION}
135
136
 
136
137
  Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
137
138
 
@@ -140,101 +141,81 @@ Please file a bug report with the above information at:
140
141
  https://github.com/ruby/rdoc/issues
141
142
 
142
143
  EOF
143
- raise
144
- end
145
-
146
- ##
147
- # Take a block of text and use various heuristics to determine its
148
- # structure (paragraphs, lists, and so on). Invoke an event handler as we
149
- # identify significant chunks.
144
+ raise
145
+ end
146
+
147
+ ##
148
+ # Take a block of text and use various heuristics to determine its
149
+ # structure (paragraphs, lists, and so on). Invoke an event handler as we
150
+ # identify significant chunks.
151
+
152
+ def initialize
153
+ @regexp_handlings = []
154
+ @output = nil
155
+ end
156
+
157
+ ##
158
+ # Add to other inline sequences. For example, we could add WikiWords using
159
+ # something like:
160
+ #
161
+ # parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
162
+ #
163
+ # Each wiki word will be presented to the output formatter.
164
+
165
+ def add_regexp_handling(pattern, name)
166
+ @regexp_handlings << [pattern, name]
167
+ end
168
+
169
+ ##
170
+ # We take +input+, parse it if necessary, then invoke the output +formatter+
171
+ # using a Visitor to render the result.
172
+
173
+ def convert(input, formatter)
174
+ document = case input
175
+ when Markup::Document
176
+ input
177
+ else
178
+ Markup::Parser.parse input
179
+ end
180
+
181
+ document.accept formatter
182
+ end
183
+
184
+ autoload :Parser, "#{__dir__}/markup/parser"
185
+ autoload :InlineParser, "#{__dir__}/markup/inline_parser"
186
+ autoload :PreProcess, "#{__dir__}/markup/pre_process"
187
+
188
+ # RDoc::Markup AST
189
+ autoload :BlankLine, "#{__dir__}/markup/blank_line"
190
+ autoload :BlockQuote, "#{__dir__}/markup/block_quote"
191
+ autoload :Document, "#{__dir__}/markup/document"
192
+ autoload :Element, "#{__dir__}/markup/element"
193
+ autoload :HardBreak, "#{__dir__}/markup/hard_break"
194
+ autoload :Heading, "#{__dir__}/markup/heading"
195
+ autoload :Include, "#{__dir__}/markup/include"
196
+ autoload :IndentedParagraph, "#{__dir__}/markup/indented_paragraph"
197
+ autoload :List, "#{__dir__}/markup/list"
198
+ autoload :ListItem, "#{__dir__}/markup/list_item"
199
+ autoload :Paragraph, "#{__dir__}/markup/paragraph"
200
+ autoload :Table, "#{__dir__}/markup/table"
201
+ autoload :Raw, "#{__dir__}/markup/raw"
202
+ autoload :Rule, "#{__dir__}/markup/rule"
203
+ autoload :Verbatim, "#{__dir__}/markup/verbatim"
204
+
205
+ # Formatters
206
+ autoload :Formatter, "#{__dir__}/markup/formatter"
207
+
208
+ autoload :ToAnsi, "#{__dir__}/markup/to_ansi"
209
+ autoload :ToBs, "#{__dir__}/markup/to_bs"
210
+ autoload :ToHtml, "#{__dir__}/markup/to_html"
211
+ autoload :ToHtmlCrossref, "#{__dir__}/markup/to_html_crossref"
212
+ autoload :ToHtmlSnippet, "#{__dir__}/markup/to_html_snippet"
213
+ autoload :ToLabel, "#{__dir__}/markup/to_label"
214
+ autoload :ToMarkdown, "#{__dir__}/markup/to_markdown"
215
+ autoload :ToRdoc, "#{__dir__}/markup/to_rdoc"
216
+ autoload :ToTableOfContents, "#{__dir__}/markup/to_table_of_contents"
217
+ autoload :ToTest, "#{__dir__}/markup/to_test"
218
+ autoload :ToTtOnly, "#{__dir__}/markup/to_tt_only"
150
219
 
151
- def initialize(attribute_manager = nil)
152
- @attribute_manager = attribute_manager || RDoc::Markup::AttributeManager.new
153
- @output = nil
154
220
  end
155
-
156
- ##
157
- # Add to the sequences used to add formatting to an individual word (such
158
- # as *bold*). Matching entries will generate attributes that the output
159
- # formatters can recognize by their +name+.
160
-
161
- def add_word_pair(start, stop, name)
162
- @attribute_manager.add_word_pair(start, stop, name)
163
- end
164
-
165
- ##
166
- # Add to the sequences recognized as general markup.
167
-
168
- def add_html(tag, name)
169
- @attribute_manager.add_html(tag, name)
170
- end
171
-
172
- ##
173
- # Add to other inline sequences. For example, we could add WikiWords using
174
- # something like:
175
- #
176
- # parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
177
- #
178
- # Each wiki word will be presented to the output formatter.
179
-
180
- def add_regexp_handling(pattern, name)
181
- @attribute_manager.add_regexp_handling(pattern, name)
182
- end
183
-
184
- ##
185
- # We take +input+, parse it if necessary, then invoke the output +formatter+
186
- # using a Visitor to render the result.
187
-
188
- def convert(input, formatter)
189
- document = case input
190
- when RDoc::Markup::Document then
191
- input
192
- else
193
- RDoc::Markup::Parser.parse input
194
- end
195
-
196
- document.accept formatter
197
- end
198
-
199
- autoload :Parser, "#{__dir__}/markup/parser"
200
- autoload :PreProcess, "#{__dir__}/markup/pre_process"
201
-
202
- # Inline markup classes
203
- autoload :AttrChanger, "#{__dir__}/markup/attr_changer"
204
- autoload :AttrSpan, "#{__dir__}/markup/attr_span"
205
- autoload :Attributes, "#{__dir__}/markup/attributes"
206
- autoload :AttributeManager, "#{__dir__}/markup/attribute_manager"
207
- autoload :RegexpHandling, "#{__dir__}/markup/regexp_handling"
208
-
209
- # RDoc::Markup AST
210
- autoload :BlankLine, "#{__dir__}/markup/blank_line"
211
- autoload :BlockQuote, "#{__dir__}/markup/block_quote"
212
- autoload :Document, "#{__dir__}/markup/document"
213
- autoload :HardBreak, "#{__dir__}/markup/hard_break"
214
- autoload :Heading, "#{__dir__}/markup/heading"
215
- autoload :Include, "#{__dir__}/markup/include"
216
- autoload :IndentedParagraph, "#{__dir__}/markup/indented_paragraph"
217
- autoload :List, "#{__dir__}/markup/list"
218
- autoload :ListItem, "#{__dir__}/markup/list_item"
219
- autoload :Paragraph, "#{__dir__}/markup/paragraph"
220
- autoload :Table, "#{__dir__}/markup/table"
221
- autoload :Raw, "#{__dir__}/markup/raw"
222
- autoload :Rule, "#{__dir__}/markup/rule"
223
- autoload :Verbatim, "#{__dir__}/markup/verbatim"
224
-
225
- # Formatters
226
- autoload :Formatter, "#{__dir__}/markup/formatter"
227
-
228
- autoload :ToAnsi, "#{__dir__}/markup/to_ansi"
229
- autoload :ToBs, "#{__dir__}/markup/to_bs"
230
- autoload :ToHtml, "#{__dir__}/markup/to_html"
231
- autoload :ToHtmlCrossref, "#{__dir__}/markup/to_html_crossref"
232
- autoload :ToHtmlSnippet, "#{__dir__}/markup/to_html_snippet"
233
- autoload :ToLabel, "#{__dir__}/markup/to_label"
234
- autoload :ToMarkdown, "#{__dir__}/markup/to_markdown"
235
- autoload :ToRdoc, "#{__dir__}/markup/to_rdoc"
236
- autoload :ToTableOfContents, "#{__dir__}/markup/to_table_of_contents"
237
- autoload :ToTest, "#{__dir__}/markup/to_test"
238
- autoload :ToTtOnly, "#{__dir__}/markup/to_tt_only"
239
-
240
221
  end