rdoc 8.0.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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -3
- data/RI.md +75 -75
- data/exe/rdoc +2 -2
- data/lib/rdoc/code_object/alias.rb +71 -69
- data/lib/rdoc/code_object/any_method.rb +305 -303
- data/lib/rdoc/code_object/attr.rb +150 -148
- data/lib/rdoc/code_object/class_module.rb +798 -792
- data/lib/rdoc/code_object/constant.rb +175 -173
- data/lib/rdoc/code_object/context/section.rb +142 -138
- data/lib/rdoc/code_object/context.rb +926 -958
- data/lib/rdoc/code_object/extend.rb +7 -5
- data/lib/rdoc/code_object/include.rb +7 -5
- data/lib/rdoc/code_object/method_attr.rb +326 -319
- data/lib/rdoc/code_object/mixin.rb +97 -95
- data/lib/rdoc/code_object/normal_class.rb +77 -78
- data/lib/rdoc/code_object/normal_module.rb +61 -59
- data/lib/rdoc/code_object/require.rb +23 -39
- data/lib/rdoc/code_object/single_class.rb +21 -19
- data/lib/rdoc/code_object/top_level.rb +212 -219
- data/lib/rdoc/code_object.rb +305 -303
- data/lib/rdoc/comment.rb +275 -273
- data/lib/rdoc/cross_reference.rb +192 -190
- data/lib/rdoc/encoding.rb +105 -103
- data/lib/rdoc/erb_partial.rb +13 -11
- data/lib/rdoc/erbio.rb +29 -27
- data/lib/rdoc/generator/aliki.rb +161 -153
- data/lib/rdoc/generator/darkfish.rb +645 -635
- data/lib/rdoc/generator/json_index.rb +233 -229
- data/lib/rdoc/generator/markup.rb +164 -146
- data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
- data/lib/rdoc/generator/pot/po.rb +52 -51
- data/lib/rdoc/generator/pot/po_entry.rb +138 -132
- data/lib/rdoc/generator/pot.rb +85 -81
- data/lib/rdoc/generator/ri.rb +23 -19
- data/lib/rdoc/generator/template/aliki/DESIGN.md +6 -4
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +10 -10
- data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +207 -178
- data/lib/rdoc/generator/template/aliki/js/aliki.js +60 -84
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
- data/lib/rdoc/generator.rb +48 -46
- data/lib/rdoc/i18n/locale.rb +99 -95
- data/lib/rdoc/i18n/text.rb +109 -105
- data/lib/rdoc/i18n.rb +7 -5
- data/lib/rdoc/markdown/byte_runtime.rb +80 -0
- data/lib/rdoc/markdown.kpeg +15 -11
- data/lib/rdoc/markdown.rb +40 -47
- data/lib/rdoc/markup/block_quote.rb +12 -8
- data/lib/rdoc/markup/document.rb +127 -123
- data/lib/rdoc/markup/formatter.rb +219 -215
- data/lib/rdoc/markup/include.rb +33 -29
- data/lib/rdoc/markup/indented_paragraph.rb +37 -33
- data/lib/rdoc/markup/inline_parser.rb +281 -277
- data/lib/rdoc/markup/list.rb +80 -88
- data/lib/rdoc/markup/list_item.rb +73 -85
- data/lib/rdoc/markup/paragraph.rb +23 -19
- data/lib/rdoc/markup/parser.rb +501 -497
- data/lib/rdoc/markup/pre_process.rb +283 -279
- data/lib/rdoc/markup/raw.rb +2 -2
- data/lib/rdoc/markup/rule.rb +16 -12
- data/lib/rdoc/markup/to_ansi.rb +143 -139
- data/lib/rdoc/markup/to_bs.rb +72 -68
- data/lib/rdoc/markup/to_html.rb +594 -565
- data/lib/rdoc/markup/to_html_crossref.rb +234 -230
- data/lib/rdoc/markup/to_html_snippet.rb +232 -227
- data/lib/rdoc/markup/to_joined_paragraph.rb +36 -32
- data/lib/rdoc/markup/to_label.rb +63 -59
- data/lib/rdoc/markup/to_markdown.rb +212 -208
- data/lib/rdoc/markup/to_rdoc.rb +336 -332
- data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
- data/lib/rdoc/markup/to_test.rb +60 -56
- data/lib/rdoc/markup/to_tt_only.rb +84 -80
- data/lib/rdoc/markup/verbatim.rb +62 -58
- data/lib/rdoc/markup.rb +198 -196
- data/lib/rdoc/options.rb +1063 -1061
- data/lib/rdoc/parser/c.rb +1039 -1037
- data/lib/rdoc/parser/changelog.rb +319 -315
- data/lib/rdoc/parser/markdown.rb +17 -13
- data/lib/rdoc/parser/rbs.rb +239 -235
- data/lib/rdoc/parser/rd.rb +17 -13
- data/lib/rdoc/parser/ruby.rb +1245 -1124
- data/lib/rdoc/parser/ruby_colorizer.rb +263 -213
- data/lib/rdoc/parser/simple.rb +31 -27
- data/lib/rdoc/parser/text.rb +12 -8
- data/lib/rdoc/parser.rb +228 -220
- data/lib/rdoc/rbs_helper.rb +1 -1
- data/lib/rdoc/rd/inline.rb +57 -53
- data/lib/rdoc/rd.rb +90 -88
- data/lib/rdoc/rdoc.rb +500 -491
- data/lib/rdoc/ri/driver.rb +1140 -1135
- data/lib/rdoc/ri/formatter.rb +7 -3
- data/lib/rdoc/ri/paths.rb +140 -136
- data/lib/rdoc/ri/servlet.rb +354 -350
- data/lib/rdoc/ri/store.rb +4 -2
- data/lib/rdoc/ri/task.rb +55 -51
- data/lib/rdoc/ri.rb +14 -12
- data/lib/rdoc/rubygems_hook.rb +183 -181
- data/lib/rdoc/server.rb +349 -347
- data/lib/rdoc/stats/normal.rb +46 -42
- data/lib/rdoc/stats/quiet.rb +39 -35
- data/lib/rdoc/stats/verbose.rb +35 -31
- data/lib/rdoc/stats.rb +365 -363
- data/lib/rdoc/store.rb +888 -902
- data/lib/rdoc/task.rb +260 -256
- data/lib/rdoc/text.rb +135 -133
- data/lib/rdoc/token_stream.rb +101 -93
- data/lib/rdoc/tom_doc.rb +203 -201
- data/lib/rdoc/version.rb +1 -1
- metadata +4 -5
- data/lib/rdoc/markdown/literals.kpeg +0 -21
- data/lib/rdoc/markdown/literals.rb +0 -454
data/lib/rdoc/tom_doc.rb
CHANGED
|
@@ -1,257 +1,259 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# :markup: tomdoc
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# The TomDoc specification can be found at http://tomdoc.org.
|
|
7
|
-
#
|
|
8
|
-
# To choose TomDoc as your only default format see RDoc::Options@Saved+Options
|
|
9
|
-
# for instructions on setting up a <code>.rdoc_options</code> file to store
|
|
10
|
-
# your project default.
|
|
11
|
-
#
|
|
12
|
-
# There are a few differences between this parser and the specification. A
|
|
13
|
-
# best-effort was made to follow the specification as closely as possible but
|
|
14
|
-
# some choices to deviate were made.
|
|
15
|
-
#
|
|
16
|
-
# A future version of RDoc will warn when a MUST or MUST NOT is violated and
|
|
17
|
-
# may warn when a SHOULD or SHOULD NOT is violated. RDoc will always try
|
|
18
|
-
# to emit documentation even if given invalid TomDoc.
|
|
19
|
-
#
|
|
20
|
-
# Here are some implementation choices this parser currently makes:
|
|
21
|
-
#
|
|
22
|
-
# This parser allows rdoc-style inline markup but you should not depended on
|
|
23
|
-
# it.
|
|
24
|
-
#
|
|
25
|
-
# This parser allows a space between the comment and the method body.
|
|
26
|
-
#
|
|
27
|
-
# This parser does not require the default value to be described for an
|
|
28
|
-
# optional argument.
|
|
29
|
-
#
|
|
30
|
-
# This parser does not examine the order of sections. An Examples section may
|
|
31
|
-
# precede the Arguments section.
|
|
32
|
-
#
|
|
33
|
-
# This class is documented in TomDoc format. Since this is a subclass of the
|
|
34
|
-
# RDoc markup parser there isn't much to see here, unfortunately.
|
|
35
|
-
|
|
36
|
-
class RDoc::TomDoc < RDoc::Markup::Parser
|
|
37
|
-
|
|
38
|
-
# Internal: Token accessor
|
|
39
|
-
|
|
40
|
-
attr_reader :tokens
|
|
41
|
-
|
|
42
|
-
# Internal: Adds a post-processor which sets the RDoc section based on the
|
|
43
|
-
# comment's status.
|
|
4
|
+
module RDoc
|
|
5
|
+
# A parser for TomDoc based on TomDoc 1.0.0-rc1 (02adef9b5a)
|
|
44
6
|
#
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
def self.add_post_processor # :nodoc:
|
|
48
|
-
RDoc::Markup::PreProcess.post_process do |comment, code_object|
|
|
49
|
-
next unless code_object and
|
|
50
|
-
RDoc::Comment === comment and comment.format == 'tomdoc'
|
|
51
|
-
|
|
52
|
-
comment.text.gsub!(/\A(\s*# |)(Public|Internal|Deprecated):\s+/) do
|
|
53
|
-
section = code_object.add_section $2
|
|
54
|
-
code_object.temporary_section = section
|
|
55
|
-
|
|
56
|
-
$1
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
add_post_processor
|
|
62
|
-
|
|
63
|
-
# Public: Parses TomDoc from text
|
|
7
|
+
# The TomDoc specification can be found at http://tomdoc.org.
|
|
64
8
|
#
|
|
65
|
-
#
|
|
9
|
+
# To choose TomDoc as your only default format see RDoc::Options@Saved+Options
|
|
10
|
+
# for instructions on setting up a <code>.rdoc_options</code> file to store
|
|
11
|
+
# your project default.
|
|
66
12
|
#
|
|
67
|
-
#
|
|
13
|
+
# There are a few differences between this parser and the specification. A
|
|
14
|
+
# best-effort was made to follow the specification as closely as possible but
|
|
15
|
+
# some choices to deviate were made.
|
|
68
16
|
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
17
|
+
# A future version of RDoc will warn when a MUST or MUST NOT is violated and
|
|
18
|
+
# may warn when a SHOULD or SHOULD NOT is violated. RDoc will always try
|
|
19
|
+
# to emit documentation even if given invalid TomDoc.
|
|
71
20
|
#
|
|
72
|
-
#
|
|
73
|
-
# TOMDOC
|
|
74
|
-
# # => #<RDoc::Markup::Document:0xXXX @parts=[...], @file=nil>
|
|
21
|
+
# Here are some implementation choices this parser currently makes:
|
|
75
22
|
#
|
|
76
|
-
#
|
|
77
|
-
|
|
78
|
-
def self.parse(text)
|
|
79
|
-
parser = new
|
|
80
|
-
|
|
81
|
-
parser.tokenize text
|
|
82
|
-
doc = RDoc::Markup::Document.new
|
|
83
|
-
parser.parse doc
|
|
84
|
-
doc
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
# Internal: Extracts the Signature section's method signature
|
|
23
|
+
# This parser allows rdoc-style inline markup but you should not depended on
|
|
24
|
+
# it.
|
|
88
25
|
#
|
|
89
|
-
#
|
|
90
|
-
# extracted
|
|
26
|
+
# This parser allows a space between the comment and the method body.
|
|
91
27
|
#
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
28
|
+
# This parser does not require the default value to be described for an
|
|
29
|
+
# optional argument.
|
|
30
|
+
#
|
|
31
|
+
# This parser does not examine the order of sections. An Examples section may
|
|
32
|
+
# precede the Arguments section.
|
|
33
|
+
#
|
|
34
|
+
# This class is documented in TomDoc format. Since this is a subclass of the
|
|
35
|
+
# RDoc markup parser there isn't much to see here, unfortunately.
|
|
96
36
|
|
|
97
|
-
|
|
37
|
+
class TomDoc < Markup::Parser
|
|
98
38
|
|
|
99
|
-
|
|
100
|
-
found_heading = false
|
|
101
|
-
found_signature = false
|
|
39
|
+
# Internal: Token accessor
|
|
102
40
|
|
|
103
|
-
|
|
104
|
-
next false if found_signature
|
|
41
|
+
attr_reader :tokens
|
|
105
42
|
|
|
106
|
-
|
|
107
|
-
|
|
43
|
+
# Internal: Adds a post-processor which sets the RDoc section based on the
|
|
44
|
+
# comment's status.
|
|
45
|
+
#
|
|
46
|
+
# Returns nothing.
|
|
108
47
|
|
|
109
|
-
|
|
48
|
+
def self.add_post_processor # :nodoc:
|
|
49
|
+
Markup::PreProcess.post_process do |comment, code_object|
|
|
50
|
+
next unless code_object and
|
|
51
|
+
Comment === comment and comment.format == 'tomdoc'
|
|
110
52
|
|
|
111
|
-
|
|
53
|
+
comment.text.gsub!(/\A(\s*# |)(Public|Internal|Deprecated):\s+/) do
|
|
54
|
+
section = code_object.add_section $2
|
|
55
|
+
code_object.temporary_section = section
|
|
112
56
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
found_signature = true
|
|
57
|
+
$1
|
|
58
|
+
end
|
|
116
59
|
end
|
|
117
60
|
end
|
|
118
61
|
|
|
119
|
-
|
|
120
|
-
|
|
62
|
+
add_post_processor
|
|
63
|
+
|
|
64
|
+
# Public: Parses TomDoc from text
|
|
65
|
+
#
|
|
66
|
+
# text - A String containing TomDoc-format text.
|
|
67
|
+
#
|
|
68
|
+
# Examples
|
|
69
|
+
#
|
|
70
|
+
# RDoc::TomDoc.parse <<-TOMDOC
|
|
71
|
+
# This method does some things
|
|
72
|
+
#
|
|
73
|
+
# Returns nothing.
|
|
74
|
+
# TOMDOC
|
|
75
|
+
# # => #<RDoc::Markup::Document:0xXXX @parts=[...], @file=nil>
|
|
76
|
+
#
|
|
77
|
+
# Returns an RDoc::Markup::Document representing the TomDoc format.
|
|
78
|
+
|
|
79
|
+
def self.parse(text)
|
|
80
|
+
parser = new
|
|
81
|
+
|
|
82
|
+
parser.tokenize text
|
|
83
|
+
doc = Markup::Document.new
|
|
84
|
+
parser.parse doc
|
|
85
|
+
doc
|
|
86
|
+
end
|
|
121
87
|
|
|
122
|
-
|
|
88
|
+
# Internal: Extracts the Signature section's method signature
|
|
89
|
+
#
|
|
90
|
+
# comment - An RDoc::Comment that will be parsed and have the signature
|
|
91
|
+
# extracted
|
|
92
|
+
#
|
|
93
|
+
# Returns a String containing the signature and nil if not
|
|
123
94
|
|
|
124
|
-
|
|
125
|
-
|
|
95
|
+
def self.signature(comment)
|
|
96
|
+
return unless comment.tomdoc?
|
|
126
97
|
|
|
127
|
-
|
|
128
|
-
@seen_returns = false
|
|
129
|
-
end
|
|
98
|
+
document = comment.parse
|
|
130
99
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
#
|
|
135
|
-
# Returns an RDoc::Markup::Heading
|
|
100
|
+
signature = nil
|
|
101
|
+
found_heading = false
|
|
102
|
+
found_signature = false
|
|
136
103
|
|
|
137
|
-
|
|
138
|
-
|
|
104
|
+
document.parts.delete_if do |part|
|
|
105
|
+
next false if found_signature
|
|
139
106
|
|
|
140
|
-
|
|
107
|
+
found_heading ||=
|
|
108
|
+
Markup::Heading === part && part.text == 'Signature'
|
|
141
109
|
|
|
142
|
-
|
|
143
|
-
end
|
|
110
|
+
next false unless found_heading
|
|
144
111
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
112
|
+
next true if Markup::BlankLine === part
|
|
113
|
+
|
|
114
|
+
if Markup::Verbatim === part
|
|
115
|
+
signature = part
|
|
116
|
+
found_signature = true
|
|
117
|
+
end
|
|
118
|
+
end
|
|
152
119
|
|
|
153
|
-
|
|
154
|
-
|
|
120
|
+
signature and signature.text
|
|
121
|
+
end
|
|
155
122
|
|
|
156
|
-
|
|
123
|
+
# Public: Creates a new TomDoc parser. See also RDoc::Markup::parse
|
|
157
124
|
|
|
158
|
-
|
|
159
|
-
|
|
125
|
+
def initialize
|
|
126
|
+
super
|
|
160
127
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
#
|
|
165
|
-
# Returns an RDoc::Markup::Paragraph.
|
|
128
|
+
@section = nil
|
|
129
|
+
@seen_returns = false
|
|
130
|
+
end
|
|
166
131
|
|
|
167
|
-
|
|
168
|
-
|
|
132
|
+
# Internal: Builds a heading from the token stream
|
|
133
|
+
#
|
|
134
|
+
# level - The level of heading to create
|
|
135
|
+
#
|
|
136
|
+
# Returns an RDoc::Markup::Heading
|
|
169
137
|
|
|
170
|
-
|
|
138
|
+
def build_heading(level)
|
|
139
|
+
heading = super
|
|
171
140
|
|
|
172
|
-
|
|
173
|
-
type, data, = get
|
|
141
|
+
@section = heading.text
|
|
174
142
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
@section = 'Returns' if data =~ /\A(Returns|Raises)/
|
|
143
|
+
heading
|
|
144
|
+
end
|
|
178
145
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
146
|
+
# Internal: Builds a verbatim from the token stream. A verbatim in the
|
|
147
|
+
# Examples section will be marked as in Ruby format.
|
|
148
|
+
#
|
|
149
|
+
# margin - The indentation from the margin for lines that belong to this
|
|
150
|
+
# verbatim section.
|
|
151
|
+
#
|
|
152
|
+
# Returns an RDoc::Markup::Verbatim
|
|
153
|
+
|
|
154
|
+
def build_verbatim(margin)
|
|
155
|
+
verbatim = super
|
|
156
|
+
|
|
157
|
+
verbatim.format = :ruby if @section == 'Examples'
|
|
158
|
+
|
|
159
|
+
verbatim
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Internal: Builds a paragraph from the token stream
|
|
163
|
+
#
|
|
164
|
+
# margin - Unused
|
|
165
|
+
#
|
|
166
|
+
# Returns an RDoc::Markup::Paragraph.
|
|
167
|
+
|
|
168
|
+
def build_paragraph(margin)
|
|
169
|
+
p :paragraph_start => margin if @debug
|
|
170
|
+
|
|
171
|
+
paragraph = Markup::Paragraph.new
|
|
172
|
+
|
|
173
|
+
until @tokens.empty? do
|
|
174
|
+
type, data, = get
|
|
175
|
+
|
|
176
|
+
case type
|
|
177
|
+
when :TEXT
|
|
178
|
+
@section = 'Returns' if data =~ /\A(Returns|Raises)/
|
|
179
|
+
|
|
180
|
+
paragraph << data
|
|
181
|
+
when :NEWLINE
|
|
182
|
+
if :TEXT == peek_token[0]
|
|
183
|
+
# Lines beginning with 'Raises' in the Returns section should not be
|
|
184
|
+
# treated as multiline text
|
|
185
|
+
if 'Returns' == @section and
|
|
186
|
+
peek_token[1].start_with?('Raises')
|
|
187
|
+
break
|
|
188
|
+
else
|
|
189
|
+
paragraph << ' '
|
|
190
|
+
end
|
|
187
191
|
else
|
|
188
|
-
|
|
192
|
+
break
|
|
189
193
|
end
|
|
190
194
|
else
|
|
195
|
+
unget
|
|
191
196
|
break
|
|
192
197
|
end
|
|
193
|
-
else
|
|
194
|
-
unget
|
|
195
|
-
break
|
|
196
198
|
end
|
|
197
|
-
end
|
|
198
199
|
|
|
199
|
-
|
|
200
|
+
p :paragraph_end => margin if @debug
|
|
200
201
|
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
paragraph
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
##
|
|
206
|
+
# Detects a section change to "Returns" and adds a heading
|
|
203
207
|
|
|
204
|
-
|
|
205
|
-
|
|
208
|
+
def parse_text(parent, indent) # :nodoc:
|
|
209
|
+
paragraph = build_paragraph indent
|
|
206
210
|
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
if false == @seen_returns and 'Returns' == @section
|
|
212
|
+
@seen_returns = true
|
|
213
|
+
parent << Markup::Heading.new(3, 'Returns')
|
|
214
|
+
parent << Markup::BlankLine.new
|
|
215
|
+
end
|
|
209
216
|
|
|
210
|
-
|
|
211
|
-
@seen_returns = true
|
|
212
|
-
parent << RDoc::Markup::Heading.new(3, 'Returns')
|
|
213
|
-
parent << RDoc::Markup::BlankLine.new
|
|
217
|
+
parent << paragraph
|
|
214
218
|
end
|
|
215
219
|
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
# Internal: Turns text into an Array of tokens
|
|
221
|
+
#
|
|
222
|
+
# text - A String containing TomDoc-format text.
|
|
223
|
+
#
|
|
224
|
+
# Returns self.
|
|
225
|
+
|
|
226
|
+
def tokenize(text)
|
|
227
|
+
text = text.sub(/\A(Public|Internal|Deprecated):\s+/, '')
|
|
228
|
+
|
|
229
|
+
setup_scanner text
|
|
230
|
+
|
|
231
|
+
until @s.eos? do
|
|
232
|
+
pos = @s.pos
|
|
233
|
+
|
|
234
|
+
# leading spaces will be reflected by the column of the next token
|
|
235
|
+
# the only thing we loose are trailing spaces at the end of the file
|
|
236
|
+
next if @s.scan(/ +/)
|
|
237
|
+
|
|
238
|
+
@tokens << case
|
|
239
|
+
when @s.scan(/\r?\n/)
|
|
240
|
+
token = [:NEWLINE, @s.matched, *pos]
|
|
241
|
+
@s.newline!
|
|
242
|
+
token
|
|
243
|
+
when @s.scan(/(Examples|Signature)$/)
|
|
244
|
+
@tokens << [:HEADER, 3, *pos]
|
|
245
|
+
|
|
246
|
+
[:TEXT, @s[1], *pos]
|
|
247
|
+
when @s.scan(/([:\w][\w\[\]]*)[ ]+- /)
|
|
248
|
+
[:NOTE, @s[1], *pos]
|
|
249
|
+
else
|
|
250
|
+
@s.scan(/.*/)
|
|
251
|
+
[:TEXT, @s.matched.sub(/\r$/, ''), *pos]
|
|
252
|
+
end
|
|
253
|
+
end
|
|
218
254
|
|
|
219
|
-
|
|
220
|
-
#
|
|
221
|
-
# text - A String containing TomDoc-format text.
|
|
222
|
-
#
|
|
223
|
-
# Returns self.
|
|
224
|
-
|
|
225
|
-
def tokenize(text)
|
|
226
|
-
text = text.sub(/\A(Public|Internal|Deprecated):\s+/, '')
|
|
227
|
-
|
|
228
|
-
setup_scanner text
|
|
229
|
-
|
|
230
|
-
until @s.eos? do
|
|
231
|
-
pos = @s.pos
|
|
232
|
-
|
|
233
|
-
# leading spaces will be reflected by the column of the next token
|
|
234
|
-
# the only thing we loose are trailing spaces at the end of the file
|
|
235
|
-
next if @s.scan(/ +/)
|
|
236
|
-
|
|
237
|
-
@tokens << case
|
|
238
|
-
when @s.scan(/\r?\n/) then
|
|
239
|
-
token = [:NEWLINE, @s.matched, *pos]
|
|
240
|
-
@s.newline!
|
|
241
|
-
token
|
|
242
|
-
when @s.scan(/(Examples|Signature)$/) then
|
|
243
|
-
@tokens << [:HEADER, 3, *pos]
|
|
244
|
-
|
|
245
|
-
[:TEXT, @s[1], *pos]
|
|
246
|
-
when @s.scan(/([:\w][\w\[\]]*)[ ]+- /) then
|
|
247
|
-
[:NOTE, @s[1], *pos]
|
|
248
|
-
else
|
|
249
|
-
@s.scan(/.*/)
|
|
250
|
-
[:TEXT, @s.matched.sub(/\r$/, ''), *pos]
|
|
251
|
-
end
|
|
255
|
+
self
|
|
252
256
|
end
|
|
253
257
|
|
|
254
|
-
self
|
|
255
258
|
end
|
|
256
|
-
|
|
257
259
|
end
|
data/lib/rdoc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rdoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.
|
|
4
|
+
version: 8.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Hodel
|
|
@@ -13,7 +13,7 @@ authors:
|
|
|
13
13
|
- ITOYANAGI Sakura
|
|
14
14
|
bindir: exe
|
|
15
15
|
cert_chain: []
|
|
16
|
-
date: 2026-
|
|
16
|
+
date: 2026-09-28 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: erb
|
|
@@ -234,9 +234,8 @@ files:
|
|
|
234
234
|
- lib/rdoc/known_classes.rb
|
|
235
235
|
- lib/rdoc/markdown.kpeg
|
|
236
236
|
- lib/rdoc/markdown.rb
|
|
237
|
+
- lib/rdoc/markdown/byte_runtime.rb
|
|
237
238
|
- lib/rdoc/markdown/entities.rb
|
|
238
|
-
- lib/rdoc/markdown/literals.kpeg
|
|
239
|
-
- lib/rdoc/markdown/literals.rb
|
|
240
239
|
- lib/rdoc/markup.rb
|
|
241
240
|
- lib/rdoc/markup/blank_line.rb
|
|
242
241
|
- lib/rdoc/markup/block_quote.rb
|
|
@@ -337,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
337
336
|
- !ruby/object:Gem::Version
|
|
338
337
|
version: '2.2'
|
|
339
338
|
requirements: []
|
|
340
|
-
rubygems_version: 4.0.
|
|
339
|
+
rubygems_version: 4.0.20
|
|
341
340
|
specification_version: 4
|
|
342
341
|
summary: RDoc produces HTML and command-line documentation for Ruby projects
|
|
343
342
|
test_files: []
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
%% name = RDoc::Markdown::Literals
|
|
2
|
-
|
|
3
|
-
%% header {
|
|
4
|
-
# coding: UTF-8
|
|
5
|
-
# frozen_string_literal: true
|
|
6
|
-
# :markup: markdown
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
# This set of literals is for Ruby 1.9 regular expressions and gives full
|
|
10
|
-
# unicode support.
|
|
11
|
-
#
|
|
12
|
-
# Unlike peg-markdown, this set of literals recognizes Unicode alphanumeric
|
|
13
|
-
# characters, newlines and spaces.
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Alphanumeric = /\p{Word}/
|
|
17
|
-
AlphanumericAscii = /[A-Za-z0-9]/
|
|
18
|
-
BOM = "\uFEFF"
|
|
19
|
-
Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
|
|
20
|
-
NonAlphanumeric = /\p{^Word}/
|
|
21
|
-
Spacechar = /\t|\p{Zs}/
|