voloko-sdoc 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/rdoc/History.txt +254 -0
- data/rdoc/Manifest.txt +126 -0
- data/rdoc/README.txt +47 -0
- data/rdoc/RI.txt +58 -0
- data/rdoc/Rakefile +70 -0
- data/rdoc/bin/rdoc +35 -0
- data/rdoc/bin/ri +5 -0
- data/rdoc/lib/rdoc/alias.rb +54 -0
- data/rdoc/lib/rdoc/anon_class.rb +10 -0
- data/rdoc/lib/rdoc/any_method.rb +190 -0
- data/rdoc/lib/rdoc/attr.rb +79 -0
- data/rdoc/lib/rdoc/cache.rb +41 -0
- data/rdoc/lib/rdoc/class_module.rb +87 -0
- data/rdoc/lib/rdoc/code_object.rb +152 -0
- data/rdoc/lib/rdoc/code_objects.rb +23 -0
- data/rdoc/lib/rdoc/constant.rb +36 -0
- data/rdoc/lib/rdoc/context.rb +712 -0
- data/rdoc/lib/rdoc/diagram.rb +340 -0
- data/rdoc/lib/rdoc/dot.rb +249 -0
- data/rdoc/lib/rdoc/generator/darkfish.rb +455 -0
- data/rdoc/lib/rdoc/generator/markup.rb +194 -0
- data/rdoc/lib/rdoc/generator/ri.rb +230 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +281 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +112 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +64 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
- data/rdoc/lib/rdoc/generator.rb +8 -0
- data/rdoc/lib/rdoc/ghost_method.rb +8 -0
- data/rdoc/lib/rdoc/include.rb +39 -0
- data/rdoc/lib/rdoc/known_classes.rb +68 -0
- data/rdoc/lib/rdoc/markup/attribute_manager.rb +311 -0
- data/rdoc/lib/rdoc/markup/formatter.rb +25 -0
- data/rdoc/lib/rdoc/markup/fragments.rb +377 -0
- data/rdoc/lib/rdoc/markup/inline.rb +126 -0
- data/rdoc/lib/rdoc/markup/lines.rb +156 -0
- data/rdoc/lib/rdoc/markup/preprocess.rb +80 -0
- data/rdoc/lib/rdoc/markup/to_flow.rb +211 -0
- data/rdoc/lib/rdoc/markup/to_html.rb +406 -0
- data/rdoc/lib/rdoc/markup/to_html_crossref.rb +140 -0
- data/rdoc/lib/rdoc/markup/to_latex.rb +328 -0
- data/rdoc/lib/rdoc/markup/to_test.rb +53 -0
- data/rdoc/lib/rdoc/markup/to_texinfo.rb +73 -0
- data/rdoc/lib/rdoc/markup.rb +378 -0
- data/rdoc/lib/rdoc/meta_method.rb +8 -0
- data/rdoc/lib/rdoc/normal_class.rb +18 -0
- data/rdoc/lib/rdoc/normal_module.rb +34 -0
- data/rdoc/lib/rdoc/options.rb +542 -0
- data/rdoc/lib/rdoc/parser/c.rb +678 -0
- data/rdoc/lib/rdoc/parser/perl.rb +165 -0
- data/rdoc/lib/rdoc/parser/ruby.rb +2904 -0
- data/rdoc/lib/rdoc/parser/simple.rb +39 -0
- data/rdoc/lib/rdoc/parser.rb +138 -0
- data/rdoc/lib/rdoc/rdoc.rb +375 -0
- data/rdoc/lib/rdoc/require.rb +32 -0
- data/rdoc/lib/rdoc/ri/cache.rb +187 -0
- data/rdoc/lib/rdoc/ri/descriptions.rb +156 -0
- data/rdoc/lib/rdoc/ri/display.rb +340 -0
- data/rdoc/lib/rdoc/ri/driver.rb +828 -0
- data/rdoc/lib/rdoc/ri/formatter.rb +654 -0
- data/rdoc/lib/rdoc/ri/paths.rb +93 -0
- data/rdoc/lib/rdoc/ri/reader.rb +106 -0
- data/rdoc/lib/rdoc/ri/util.rb +79 -0
- data/rdoc/lib/rdoc/ri/writer.rb +68 -0
- data/rdoc/lib/rdoc/ri.rb +8 -0
- data/rdoc/lib/rdoc/single_class.rb +8 -0
- data/rdoc/lib/rdoc/stats.rb +178 -0
- data/rdoc/lib/rdoc/task.rb +276 -0
- data/rdoc/lib/rdoc/tokenstream.rb +33 -0
- data/rdoc/lib/rdoc/top_level.rb +242 -0
- data/rdoc/lib/rdoc.rb +398 -0
- metadata +1 -1
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rdoc/code_object'
|
2
|
+
|
3
|
+
##
|
4
|
+
# A Module include in a class with \#include
|
5
|
+
|
6
|
+
class RDoc::Include < RDoc::CodeObject
|
7
|
+
|
8
|
+
##
|
9
|
+
# Name of included module
|
10
|
+
|
11
|
+
attr_accessor :name
|
12
|
+
|
13
|
+
##
|
14
|
+
# Creates a new Include for +name+ with +comment+
|
15
|
+
|
16
|
+
def initialize(name, comment)
|
17
|
+
super()
|
18
|
+
@name = name
|
19
|
+
self.comment = comment
|
20
|
+
end
|
21
|
+
|
22
|
+
def inspect # :nodoc:
|
23
|
+
"#<%s:0x%x %s.include %s>" % [
|
24
|
+
self.class,
|
25
|
+
object_id,
|
26
|
+
parent_name, @name,
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Attempts to locate the included module object. Returns the name if not
|
32
|
+
# known.
|
33
|
+
|
34
|
+
def module
|
35
|
+
RDoc::TopLevel.find_module_named(@name) || @name
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module RDoc
|
2
|
+
|
3
|
+
##
|
4
|
+
# Ruby's built-in classes, modules and exceptions
|
5
|
+
|
6
|
+
KNOWN_CLASSES = {
|
7
|
+
"rb_cArray" => "Array",
|
8
|
+
"rb_cBignum" => "Bignum",
|
9
|
+
"rb_cClass" => "Class",
|
10
|
+
"rb_cData" => "Data",
|
11
|
+
"rb_cDir" => "Dir",
|
12
|
+
"rb_cFalseClass" => "FalseClass",
|
13
|
+
"rb_cFile" => "File",
|
14
|
+
"rb_cFixnum" => "Fixnum",
|
15
|
+
"rb_cFloat" => "Float",
|
16
|
+
"rb_cHash" => "Hash",
|
17
|
+
"rb_cIO" => "IO",
|
18
|
+
"rb_cInteger" => "Integer",
|
19
|
+
"rb_cModule" => "Module",
|
20
|
+
"rb_cNilClass" => "NilClass",
|
21
|
+
"rb_cNumeric" => "Numeric",
|
22
|
+
"rb_cObject" => "Object",
|
23
|
+
"rb_cProc" => "Proc",
|
24
|
+
"rb_cRange" => "Range",
|
25
|
+
"rb_cRegexp" => "Regexp",
|
26
|
+
"rb_cRubyVM" => "RubyVM",
|
27
|
+
"rb_cString" => "String",
|
28
|
+
"rb_cStruct" => "Struct",
|
29
|
+
"rb_cSymbol" => "Symbol",
|
30
|
+
"rb_cThread" => "Thread",
|
31
|
+
"rb_cTime" => "Time",
|
32
|
+
"rb_cTrueClass" => "TrueClass",
|
33
|
+
|
34
|
+
"rb_eArgError" => "ArgError",
|
35
|
+
"rb_eEOFError" => "EOFError",
|
36
|
+
"rb_eException" => "Exception",
|
37
|
+
"rb_eFatal" => "Fatal",
|
38
|
+
"rb_eFloatDomainError" => "FloatDomainError",
|
39
|
+
"rb_eIOError" => "IOError",
|
40
|
+
"rb_eIndexError" => "IndexError",
|
41
|
+
"rb_eInterrupt" => "Interrupt",
|
42
|
+
"rb_eLoadError" => "LoadError",
|
43
|
+
"rb_eNameError" => "NameError",
|
44
|
+
"rb_eNoMemError" => "NoMemError",
|
45
|
+
"rb_eNotImpError" => "NotImpError",
|
46
|
+
"rb_eRangeError" => "RangeError",
|
47
|
+
"rb_eRuntimeError" => "RuntimeError",
|
48
|
+
"rb_eScriptError" => "ScriptError",
|
49
|
+
"rb_eSecurityError" => "SecurityError",
|
50
|
+
"rb_eSignal" => "Signal",
|
51
|
+
"rb_eStandardError" => "StandardError",
|
52
|
+
"rb_eSyntaxError" => "SyntaxError",
|
53
|
+
"rb_eSystemCallError" => "SystemCallError",
|
54
|
+
"rb_eSystemExit" => "SystemExit",
|
55
|
+
"rb_eTypeError" => "TypeError",
|
56
|
+
"rb_eZeroDivError" => "ZeroDivError",
|
57
|
+
|
58
|
+
"rb_mComparable" => "Comparable",
|
59
|
+
"rb_mEnumerable" => "Enumerable",
|
60
|
+
"rb_mErrno" => "Errno",
|
61
|
+
"rb_mFileTest" => "FileTest",
|
62
|
+
"rb_mGC" => "GC",
|
63
|
+
"rb_mKernel" => "Kernel",
|
64
|
+
"rb_mMath" => "Math",
|
65
|
+
"rb_mProcess" => "Process"
|
66
|
+
}
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,311 @@
|
|
1
|
+
require 'rdoc/markup/inline'
|
2
|
+
|
3
|
+
##
|
4
|
+
# Manages changes of attributes in a block of text
|
5
|
+
|
6
|
+
class RDoc::Markup::AttributeManager
|
7
|
+
|
8
|
+
##
|
9
|
+
# The NUL character
|
10
|
+
|
11
|
+
NULL = "\000".freeze
|
12
|
+
|
13
|
+
##
|
14
|
+
# We work by substituting non-printing characters in to the text. For now
|
15
|
+
# I'm assuming that I can substitute a character in the range 0..8 for a 7
|
16
|
+
# bit character without damaging the encoded string, but this might be
|
17
|
+
# optimistic
|
18
|
+
|
19
|
+
A_PROTECT = 004
|
20
|
+
PROTECT_ATTR = A_PROTECT.chr
|
21
|
+
|
22
|
+
##
|
23
|
+
# This maps delimiters that occur around words (such as *bold* or +tt+)
|
24
|
+
# where the start and end delimiters and the same. This lets us optimize
|
25
|
+
# the regexp
|
26
|
+
|
27
|
+
MATCHING_WORD_PAIRS = {}
|
28
|
+
|
29
|
+
##
|
30
|
+
# And this is used when the delimiters aren't the same. In this case the
|
31
|
+
# hash maps a pattern to the attribute character
|
32
|
+
|
33
|
+
WORD_PAIR_MAP = {}
|
34
|
+
|
35
|
+
##
|
36
|
+
# This maps HTML tags to the corresponding attribute char
|
37
|
+
|
38
|
+
HTML_TAGS = {}
|
39
|
+
|
40
|
+
##
|
41
|
+
# And this maps _special_ sequences to a name. A special sequence is
|
42
|
+
# something like a WikiWord
|
43
|
+
|
44
|
+
SPECIAL = {}
|
45
|
+
|
46
|
+
##
|
47
|
+
# Return an attribute object with the given turn_on and turn_off bits set
|
48
|
+
|
49
|
+
def attribute(turn_on, turn_off)
|
50
|
+
RDoc::Markup::AttrChanger.new turn_on, turn_off
|
51
|
+
end
|
52
|
+
|
53
|
+
def change_attribute(current, new)
|
54
|
+
diff = current ^ new
|
55
|
+
attribute(new & diff, current & diff)
|
56
|
+
end
|
57
|
+
|
58
|
+
def changed_attribute_by_name(current_set, new_set)
|
59
|
+
current = new = 0
|
60
|
+
current_set.each do |name|
|
61
|
+
current |= RDoc::Markup::Attribute.bitmap_for(name)
|
62
|
+
end
|
63
|
+
|
64
|
+
new_set.each do |name|
|
65
|
+
new |= RDoc::Markup::Attribute.bitmap_for(name)
|
66
|
+
end
|
67
|
+
|
68
|
+
change_attribute(current, new)
|
69
|
+
end
|
70
|
+
|
71
|
+
def copy_string(start_pos, end_pos)
|
72
|
+
res = @str[start_pos...end_pos]
|
73
|
+
res.gsub!(/\000/, '')
|
74
|
+
res
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Map attributes like <b>text</b>to the sequence
|
79
|
+
# \001\002<char>\001\003<char>, where <char> is a per-attribute specific
|
80
|
+
# character
|
81
|
+
|
82
|
+
def convert_attrs(str, attrs)
|
83
|
+
# first do matching ones
|
84
|
+
tags = MATCHING_WORD_PAIRS.keys.join("")
|
85
|
+
|
86
|
+
re = /(^|\W)([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/
|
87
|
+
|
88
|
+
1 while str.gsub!(re) do
|
89
|
+
attr = MATCHING_WORD_PAIRS[$2]
|
90
|
+
attrs.set_attrs($`.length + $1.length + $2.length, $3.length, attr)
|
91
|
+
$1 + NULL * $2.length + $3 + NULL * $2.length + $4
|
92
|
+
end
|
93
|
+
|
94
|
+
# then non-matching
|
95
|
+
unless WORD_PAIR_MAP.empty? then
|
96
|
+
WORD_PAIR_MAP.each do |regexp, attr|
|
97
|
+
str.gsub!(regexp) {
|
98
|
+
attrs.set_attrs($`.length + $1.length, $2.length, attr)
|
99
|
+
NULL * $1.length + $2 + NULL * $3.length
|
100
|
+
}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# Converts HTML tags to RDoc attributes
|
107
|
+
|
108
|
+
def convert_html(str, attrs)
|
109
|
+
tags = HTML_TAGS.keys.join '|'
|
110
|
+
|
111
|
+
1 while str.gsub!(/<(#{tags})>(.*?)<\/\1>/i) {
|
112
|
+
attr = HTML_TAGS[$1.downcase]
|
113
|
+
html_length = $1.length + 2
|
114
|
+
seq = NULL * html_length
|
115
|
+
attrs.set_attrs($`.length + html_length, $2.length, attr)
|
116
|
+
seq + $2 + seq + NULL
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# Converts special sequences to RDoc attributes
|
122
|
+
|
123
|
+
def convert_specials(str, attrs)
|
124
|
+
unless SPECIAL.empty?
|
125
|
+
SPECIAL.each do |regexp, attr|
|
126
|
+
str.scan(regexp) do
|
127
|
+
attrs.set_attrs($`.length, $&.length,
|
128
|
+
attr | RDoc::Markup::Attribute::SPECIAL)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# A \ in front of a character that would normally be processed turns off
|
136
|
+
# processing. We do this by turning \< into <#{PROTECT}
|
137
|
+
|
138
|
+
PROTECTABLE = %w[<\\]
|
139
|
+
|
140
|
+
##
|
141
|
+
# Escapes special sequences of text to prevent conversion to RDoc
|
142
|
+
|
143
|
+
def mask_protected_sequences
|
144
|
+
protect_pattern = Regexp.new("\\\\([#{Regexp.escape(PROTECTABLE.join(''))}])")
|
145
|
+
@str.gsub!(protect_pattern, "\\1#{PROTECT_ATTR}")
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# Unescapes special sequences of text
|
150
|
+
|
151
|
+
def unmask_protected_sequences
|
152
|
+
@str.gsub!(/(.)#{PROTECT_ATTR}/, "\\1\000")
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Creates a new attribute manager that understands bold, emphasized and
|
157
|
+
# teletype text.
|
158
|
+
|
159
|
+
def initialize
|
160
|
+
add_word_pair("*", "*", :BOLD)
|
161
|
+
add_word_pair("_", "_", :EM)
|
162
|
+
add_word_pair("+", "+", :TT)
|
163
|
+
|
164
|
+
add_html("em", :EM)
|
165
|
+
add_html("i", :EM)
|
166
|
+
add_html("b", :BOLD)
|
167
|
+
add_html("tt", :TT)
|
168
|
+
add_html("code", :TT)
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Adds a markup class with +name+ for words wrapped in the +start+ and
|
173
|
+
# +stop+ character. To make words wrapped with "*" bold:
|
174
|
+
#
|
175
|
+
# am.add_word_pair '*', '*', :BOLD
|
176
|
+
|
177
|
+
def add_word_pair(start, stop, name)
|
178
|
+
raise ArgumentError, "Word flags may not start with '<'" if
|
179
|
+
start[0,1] == '<'
|
180
|
+
|
181
|
+
bitmap = RDoc::Markup::Attribute.bitmap_for name
|
182
|
+
|
183
|
+
if start == stop then
|
184
|
+
MATCHING_WORD_PAIRS[start] = bitmap
|
185
|
+
else
|
186
|
+
pattern = /(#{Regexp.escape start})(\S+)(#{Regexp.escape stop})/
|
187
|
+
WORD_PAIR_MAP[pattern] = bitmap
|
188
|
+
end
|
189
|
+
|
190
|
+
PROTECTABLE << start[0,1]
|
191
|
+
PROTECTABLE.uniq!
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# Adds a markup class with +name+ for words surrounded by HTML tag +tag+.
|
196
|
+
# To process emphasis tags:
|
197
|
+
#
|
198
|
+
# am.add_html 'em', :EM
|
199
|
+
|
200
|
+
def add_html(tag, name)
|
201
|
+
HTML_TAGS[tag.downcase] = RDoc::Markup::Attribute.bitmap_for name
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# Adds a special handler for +pattern+ with +name+. A simple URL handler
|
206
|
+
# would be:
|
207
|
+
#
|
208
|
+
# @am.add_special(/((https?:)\S+\w)/, :HYPERLINK)
|
209
|
+
|
210
|
+
def add_special(pattern, name)
|
211
|
+
SPECIAL[pattern] = RDoc::Markup::Attribute.bitmap_for name
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
# Processes +str+ converting attributes, HTML and specials
|
216
|
+
|
217
|
+
def flow(str)
|
218
|
+
@str = str
|
219
|
+
|
220
|
+
mask_protected_sequences
|
221
|
+
|
222
|
+
@attrs = RDoc::Markup::AttrSpan.new @str.length
|
223
|
+
|
224
|
+
convert_attrs(@str, @attrs)
|
225
|
+
convert_html(@str, @attrs)
|
226
|
+
convert_specials(str, @attrs)
|
227
|
+
|
228
|
+
unmask_protected_sequences
|
229
|
+
|
230
|
+
split_into_flow
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# Debug method that prints a string along with its attributes
|
235
|
+
|
236
|
+
def display_attributes
|
237
|
+
puts
|
238
|
+
puts @str.tr(NULL, "!")
|
239
|
+
bit = 1
|
240
|
+
16.times do |bno|
|
241
|
+
line = ""
|
242
|
+
@str.length.times do |i|
|
243
|
+
if (@attrs[i] & bit) == 0
|
244
|
+
line << " "
|
245
|
+
else
|
246
|
+
if bno.zero?
|
247
|
+
line << "S"
|
248
|
+
else
|
249
|
+
line << ("%d" % (bno+1))
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
puts(line) unless line =~ /^ *$/
|
254
|
+
bit <<= 1
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
def split_into_flow
|
259
|
+
res = []
|
260
|
+
current_attr = 0
|
261
|
+
str = ""
|
262
|
+
|
263
|
+
str_len = @str.length
|
264
|
+
|
265
|
+
# skip leading invisible text
|
266
|
+
i = 0
|
267
|
+
i += 1 while i < str_len and @str[i].chr == "\0"
|
268
|
+
start_pos = i
|
269
|
+
|
270
|
+
# then scan the string, chunking it on attribute changes
|
271
|
+
while i < str_len
|
272
|
+
new_attr = @attrs[i]
|
273
|
+
if new_attr != current_attr
|
274
|
+
if i > start_pos
|
275
|
+
res << copy_string(start_pos, i)
|
276
|
+
start_pos = i
|
277
|
+
end
|
278
|
+
|
279
|
+
res << change_attribute(current_attr, new_attr)
|
280
|
+
current_attr = new_attr
|
281
|
+
|
282
|
+
if (current_attr & RDoc::Markup::Attribute::SPECIAL) != 0 then
|
283
|
+
i += 1 while
|
284
|
+
i < str_len and (@attrs[i] & RDoc::Markup::Attribute::SPECIAL) != 0
|
285
|
+
|
286
|
+
res << RDoc::Markup::Special.new(current_attr,
|
287
|
+
copy_string(start_pos, i))
|
288
|
+
start_pos = i
|
289
|
+
next
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# move on, skipping any invisible characters
|
294
|
+
begin
|
295
|
+
i += 1
|
296
|
+
end while i < str_len and @str[i].chr == "\0"
|
297
|
+
end
|
298
|
+
|
299
|
+
# tidy up trailing text
|
300
|
+
if start_pos < str_len
|
301
|
+
res << copy_string(start_pos, str_len)
|
302
|
+
end
|
303
|
+
|
304
|
+
# and reset to all attributes off
|
305
|
+
res << change_attribute(current_attr, 0) if current_attr != 0
|
306
|
+
|
307
|
+
res
|
308
|
+
end
|
309
|
+
|
310
|
+
end
|
311
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rdoc/markup'
|
2
|
+
|
3
|
+
##
|
4
|
+
# Base class for RDoc markup formatters
|
5
|
+
#
|
6
|
+
# Formatters use a visitor pattern to convert content into output.
|
7
|
+
|
8
|
+
class RDoc::Markup::Formatter
|
9
|
+
|
10
|
+
##
|
11
|
+
# Creates a new Formatter
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@markup = RDoc::Markup.new
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Marks up +content+
|
19
|
+
|
20
|
+
def convert(content)
|
21
|
+
@markup.convert content, self
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|