voloko-sdoc 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/LICENSE +21 -0
  2. data/VERSION.yml +4 -0
  3. data/lib/sdoc/generator/shtml.rb +1 -4
  4. data/lib/sdoc.rb +0 -1
  5. metadata +32 -101
  6. data/rdoc/History.txt +0 -254
  7. data/rdoc/Manifest.txt +0 -126
  8. data/rdoc/README.txt +0 -47
  9. data/rdoc/RI.txt +0 -58
  10. data/rdoc/Rakefile +0 -70
  11. data/rdoc/bin/rdoc +0 -35
  12. data/rdoc/bin/ri +0 -5
  13. data/rdoc/lib/rdoc/alias.rb +0 -54
  14. data/rdoc/lib/rdoc/anon_class.rb +0 -10
  15. data/rdoc/lib/rdoc/any_method.rb +0 -190
  16. data/rdoc/lib/rdoc/attr.rb +0 -79
  17. data/rdoc/lib/rdoc/cache.rb +0 -41
  18. data/rdoc/lib/rdoc/class_module.rb +0 -87
  19. data/rdoc/lib/rdoc/code_object.rb +0 -152
  20. data/rdoc/lib/rdoc/code_objects.rb +0 -23
  21. data/rdoc/lib/rdoc/constant.rb +0 -36
  22. data/rdoc/lib/rdoc/context.rb +0 -712
  23. data/rdoc/lib/rdoc/diagram.rb +0 -340
  24. data/rdoc/lib/rdoc/dot.rb +0 -249
  25. data/rdoc/lib/rdoc/generator/darkfish.rb +0 -455
  26. data/rdoc/lib/rdoc/generator/markup.rb +0 -194
  27. data/rdoc/lib/rdoc/generator/ri.rb +0 -230
  28. data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -281
  29. data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -112
  30. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  31. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  32. data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  33. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  34. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  35. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  36. data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  37. data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  38. data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  39. data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  40. data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  41. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  42. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  43. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  44. data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  45. data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  46. data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  47. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  48. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  49. data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  50. data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +0 -64
  51. data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -116
  52. data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -32
  53. data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  54. data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
  55. data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +0 -696
  56. data/rdoc/lib/rdoc/generator.rb +0 -8
  57. data/rdoc/lib/rdoc/ghost_method.rb +0 -8
  58. data/rdoc/lib/rdoc/include.rb +0 -39
  59. data/rdoc/lib/rdoc/known_classes.rb +0 -68
  60. data/rdoc/lib/rdoc/markup/attribute_manager.rb +0 -311
  61. data/rdoc/lib/rdoc/markup/formatter.rb +0 -25
  62. data/rdoc/lib/rdoc/markup/fragments.rb +0 -377
  63. data/rdoc/lib/rdoc/markup/inline.rb +0 -126
  64. data/rdoc/lib/rdoc/markup/lines.rb +0 -156
  65. data/rdoc/lib/rdoc/markup/preprocess.rb +0 -80
  66. data/rdoc/lib/rdoc/markup/to_flow.rb +0 -211
  67. data/rdoc/lib/rdoc/markup/to_html.rb +0 -406
  68. data/rdoc/lib/rdoc/markup/to_html_crossref.rb +0 -140
  69. data/rdoc/lib/rdoc/markup/to_latex.rb +0 -328
  70. data/rdoc/lib/rdoc/markup/to_test.rb +0 -53
  71. data/rdoc/lib/rdoc/markup/to_texinfo.rb +0 -73
  72. data/rdoc/lib/rdoc/markup.rb +0 -378
  73. data/rdoc/lib/rdoc/meta_method.rb +0 -8
  74. data/rdoc/lib/rdoc/normal_class.rb +0 -18
  75. data/rdoc/lib/rdoc/normal_module.rb +0 -34
  76. data/rdoc/lib/rdoc/options.rb +0 -542
  77. data/rdoc/lib/rdoc/parser/c.rb +0 -678
  78. data/rdoc/lib/rdoc/parser/perl.rb +0 -165
  79. data/rdoc/lib/rdoc/parser/ruby.rb +0 -2904
  80. data/rdoc/lib/rdoc/parser/simple.rb +0 -39
  81. data/rdoc/lib/rdoc/parser.rb +0 -138
  82. data/rdoc/lib/rdoc/rdoc.rb +0 -375
  83. data/rdoc/lib/rdoc/require.rb +0 -32
  84. data/rdoc/lib/rdoc/ri/cache.rb +0 -187
  85. data/rdoc/lib/rdoc/ri/descriptions.rb +0 -156
  86. data/rdoc/lib/rdoc/ri/display.rb +0 -340
  87. data/rdoc/lib/rdoc/ri/driver.rb +0 -828
  88. data/rdoc/lib/rdoc/ri/formatter.rb +0 -654
  89. data/rdoc/lib/rdoc/ri/paths.rb +0 -93
  90. data/rdoc/lib/rdoc/ri/reader.rb +0 -106
  91. data/rdoc/lib/rdoc/ri/util.rb +0 -79
  92. data/rdoc/lib/rdoc/ri/writer.rb +0 -68
  93. data/rdoc/lib/rdoc/ri.rb +0 -8
  94. data/rdoc/lib/rdoc/single_class.rb +0 -8
  95. data/rdoc/lib/rdoc/stats.rb +0 -178
  96. data/rdoc/lib/rdoc/task.rb +0 -276
  97. data/rdoc/lib/rdoc/tokenstream.rb +0 -33
  98. data/rdoc/lib/rdoc/top_level.rb +0 -242
  99. data/rdoc/lib/rdoc.rb +0 -398
