rdoc 2.4.3 → 2.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +3 -1
- data/History.txt +68 -0
- data/LICENSE.txt +57 -0
- data/Manifest.txt +37 -19
- data/README.txt +2 -12
- data/Rakefile +12 -12
- data/bin/rdoc +4 -4
- data/lib/rdoc.rb +32 -9
- data/lib/rdoc/alias.rb +2 -2
- data/lib/rdoc/any_method.rb +108 -16
- data/lib/rdoc/attr.rb +87 -1
- data/lib/rdoc/class_module.rb +131 -5
- data/lib/rdoc/code_object.rb +28 -5
- data/lib/rdoc/constant.rb +22 -0
- data/lib/rdoc/context.rb +80 -37
- data/lib/rdoc/gauntlet.rb +48 -0
- data/lib/rdoc/generator/darkfish.rb +25 -23
- data/lib/rdoc/generator/markup.rb +6 -29
- data/lib/rdoc/generator/ri.rb +39 -189
- data/lib/rdoc/generator/template/darkfish/classpage.rhtml +17 -1
- data/lib/rdoc/generator/template/darkfish/filepage.rhtml +10 -0
- data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/rdoc.css +38 -33
- data/lib/rdoc/include.rb +22 -0
- data/lib/rdoc/markup.rb +10 -262
- data/lib/rdoc/markup/attribute_manager.rb +57 -50
- data/lib/rdoc/markup/blank_line.rb +19 -0
- data/lib/rdoc/markup/document.rb +72 -0
- data/lib/rdoc/markup/formatter.rb +118 -0
- data/lib/rdoc/markup/formatter_test_case.rb +341 -0
- data/lib/rdoc/markup/heading.rb +17 -0
- data/lib/rdoc/markup/inline.rb +6 -5
- data/lib/rdoc/markup/list.rb +78 -0
- data/lib/rdoc/markup/list_item.rb +83 -0
- data/lib/rdoc/markup/paragraph.rb +66 -0
- data/lib/rdoc/markup/parser.rb +528 -0
- data/lib/rdoc/markup/rule.rb +17 -0
- data/lib/rdoc/markup/to_ansi.rb +72 -0
- data/lib/rdoc/markup/to_bs.rb +74 -0
- data/lib/rdoc/markup/to_html.rb +106 -172
- data/lib/rdoc/markup/to_html_crossref.rb +10 -4
- data/lib/rdoc/markup/to_rdoc.rb +243 -0
- data/lib/rdoc/markup/to_test.rb +27 -16
- data/lib/rdoc/markup/verbatim.rb +42 -0
- data/lib/rdoc/normal_class.rb +38 -1
- data/lib/rdoc/normal_module.rb +38 -8
- data/lib/rdoc/options.rb +39 -151
- data/lib/rdoc/parser.rb +36 -18
- data/lib/rdoc/parser/c.rb +102 -109
- data/lib/rdoc/parser/ruby.rb +359 -1662
- data/lib/rdoc/parser/ruby_tools.rb +157 -0
- data/lib/rdoc/parser/simple.rb +0 -2
- data/lib/rdoc/rdoc.rb +142 -82
- data/lib/rdoc/ri.rb +10 -0
- data/lib/rdoc/ri/driver.rb +674 -444
- data/lib/rdoc/ri/formatter.rb +2 -651
- data/lib/rdoc/ri/paths.rb +70 -45
- data/lib/rdoc/ri/store.rb +248 -0
- data/lib/rdoc/ruby_lex.rb +1284 -0
- data/lib/rdoc/ruby_token.rb +416 -0
- data/lib/rdoc/single_class.rb +5 -0
- data/lib/rdoc/stats.rb +152 -83
- data/lib/rdoc/task.rb +27 -49
- data/lib/rdoc/text.rb +130 -0
- data/lib/rdoc/tokenstream.rb +28 -9
- data/lib/rdoc/top_level.rb +49 -43
- data/test/hidden.zip.txt +1 -0
- data/test/test_attribute_manager.rb +9 -16
- data/test/test_rdoc_any_method.rb +23 -0
- data/test/test_rdoc_attr.rb +40 -0
- data/test/test_rdoc_class_module.rb +100 -0
- data/test/test_rdoc_code_object.rb +18 -2
- data/test/test_rdoc_context.rb +41 -0
- data/test/test_rdoc_generator_ri.rb +56 -0
- data/test/test_rdoc_markup.rb +21 -610
- data/test/test_rdoc_markup_attribute_manager.rb +14 -17
- data/test/test_rdoc_markup_document.rb +51 -0
- data/test/test_rdoc_markup_paragraph.rb +27 -0
- data/test/test_rdoc_markup_parser.rb +1327 -0
- data/test/test_rdoc_markup_to_ansi.rb +426 -0
- data/test/test_rdoc_markup_to_bs.rb +443 -0
- data/test/test_rdoc_markup_to_html.rb +183 -18
- data/test/test_rdoc_markup_to_html_crossref.rb +1 -3
- data/test/test_rdoc_markup_to_rdoc.rb +426 -0
- data/test/test_rdoc_normal_class.rb +17 -0
- data/test/test_rdoc_normal_module.rb +6 -6
- data/test/test_rdoc_options.rb +41 -0
- data/test/test_rdoc_parser.rb +66 -13
- data/test/test_rdoc_parser_c.rb +93 -38
- data/test/test_rdoc_parser_perl.rb +2 -3
- data/test/test_rdoc_parser_ruby.rb +291 -28
- data/test/test_rdoc_parser_simple.rb +48 -0
- data/test/test_rdoc_rdoc.rb +66 -0
- data/test/test_rdoc_ri_driver.rb +752 -38
- data/test/test_rdoc_ri_paths.rb +39 -0
- data/test/test_rdoc_ri_store.rb +309 -0
- data/test/test_rdoc_text.rb +157 -0
- data/test/test_rdoc_top_level.rb +35 -9
- data/test/xref_data.rb +9 -1
- data/test/xref_test_case.rb +8 -3
- metadata +110 -38
- metadata.gz.sig +0 -0
- data/lib/rdoc/cache.rb +0 -41
- data/lib/rdoc/diagram.rb +0 -340
- data/lib/rdoc/dot.rb +0 -249
- data/lib/rdoc/markup/fragments.rb +0 -377
- data/lib/rdoc/markup/lines.rb +0 -156
- data/lib/rdoc/markup/to_flow.rb +0 -211
- data/lib/rdoc/markup/to_latex.rb +0 -328
- data/lib/rdoc/markup/to_texinfo.rb +0 -73
- data/lib/rdoc/ri/cache.rb +0 -187
- data/lib/rdoc/ri/descriptions.rb +0 -156
- data/lib/rdoc/ri/display.rb +0 -340
- data/lib/rdoc/ri/reader.rb +0 -106
- data/lib/rdoc/ri/util.rb +0 -79
- data/lib/rdoc/ri/writer.rb +0 -68
- data/test/test_rdoc_ri_attribute_formatter.rb +0 -44
- data/test/test_rdoc_ri_default_display.rb +0 -302
- data/test/test_rdoc_ri_formatter.rb +0 -320
- data/test/test_rdoc_ri_html_formatter.rb +0 -141
- data/test/test_rdoc_ri_overstrike_formatter.rb +0 -71
@@ -11,7 +11,7 @@
|
|
11
11
|
*{ padding: 0; margin: 0; }
|
12
12
|
|
13
13
|
body {
|
14
|
-
|
14
|
+
background: #efefef;
|
15
15
|
font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif;
|
16
16
|
}
|
17
17
|
body.class, body.module, body.file {
|
@@ -29,11 +29,13 @@ h1 {
|
|
29
29
|
}
|
30
30
|
h2,h3,h4 { margin-top: 1.5em; }
|
31
31
|
|
32
|
-
|
32
|
+
:link,
|
33
|
+
:visited {
|
33
34
|
color: #6C8C22;
|
34
35
|
text-decoration: none;
|
35
36
|
}
|
36
|
-
|
37
|
+
:link:hover,
|
38
|
+
:visited:hover {
|
37
39
|
border-bottom: 1px dotted #6C8C22;
|
38
40
|
}
|
39
41
|
|
@@ -100,8 +102,10 @@ body.file p {
|
|
100
102
|
line-height: 160%;
|
101
103
|
list-style: none;
|
102
104
|
}
|
103
|
-
.indexpage ul
|
104
|
-
.
|
105
|
+
.indexpage ul :link,
|
106
|
+
.indexpage ul :visited,
|
107
|
+
.file #documentation ul :link,
|
108
|
+
.file #documentation ul :visited {
|
105
109
|
font-size: 16px;
|
106
110
|
}
|
107
111
|
|
@@ -119,6 +123,10 @@ body.file p {
|
|
119
123
|
.indexpage li.file {
|
120
124
|
background: url(images/page_white_text.png) no-repeat left 4px;
|
121
125
|
}
|
126
|
+
.file li p,
|
127
|
+
.indexpage li p {
|
128
|
+
margin: 0 0;
|
129
|
+
}
|
122
130
|
|
123
131
|
/* @end */
|
124
132
|
|
@@ -170,6 +178,10 @@ body.file p {
|
|
170
178
|
-webkit-border-top-right-radius: 4px;
|
171
179
|
border-bottom: 1px solid #aaa;
|
172
180
|
}
|
181
|
+
#metadata #home-section h3.section-header {
|
182
|
+
border-bottom: 0;
|
183
|
+
}
|
184
|
+
|
173
185
|
#metadata ul,
|
174
186
|
#metadata dl,
|
175
187
|
#metadata p {
|
@@ -340,9 +352,6 @@ ul.link-list .type {
|
|
340
352
|
#documentation .method-detail:hover {
|
341
353
|
background-color: #f1edba;
|
342
354
|
}
|
343
|
-
#documentation .method-alias {
|
344
|
-
font-style: oblique;
|
345
|
-
}
|
346
355
|
#documentation .method-heading {
|
347
356
|
position: relative;
|
348
357
|
padding: 2px 4px 0 20px;
|
@@ -351,7 +360,8 @@ ul.link-list .type {
|
|
351
360
|
color: #333;
|
352
361
|
background: url(images/brick.png) no-repeat left bottom;
|
353
362
|
}
|
354
|
-
#documentation .method-heading
|
363
|
+
#documentation .method-heading :link,
|
364
|
+
#documentation .method-heading :visited {
|
355
365
|
color: inherit;
|
356
366
|
}
|
357
367
|
#documentation .method-click-advice {
|
@@ -413,13 +423,6 @@ ul.link-list .type {
|
|
413
423
|
|
414
424
|
/* @group Source Code */
|
415
425
|
|
416
|
-
a.source-toggle {
|
417
|
-
font-size: 90%;
|
418
|
-
}
|
419
|
-
a.source-toggle img {
|
420
|
-
|
421
|
-
}
|
422
|
-
|
423
426
|
div.method-source-code {
|
424
427
|
background: #262626;
|
425
428
|
color: #efefef;
|
@@ -433,22 +436,20 @@ div.method-source-code pre {
|
|
433
436
|
background: inherit;
|
434
437
|
padding: 0;
|
435
438
|
color: white;
|
436
|
-
overflow:
|
439
|
+
overflow: auto;
|
437
440
|
}
|
438
441
|
|
439
442
|
/* @group Ruby keyword styles */
|
440
443
|
|
441
|
-
.
|
442
|
-
|
443
|
-
.ruby-
|
444
|
-
.ruby-
|
445
|
-
.ruby-ivar { color: #eedd82; background: transparent; }
|
446
|
-
.ruby-operator { color: #00ffee; background: transparent; }
|
444
|
+
.ruby-constant { color: #7fffd4; background: transparent; }
|
445
|
+
.ruby-keyword { color: #00ffff; background: transparent; }
|
446
|
+
.ruby-ivar { color: #eedd82; background: transparent; }
|
447
|
+
.ruby-operator { color: #00ffee; background: transparent; }
|
447
448
|
.ruby-identifier { color: #ffdead; background: transparent; }
|
448
|
-
.ruby-node
|
449
|
-
.ruby-comment
|
450
|
-
.ruby-regexp
|
451
|
-
.ruby-value
|
449
|
+
.ruby-node { color: #ffa07a; background: transparent; }
|
450
|
+
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
|
451
|
+
.ruby-regexp { color: #ffa07a; background: transparent; }
|
452
|
+
.ruby-value { color: #7fffd4; background: transparent; }
|
452
453
|
|
453
454
|
/* @end */
|
454
455
|
/* @end */
|
@@ -524,11 +525,14 @@ div.method-source-code pre {
|
|
524
525
|
color:#666666;
|
525
526
|
}
|
526
527
|
|
527
|
-
#TB_window
|
528
|
-
#TB_window
|
529
|
-
#TB_window
|
530
|
-
#TB_window
|
531
|
-
#TB_window
|
528
|
+
#TB_window :link,
|
529
|
+
#TB_window :visited { color: #666666; }
|
530
|
+
#TB_window :link:hover,
|
531
|
+
#TB_window :visited:hover { color: #000; }
|
532
|
+
#TB_window :link:active,
|
533
|
+
#TB_window :visited:active { color: #666666; }
|
534
|
+
#TB_window :link:focus,
|
535
|
+
#TB_window :visited:focus { color: #666666; }
|
532
536
|
|
533
537
|
#TB_overlay {
|
534
538
|
position: fixed;
|
@@ -609,7 +613,8 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
|
|
609
613
|
color: #dedede;
|
610
614
|
height:40px;
|
611
615
|
}
|
612
|
-
#TB_title
|
616
|
+
#TB_title :link,
|
617
|
+
#TB_title :visited {
|
613
618
|
color: white !important;
|
614
619
|
border-bottom: 1px dotted #dedede;
|
615
620
|
}
|
data/lib/rdoc/include.rb
CHANGED
@@ -19,6 +19,28 @@ class RDoc::Include < RDoc::CodeObject
|
|
19
19
|
self.comment = comment
|
20
20
|
end
|
21
21
|
|
22
|
+
##
|
23
|
+
# Includes are sorted by name
|
24
|
+
|
25
|
+
def <=> other
|
26
|
+
return unless self.class === other
|
27
|
+
|
28
|
+
name <=> other.name
|
29
|
+
end
|
30
|
+
|
31
|
+
def == other # :nodoc:
|
32
|
+
self.class == other.class and
|
33
|
+
self.name == other.name
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Full name based on #module
|
38
|
+
|
39
|
+
def full_name
|
40
|
+
m = self.module
|
41
|
+
RDoc::ClassModule === m ? m.full_name : @name
|
42
|
+
end
|
43
|
+
|
22
44
|
def inspect # :nodoc:
|
23
45
|
"#<%s:0x%x %s.include %s>" % [
|
24
46
|
self.class,
|
data/lib/rdoc/markup.rb
CHANGED
@@ -65,30 +65,7 @@ require 'rdoc'
|
|
65
65
|
|
66
66
|
class RDoc::Markup
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
# List entries look like:
|
71
|
-
# * text
|
72
|
-
# 1. text
|
73
|
-
# [label] text
|
74
|
-
# label:: text
|
75
|
-
#
|
76
|
-
# Flag it as a list entry, and work out the indent for subsequent lines
|
77
|
-
|
78
|
-
SIMPLE_LIST_RE = /^(
|
79
|
-
( \* (?# bullet)
|
80
|
-
|- (?# bullet)
|
81
|
-
|\d+\. (?# numbered )
|
82
|
-
|[A-Za-z]\. (?# alphabetically numbered )
|
83
|
-
)
|
84
|
-
\s+
|
85
|
-
)\S/x
|
86
|
-
|
87
|
-
LABEL_LIST_RE = /^(
|
88
|
-
( \[.*?\] (?# labeled )
|
89
|
-
|\S.*:: (?# note )
|
90
|
-
)(?:\s+|$)
|
91
|
-
)/x
|
68
|
+
attr_reader :attribute_manager
|
92
69
|
|
93
70
|
##
|
94
71
|
# Take a block of text and use various heuristics to determine it's
|
@@ -96,7 +73,7 @@ class RDoc::Markup
|
|
96
73
|
# identify significant chunks.
|
97
74
|
|
98
75
|
def initialize
|
99
|
-
@
|
76
|
+
@attribute_manager = RDoc::Markup::AttributeManager.new
|
100
77
|
@output = nil
|
101
78
|
end
|
102
79
|
|
@@ -106,14 +83,14 @@ class RDoc::Markup
|
|
106
83
|
# formatters can recognize by their +name+.
|
107
84
|
|
108
85
|
def add_word_pair(start, stop, name)
|
109
|
-
@
|
86
|
+
@attribute_manager.add_word_pair(start, stop, name)
|
110
87
|
end
|
111
88
|
|
112
89
|
##
|
113
90
|
# Add to the sequences recognized as general markup.
|
114
91
|
|
115
92
|
def add_html(tag, name)
|
116
|
-
@
|
93
|
+
@attribute_manager.add_html(tag, name)
|
117
94
|
end
|
118
95
|
|
119
96
|
##
|
@@ -126,7 +103,7 @@ class RDoc::Markup
|
|
126
103
|
# accept_special method.
|
127
104
|
|
128
105
|
def add_special(pattern, name)
|
129
|
-
@
|
106
|
+
@attribute_manager.add_special(pattern, name)
|
130
107
|
end
|
131
108
|
|
132
109
|
##
|
@@ -136,243 +113,14 @@ class RDoc::Markup
|
|
136
113
|
# display the result.
|
137
114
|
|
138
115
|
def convert(str, op)
|
139
|
-
|
140
|
-
@lines = Lines.new lines
|
141
|
-
|
142
|
-
return "" if @lines.empty?
|
143
|
-
@lines.normalize
|
144
|
-
assign_types_to_lines
|
145
|
-
group = group_lines
|
146
|
-
# call the output formatter to handle the result
|
147
|
-
#group.each { |line| p line }
|
148
|
-
group.accept @am, op
|
149
|
-
end
|
150
|
-
|
151
|
-
private
|
152
|
-
|
153
|
-
##
|
154
|
-
# Look through the text at line indentation. We flag each line as being
|
155
|
-
# Blank, a paragraph, a list element, or verbatim text.
|
156
|
-
|
157
|
-
def assign_types_to_lines(margin = 0, level = 0)
|
158
|
-
while line = @lines.next
|
159
|
-
if line.blank? then
|
160
|
-
line.stamp :BLANK, level
|
161
|
-
next
|
162
|
-
end
|
163
|
-
|
164
|
-
# if a line contains non-blanks before the margin, then it must belong
|
165
|
-
# to an outer level
|
166
|
-
|
167
|
-
text = line.text
|
168
|
-
|
169
|
-
for i in 0...margin
|
170
|
-
if text[i] != SPACE
|
171
|
-
@lines.unget
|
172
|
-
return
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
active_line = text[margin..-1]
|
177
|
-
|
178
|
-
# Rules (horizontal lines) look like
|
179
|
-
#
|
180
|
-
# --- (three or more hyphens)
|
181
|
-
#
|
182
|
-
# The more hyphens, the thicker the rule
|
183
|
-
#
|
116
|
+
document = RDoc::Markup::Parser.parse str
|
184
117
|
|
185
|
-
|
186
|
-
line.stamp :RULE, level, $1.length-2
|
187
|
-
next
|
188
|
-
end
|
189
|
-
|
190
|
-
# Then look for list entries. First the ones that have to have
|
191
|
-
# text following them (* xxx, - xxx, and dd. xxx)
|
192
|
-
|
193
|
-
if SIMPLE_LIST_RE =~ active_line
|
194
|
-
offset = margin + $1.length
|
195
|
-
prefix = $2
|
196
|
-
prefix_length = prefix.length
|
197
|
-
|
198
|
-
flag = case prefix
|
199
|
-
when "*","-" then :BULLET
|
200
|
-
when /^\d/ then :NUMBER
|
201
|
-
when /^[A-Z]/ then :UPPERALPHA
|
202
|
-
when /^[a-z]/ then :LOWERALPHA
|
203
|
-
else raise "Invalid List Type: #{self.inspect}"
|
204
|
-
end
|
205
|
-
|
206
|
-
line.stamp :LIST, level+1, prefix, flag
|
207
|
-
text[margin, prefix_length] = " " * prefix_length
|
208
|
-
assign_types_to_lines(offset, level + 1)
|
209
|
-
next
|
210
|
-
end
|
211
|
-
|
212
|
-
if LABEL_LIST_RE =~ active_line
|
213
|
-
offset = margin + $1.length
|
214
|
-
prefix = $2
|
215
|
-
prefix_length = prefix.length
|
216
|
-
|
217
|
-
next if handled_labeled_list(line, level, margin, offset, prefix)
|
218
|
-
end
|
219
|
-
|
220
|
-
# Headings look like
|
221
|
-
# = Main heading
|
222
|
-
# == Second level
|
223
|
-
# === Third
|
224
|
-
#
|
225
|
-
# Headings reset the level to 0
|
226
|
-
|
227
|
-
if active_line[0] == ?= and active_line =~ /^(=+)\s*(.*)/
|
228
|
-
prefix_length = $1.length
|
229
|
-
prefix_length = 6 if prefix_length > 6
|
230
|
-
line.stamp :HEADING, 0, prefix_length
|
231
|
-
line.strip_leading(margin + prefix_length)
|
232
|
-
next
|
233
|
-
end
|
234
|
-
|
235
|
-
# If the character's a space, then we have verbatim text,
|
236
|
-
# otherwise
|
237
|
-
|
238
|
-
if active_line[0] == SPACE
|
239
|
-
line.strip_leading(margin) if margin > 0
|
240
|
-
line.stamp :VERBATIM, level
|
241
|
-
else
|
242
|
-
line.stamp :PARAGRAPH, level
|
243
|
-
end
|
244
|
-
end
|
118
|
+
document.accept op
|
245
119
|
end
|
246
120
|
|
247
|
-
##
|
248
|
-
# Handle labeled list entries, We have a special case to deal with.
|
249
|
-
# Because the labels can be long, they force the remaining block of text
|
250
|
-
# over the to right:
|
251
|
-
#
|
252
|
-
# this is a long label that I wrote:: and here is the
|
253
|
-
# block of text with
|
254
|
-
# a silly margin
|
255
|
-
#
|
256
|
-
# So we allow the special case. If the label is followed by nothing, and
|
257
|
-
# if the following line is indented, then we take the indent of that line
|
258
|
-
# as the new margin.
|
259
|
-
#
|
260
|
-
# this is a long label that I wrote::
|
261
|
-
# here is a more reasonably indented block which
|
262
|
-
# will be attached to the label.
|
263
|
-
#
|
264
|
-
|
265
|
-
def handled_labeled_list(line, level, margin, offset, prefix)
|
266
|
-
prefix_length = prefix.length
|
267
|
-
text = line.text
|
268
|
-
flag = nil
|
269
|
-
|
270
|
-
case prefix
|
271
|
-
when /^\[/ then
|
272
|
-
flag = :LABELED
|
273
|
-
prefix = prefix[1, prefix.length-2]
|
274
|
-
when /:$/ then
|
275
|
-
flag = :NOTE
|
276
|
-
prefix.chop!
|
277
|
-
else
|
278
|
-
raise "Invalid List Type: #{self.inspect}"
|
279
|
-
end
|
280
|
-
|
281
|
-
# body is on the next line
|
282
|
-
if text.length <= offset then
|
283
|
-
original_line = line
|
284
|
-
line = @lines.next
|
285
|
-
return false unless line
|
286
|
-
text = line.text
|
287
|
-
|
288
|
-
for i in 0..margin
|
289
|
-
if text[i] != SPACE
|
290
|
-
@lines.unget
|
291
|
-
return false
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
i = margin
|
296
|
-
i += 1 while text[i] == SPACE
|
297
|
-
|
298
|
-
if i >= text.length then
|
299
|
-
@lines.unget
|
300
|
-
return false
|
301
|
-
else
|
302
|
-
offset = i
|
303
|
-
prefix_length = 0
|
304
|
-
|
305
|
-
if text[offset..-1] =~ SIMPLE_LIST_RE then
|
306
|
-
@lines.unget
|
307
|
-
line = original_line
|
308
|
-
line.text = ''
|
309
|
-
else
|
310
|
-
@lines.delete original_line
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
line.stamp :LIST, level+1, prefix, flag
|
316
|
-
text[margin, prefix_length] = " " * prefix_length
|
317
|
-
assign_types_to_lines(offset, level + 1)
|
318
|
-
return true
|
319
|
-
end
|
320
|
-
|
321
|
-
##
|
322
|
-
# Return a block consisting of fragments which are paragraphs, list
|
323
|
-
# entries or verbatim text. We merge consecutive lines of the same type
|
324
|
-
# and level together. We are also slightly tricky with lists: the lines
|
325
|
-
# following a list introduction look like paragraph lines at the next
|
326
|
-
# level, and we remap them into list entries instead.
|
327
|
-
|
328
|
-
def group_lines
|
329
|
-
@lines.rewind
|
330
|
-
|
331
|
-
in_list = false
|
332
|
-
wanted_type = wanted_level = nil
|
333
|
-
|
334
|
-
block = LineCollection.new
|
335
|
-
group = nil
|
336
|
-
|
337
|
-
while line = @lines.next
|
338
|
-
if line.level == wanted_level and line.type == wanted_type
|
339
|
-
group.add_text(line.text)
|
340
|
-
else
|
341
|
-
group = block.fragment_for(line)
|
342
|
-
block.add(group)
|
343
|
-
|
344
|
-
if line.type == :LIST
|
345
|
-
wanted_type = :PARAGRAPH
|
346
|
-
else
|
347
|
-
wanted_type = line.type
|
348
|
-
end
|
349
|
-
|
350
|
-
wanted_level = line.type == :HEADING ? line.param : line.level
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
block.normalize
|
355
|
-
block
|
356
|
-
end
|
357
|
-
|
358
|
-
##
|
359
|
-
# For debugging, we allow access to our line contents as text.
|
360
|
-
|
361
|
-
def content
|
362
|
-
@lines.as_text
|
363
|
-
end
|
364
|
-
public :content
|
365
|
-
|
366
|
-
##
|
367
|
-
# For debugging, return the list of line types.
|
368
|
-
|
369
|
-
def get_line_types
|
370
|
-
@lines.line_types
|
371
|
-
end
|
372
|
-
public :get_line_types
|
373
|
-
|
374
121
|
end
|
375
122
|
|
376
|
-
require 'rdoc/markup/
|
123
|
+
require 'rdoc/markup/parser'
|
124
|
+
require 'rdoc/markup/attribute_manager'
|
377
125
|
require 'rdoc/markup/inline'
|
378
|
-
|
126
|
+
|