@@ -1,140 +0,0 @@
1
- require 'rdoc/markup/to_html'
2
-
3
- ##
4
- # Subclass of the RDoc::Markup::ToHtml class that supports looking up words
5
- # from a context. Those that are found will be hyperlinked.
6
-
7
- class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
8
-
9
- ##
10
- # Regular expressions to match class and method references.
11
- #
12
- # 1) There can be a '\' in front of text to suppress any cross-references
13
- # 2) There can be a '::' in front of class names to reference from the
14
- # top-level namespace.
15
- # 3) The method can be followed by parenthesis which may
16
-
17
- CLASS_REGEXP_STR = '\\\\?((?:\:{2})?[A-Z]\w*(?:\:\:\w+)*)'
18
- METHOD_REGEXP_STR = '(\w+[!?=]?)(?:\([\.\w+\*\/\+\-\=\<\>]*\))?'
19
-
20
- ##
21
- # Regular expressions matching text that should potentially have
22
- # cross-reference links generated are passed to add_special. Note that
23
- # these expressions are meant to pick up text for which cross-references
24
- # have been suppressed, since the suppression characters are removed by the
25
- # code that is triggered.
26
-
27
- CROSSREF_REGEXP = /(
28
- # A::B::C.meth
29
- #{CLASS_REGEXP_STR}[\.\#]#{METHOD_REGEXP_STR}
30
-
31
- # Stand-alone method (proceeded by a #)
32
- | \\?\##{METHOD_REGEXP_STR}
33
-
34
- # A::B::C
35
- # The stuff after CLASS_REGEXP_STR is a
36
- # nasty hack. CLASS_REGEXP_STR unfortunately matches
37
- # words like dog and cat (these are legal "class"
38
- # names in Fortran 95). When a word is flagged as a
39
- # potential cross-reference, limitations in the markup
40
- # engine suppress other processing, such as typesetting.
41
- # This is particularly noticeable for contractions.
42
- # In order that words like "can't" not
43
- # be flagged as potential cross-references, only
44
- # flag potential class cross-references if the character
45
- # after the cross-referece is a space or sentence
46
- # punctuation.
47
- | #{CLASS_REGEXP_STR}(?=[\s\)\.\?\!\,\;]|\z)
48
-
49
- # Things that look like filenames
50
- # The key thing is that there must be at least
51
- # one special character (period, slash, or
52
- # underscore).
53
- | [\/\w]+[_\/\.][\w\/\.]+
54
-
55
- # Things that have markup suppressed
56
- | \\[^\s]
57
- )/x
58
-
59
- ##
60
- # RDoc::CodeObject for generating references
61
-
62
- attr_accessor :context
63
-
64
- ##
65
- # Creates a new crossref resolver that generates links relative to +context+
66
- # which lives at +from_path+ in the generated files. '#' characters on
67
- # references are removed unless +show_hash+ is true.
68
-
69
- def initialize(from_path, context, show_hash)
70
- raise ArgumentError, 'from_path cannot be nil' if from_path.nil?
71
- super()
72
-
73
- @markup.add_special(CROSSREF_REGEXP, :CROSSREF)
74
-
75
- @from_path = from_path
76
- @context = context
77
- @show_hash = show_hash
78
-
79
- @seen = {}
80
- end
81
-
82
- ##
83
- # We're invoked when any text matches the CROSSREF pattern (defined in
84
- # MarkUp). If we find the corresponding reference, generate a hyperlink.
85
- # If the name we're looking for contains no punctuation, we look for it up
86
- # the module/class chain. For example, HyperlinkHtml is found, even without
87
- # the Generator:: prefix, because we look for it in module Generator first.
88
-
89
- def handle_special_CROSSREF(special)
90
- name = special.text
91
-
92
- # This ensures that words entirely consisting of lowercase letters will
93
- # not have cross-references generated (to suppress lots of erroneous
94
- # cross-references to "new" in text, for instance)
95
- return name if name =~ /\A[a-z]*\z/
96
-
97
- return @seen[name] if @seen.include? name
98
-
99
- if name[0, 1] == '#' then
100
- lookup = name[1..-1]
101
- name = lookup unless @show_hash
102
- else
103
- lookup = name
104
- end
105
-
106
- # Find class, module, or method in class or module.
107
- #
108
- # Do not, however, use an if/elsif/else chain to do so. Instead, test
109
- # each possible pattern until one matches. The reason for this is that a
110
- # string like "YAML.txt" could be the txt() class method of class YAML (in
111
- # which case it would match the first pattern, which splits the string
112
- # into container and method components and looks up both) or a filename
113
- # (in which case it would match the last pattern, which just checks
114
- # whether the string as a whole is a known symbol).
115
-
116
- if /#{CLASS_REGEXP_STR}[\.\#]#{METHOD_REGEXP_STR}/ =~ lookup then
117
- container = $1
118
- method = $2
119
- ref = @context.find_symbol container, method
120
- end
121
-
122
- ref = @context.find_symbol lookup unless ref
123
-
124
- out = if lookup == '\\' then
125
- lookup
126
- elsif lookup =~ /^\\/ then
127
- $'
128
- elsif ref and ref.document_self then
129
- "<a href=\"#{ref.as_href(@from_path)}\">#{name}</a>"
130
- else
131
- name
132
- end
133
-
134
- @seen[name] = out
135
-
136
- out
137
- end
138
-
139
- end
140
-
@@ -1,328 +0,0 @@
1
- require 'rdoc/markup/formatter'
2
- require 'rdoc/markup/fragments'
3
- require 'rdoc/markup/inline'
4
-
5
- require 'cgi'
6
-
7
- ##
8
- # Convert SimpleMarkup to basic LaTeX report format.
9
-
10
- class RDoc::Markup::ToLaTeX < RDoc::Markup::Formatter
11
-
12
- BS = "\020" # \
13
- OB = "\021" # {
14
- CB = "\022" # }
15
- DL = "\023" # Dollar
16
-
17
- BACKSLASH = "#{BS}symbol#{OB}92#{CB}"
18
- HAT = "#{BS}symbol#{OB}94#{CB}"
19
- BACKQUOTE = "#{BS}symbol#{OB}0#{CB}"
20
- TILDE = "#{DL}#{BS}sim#{DL}"
21
- LESSTHAN = "#{DL}<#{DL}"
22
- GREATERTHAN = "#{DL}>#{DL}"
23
-
24
- def self.l(str)
25
- str.tr('\\', BS).tr('{', OB).tr('}', CB).tr('$', DL)
26
- end
27
-
28
- def l(arg)
29
- RDoc::Markup::ToLaTeX.l(arg)
30
- end
31
-
32
- LIST_TYPE_TO_LATEX = {
33
- :BULLET => [ l("\\begin{itemize}"), l("\\end{itemize}") ],
34
- :NUMBER => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\arabic" ],
35
- :UPPERALPHA => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\Alph" ],
36
- :LOWERALPHA => [ l("\\begin{enumerate}"), l("\\end{enumerate}"), "\\alph" ],
37
- :LABELED => [ l("\\begin{description}"), l("\\end{description}") ],
38
- :NOTE => [
39
- l("\\begin{tabularx}{\\linewidth}{@{} l X @{}}"),
40
- l("\\end{tabularx}") ],
41
- }
42
-
43
- InlineTag = Struct.new(:bit, :on, :off)
44
-
45
- def initialize
46
- init_tags
47
- @list_depth = 0
48
- @prev_list_types = []
49
- end
50
-
51
- ##
52
- # Set up the standard mapping of attributes to LaTeX
53
-
54
- def init_tags
55
- @attr_tags = [
56
- InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:BOLD), l("\\textbf{"), l("}")),
57
- InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:TT), l("\\texttt{"), l("}")),
58
- InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:EM), l("\\emph{"), l("}")),
59
- ]
60
- end
61
-
62
- ##
63
- # Escape a LaTeX string
64
-
65
- def escape(str)
66
- $stderr.print "FE: ", str if $DEBUG_RDOC
67
- s = str.
68
- sub(/\s+$/, '').
69
- gsub(/([_\${}&%#])/, "#{BS}\\1").
70
- gsub(/\\/, BACKSLASH).
71
- gsub(/\^/, HAT).
72
- gsub(/~/, TILDE).
73
- gsub(/</, LESSTHAN).
74
- gsub(/>/, GREATERTHAN).
75
- gsub(/,,/, ",{},").
76
- gsub(/\`/, BACKQUOTE)
77
- $stderr.print "-> ", s, "\n" if $DEBUG_RDOC
78
- s
79
- end
80
-
81
- ##
82
- # Add a new set of LaTeX tags for an attribute. We allow
83
- # separate start and end tags for flexibility
84
-
85
- def add_tag(name, start, stop)
86
- @attr_tags << InlineTag.new(RDoc::Markup::Attribute.bitmap_for(name), start, stop)
87
- end
88
-
89
- ##
90
- # This is a higher speed (if messier) version of wrap
91
-
92
- def wrap(txt, line_len = 76)
93
- res = ""
94
- sp = 0
95
- ep = txt.length
96
- while sp < ep
97
- # scan back for a space
98
- p = sp + line_len - 1
99
- if p >= ep
100
- p = ep
101
- else
102
- while p > sp and txt[p] != ?\s
103
- p -= 1
104
- end
105
- if p <= sp
106
- p = sp + line_len
107
- while p < ep and txt[p] != ?\s
108
- p += 1
109
- end
110
- end
111
- end
112
- res << txt[sp...p] << "\n"
113
- sp = p
114
- sp += 1 while sp < ep and txt[sp] == ?\s
115
- end
116
- res
117
- end
118
-
119
- ##
120
- # :section: Visitor
121
-
122
- def start_accepting
123
- @res = ""
124
- @in_list_entry = []
125
- end
126
-
127
- def end_accepting
128
- @res.tr(BS, '\\').tr(OB, '{').tr(CB, '}').tr(DL, '$')
129
- end
130
-
131
- def accept_paragraph(am, fragment)
132
- @res << wrap(convert_flow(am.flow(fragment.txt)))
133
- @res << "\n"
134
- end
135
-
136
- def accept_verbatim(am, fragment)
137
- @res << "\n\\begin{code}\n"
138
- @res << fragment.txt.sub(/[\n\s]+\Z/, '')
139
- @res << "\n\\end{code}\n\n"
140
- end
141
-
142
- def accept_rule(am, fragment)
143
- size = fragment.param
144
- size = 10 if size > 10
145
- @res << "\n\n\\rule{\\linewidth}{#{size}pt}\n\n"
146
- end
147
-
148
- def accept_list_start(am, fragment)
149
- @res << list_name(fragment.type, true) << "\n"
150
- @in_list_entry.push false
151
- end
152
-
153
- def accept_list_end(am, fragment)
154
- if tag = @in_list_entry.pop
155
- @res << tag << "\n"
156
- end
157
- @res << list_name(fragment.type, false) << "\n"
158
- end
159
-
160
- def accept_list_item(am, fragment)
161
- if tag = @in_list_entry.last
162
- @res << tag << "\n"
163
- end
164
- @res << list_item_start(am, fragment)
165
- @res << wrap(convert_flow(am.flow(fragment.txt))) << "\n"
166
- @in_list_entry[-1] = list_end_for(fragment.type)
167
- end
168
-
169
- def accept_blank_line(am, fragment)
170
- # @res << "\n"
171
- end
172
-
173
- def accept_heading(am, fragment)
174
- @res << convert_heading(fragment.head_level, am.flow(fragment.txt))
175
- end
176
-
177
- private
178
-
179
- def on_tags(res, item)
180
- attr_mask = item.turn_on
181
- return if attr_mask.zero?
182
-
183
- @attr_tags.each do |tag|
184
- if attr_mask & tag.bit != 0
185
- res << tag.on
186
- end
187
- end
188
- end
189
-
190
- def off_tags(res, item)
191
- attr_mask = item.turn_off
192
- return if attr_mask.zero?
193
-
194
- @attr_tags.reverse_each do |tag|
195
- if attr_mask & tag.bit != 0
196
- res << tag.off
197
- end
198
- end
199
- end
200
-
201
- def convert_flow(flow)
202
- res = ""
203
- flow.each do |item|
204
- case item
205
- when String
206
- $stderr.puts "Converting '#{item}'" if $DEBUG_RDOC
207
- res << convert_string(item)
208
- when AttrChanger
209
- off_tags(res, item)
210
- on_tags(res, item)
211
- when Special
212
- res << convert_special(item)
213
- else
214
- raise "Unknown flow element: #{item.inspect}"
215
- end
216
- end
217
- res
218
- end
219
-
220
- ##
221
- # some of these patterns are taken from SmartyPants...
222
-
223
- def convert_string(item)
224
- escape(item).
225
-
226
- # convert ... to elipsis (and make sure .... becomes .<elipsis>)
227
- gsub(/\.\.\.\./, '.\ldots{}').gsub(/\.\.\./, '\ldots{}').
228
-
229
- # convert single closing quote
230
- gsub(%r{([^ \t\r\n\[\{\(])\'}, '\1\'').
231
- gsub(%r{\'(?=\W|s\b)}, "'" ).
232
-
233
- # convert single opening quote
234
- gsub(/'/, '`').
235
-
236
- # convert double closing quote
237
- gsub(%r{([^ \t\r\n\[\{\(])\"(?=\W)}, "\\1''").
238
-
239
- # convert double opening quote
240
- gsub(/"/, "``").
241
-
242
- # convert copyright
243
- gsub(/\(c\)/, '\copyright{}')
244
-
245
- end
246
-
247
- def convert_special(special)
248
- handled = false
249
- Attribute.each_name_of(special.type) do |name|
250
- method_name = "handle_special_#{name}"
251
- if self.respond_to? method_name
252
- special.text = send(method_name, special)
253
- handled = true
254
- end
255
- end
256
- raise "Unhandled special: #{special}" unless handled
257
- special.text
258
- end
259
-
260
- def convert_heading(level, flow)
261
- res =
262
- case level
263
- when 1 then "\\chapter{"
264
- when 2 then "\\section{"
265
- when 3 then "\\subsection{"
266
- when 4 then "\\subsubsection{"
267
- else "\\paragraph{"
268
- end +
269
- convert_flow(flow) +
270
- "}\n"
271
- end
272
-
273
- def list_name(list_type, is_open_tag)
274
- tags = LIST_TYPE_TO_LATEX[list_type] || raise("Invalid list type: #{list_type.inspect}")
275
- if tags[2] # enumerate
276
- if is_open_tag
277
- @list_depth += 1
278
- if @prev_list_types[@list_depth] != tags[2]
279
- case @list_depth
280
- when 1
281
- roman = "i"
282
- when 2
283
- roman = "ii"
284
- when 3
285
- roman = "iii"
286
- when 4
287
- roman = "iv"
288
- else
289
- raise("Too deep list: level #{@list_depth}")
290
- end
291
- @prev_list_types[@list_depth] = tags[2]
292
- return l("\\renewcommand{\\labelenum#{roman}}{#{tags[2]}{enum#{roman}}}") + "\n" + tags[0]
293
- end
294
- else
295
- @list_depth -= 1
296
- end
297
- end
298
- tags[ is_open_tag ? 0 : 1]
299
- end
300
-
301
- def list_item_start(am, fragment)
302
- case fragment.type
303
- when :BULLET, :NUMBER, :UPPERALPHA, :LOWERALPHA then
304
- "\\item "
305
-
306
- when :LABELED then
307
- "\\item[" + convert_flow(am.flow(fragment.param)) + "] "
308
-
309
- when :NOTE then
310
- convert_flow(am.flow(fragment.param)) + " & "
311
- else
312
- raise "Invalid list type"
313
- end
314
- end
315
-
316
- def list_end_for(fragment_type)
317
- case fragment_type
318
- when :BULLET, :NUMBER, :UPPERALPHA, :LOWERALPHA, :LABELED then
319
- ""
320
- when :NOTE
321
- "\\\\\n"
322
- else
323
- raise "Invalid list type"
324
- end
325
- end
326
-
327
- end
328
-
@@ -1,53 +0,0 @@
1
- require 'rdoc/markup'
2
- require 'rdoc/markup/formatter'
3
-
4
- ##
5
- # This Markup outputter is used for testing purposes.
6
-
7
- class RDoc::Markup::ToTest < RDoc::Markup::Formatter
8
-
9
- ##
10
- # :section: Visitor
11
-
12
- def start_accepting
13
- @res = []
14
- end
15
-
16
- def end_accepting
17
- @res
18
- end
19
-
20
- def accept_paragraph(am, fragment)
21
- @res << fragment.to_s
22
- end
23
-
24
- def accept_verbatim(am, fragment)
25
- @res << fragment.to_s
26
- end
27
-
28
- def accept_list_start(am, fragment)
29
- @res << fragment.to_s
30
- end
31
-
32
- def accept_list_end(am, fragment)
33
- @res << fragment.to_s
34
- end
35
-
36
- def accept_list_item(am, fragment)
37
- @res << fragment.to_s
38
- end
39
-
40
- def accept_blank_line(am, fragment)
41
- @res << fragment.to_s
42
- end
43
-
44
- def accept_heading(am, fragment)
45
- @res << fragment.to_s
46
- end
47
-
48
- def accept_rule(am, fragment)
49
- @res << fragment.to_s
50
- end
51
-
52
- end
53
-
@@ -1,73 +0,0 @@
1
- require 'rdoc/markup/formatter'
2
- require 'rdoc/markup/fragments'
3
- require 'rdoc/markup/inline'
4
-
5
- require 'rdoc/markup'
6
- require 'rdoc/markup/formatter'
7
-
8
- ##
9
- # Convert SimpleMarkup to basic TexInfo format
10
- #
11
- # TODO: WTF is AttributeManager for?
12
-
13
- class RDoc::Markup::ToTexInfo < RDoc::Markup::Formatter
14
-
15
- def format(text)
16
- text.txt.
17
- gsub(/@/, "@@").
18
- gsub(/\{/, "@{").
19
- gsub(/\}/, "@}").
20
- # gsub(/,/, "@,"). # technically only required in cross-refs
21
- gsub(/\+([\w]+)\+/, "@code{\\1}").
22
- gsub(/\<tt\>([^<]+)\<\/tt\>/, "@code{\\1}").
23
- gsub(/\*([\w]+)\*/, "@strong{\\1}").
24
- gsub(/\<b\>([^<]+)\<\/b\>/, "@strong{\\1}").
25
- gsub(/_([\w]+)_/, "@emph{\\1}").
26
- gsub(/\<em\>([^<]+)\<\/em\>/, "@emph{\\1}")
27
- end
28
-
29
- # :section: Visitor
30
-
31
- def start_accepting
32
- @text = []
33
- end
34
-
35
- def end_accepting
36
- @text.join("\n")
37
- end
38
-
39
- def accept_paragraph(attributes, text)
40
- @text << format(text)
41
- end
42
-
43
- def accept_verbatim(attributes, text)
44
- @text << "@verb{|#{format(text)}|}"
45
- end
46
-
47
- def accept_heading(attributes, text)
48
- heading = ['@majorheading', '@chapheading'][text.head_level - 1] || '@heading'
49
- @text << "#{heading} #{format(text)}"
50
- end
51
-
52
- def accept_list_start(attributes, text)
53
- @text << '@itemize @bullet'
54
- end
55
-
56
- def accept_list_end(attributes, text)
57
- @text << '@end itemize'
58
- end
59
-
60
- def accept_list_item(attributes, text)
61
- @text << "@item\n#{format(text)}"
62
- end
63
-
64
- def accept_blank_line(attributes, text)
65
- @text << "\n"
66
- end
67
-
68
- def accept_rule(attributes, text)
69
- @text << '-----'
70
- end
71
-
72
- end
73
-