rdoc 6.12.0 → 6.13.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/lib/rdoc/code_object/alias.rb +2 -9
- data/lib/rdoc/code_object/any_method.rb +5 -10
- data/lib/rdoc/code_object/attr.rb +3 -6
- data/lib/rdoc/code_object/class_module.rb +23 -8
- data/lib/rdoc/code_object/context.rb +4 -46
- data/lib/rdoc/code_object/method_attr.rb +2 -22
- data/lib/rdoc/code_object/require.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +3 -23
- data/lib/rdoc/code_object.rb +3 -34
- data/lib/rdoc/comment.rb +1 -4
- data/lib/rdoc/generator/darkfish.rb +84 -96
- data/lib/rdoc/generator/json_index.rb +1 -17
- data/lib/rdoc/generator/markup.rb +2 -2
- data/lib/rdoc/generator/pot/message_extractor.rb +2 -2
- data/lib/rdoc/generator/pot.rb +0 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +13 -0
- data/lib/rdoc/markdown.kpeg +7 -5
- data/lib/rdoc/markdown.rb +34 -21
- data/lib/rdoc/markup/heading.rb +7 -1
- data/lib/rdoc/markup/to_html.rb +6 -1
- data/lib/rdoc/parser/c.rb +4 -7
- data/lib/rdoc/parser/prism_ruby.rb +8 -15
- data/lib/rdoc/parser/ruby.rb +7 -10
- data/lib/rdoc/rdoc.rb +3 -18
- data/lib/rdoc/ri/driver.rb +11 -3
- data/lib/rdoc/rubygems_hook.rb +1 -7
- data/lib/rdoc/servlet.rb +8 -7
- data/lib/rdoc/stats.rb +2 -2
- data/lib/rdoc/store.rb +9 -13
- data/lib/rdoc/text.rb +2 -2
- data/lib/rdoc/version.rb +1 -1
- metadata +2 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
@@ -73,12 +73,6 @@ class RDoc::Generator::Darkfish
|
|
73
73
|
css/rdoc.css
|
74
74
|
]
|
75
75
|
|
76
|
-
##
|
77
|
-
# Path to this file's parent directory. Used to find templates and other
|
78
|
-
# resources.
|
79
|
-
|
80
|
-
GENERATOR_DIR = File.join 'rdoc', 'generator'
|
81
|
-
|
82
76
|
##
|
83
77
|
# Release Version
|
84
78
|
|
@@ -184,22 +178,6 @@ class RDoc::Generator::Darkfish
|
|
184
178
|
$stderr.puts(*msg)
|
185
179
|
end
|
186
180
|
|
187
|
-
##
|
188
|
-
# Directory where generated class HTML files live relative to the output
|
189
|
-
# dir.
|
190
|
-
|
191
|
-
def class_dir
|
192
|
-
nil
|
193
|
-
end
|
194
|
-
|
195
|
-
##
|
196
|
-
# Directory where generated class HTML files live relative to the output
|
197
|
-
# dir.
|
198
|
-
|
199
|
-
def file_dir
|
200
|
-
nil
|
201
|
-
end
|
202
|
-
|
203
181
|
##
|
204
182
|
# Create the directories the generated docs will live in if they don't
|
205
183
|
# already exist.
|
@@ -301,8 +279,6 @@ class RDoc::Generator::Darkfish
|
|
301
279
|
# Generate an index page which lists all the classes which are documented.
|
302
280
|
|
303
281
|
def generate_index
|
304
|
-
setup
|
305
|
-
|
306
282
|
template_file = @template_dir + 'index.rhtml'
|
307
283
|
return unless template_file.exist?
|
308
284
|
|
@@ -338,8 +314,6 @@ class RDoc::Generator::Darkfish
|
|
338
314
|
# Generates a class file for +klass+
|
339
315
|
|
340
316
|
def generate_class klass, template_file = nil
|
341
|
-
setup
|
342
|
-
|
343
317
|
current = klass
|
344
318
|
|
345
319
|
template_file ||= @template_dir + 'class.rhtml'
|
@@ -351,7 +325,9 @@ class RDoc::Generator::Darkfish
|
|
351
325
|
search_index_rel_prefix += @asset_rel_path if @file_output
|
352
326
|
|
353
327
|
asset_rel_prefix = rel_prefix + @asset_rel_path
|
354
|
-
|
328
|
+
|
329
|
+
breadcrumb = # used in templates
|
330
|
+
breadcrumb = generate_nesting_namespaces_breadcrumb(current, rel_prefix)
|
355
331
|
|
356
332
|
@title = "#{klass.type} #{klass.full_name} - #{@options.title}"
|
357
333
|
|
@@ -360,7 +336,6 @@ class RDoc::Generator::Darkfish
|
|
360
336
|
here = binding
|
361
337
|
# suppress 1.9.3 warning
|
362
338
|
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
363
|
-
here.local_variable_set(:svninfo, svninfo)
|
364
339
|
here
|
365
340
|
end
|
366
341
|
end
|
@@ -369,8 +344,6 @@ class RDoc::Generator::Darkfish
|
|
369
344
|
# Generate a documentation file for each class and module
|
370
345
|
|
371
346
|
def generate_class_files
|
372
|
-
setup
|
373
|
-
|
374
347
|
template_file = @template_dir + 'class.rhtml'
|
375
348
|
template_file = @template_dir + 'classpage.rhtml' unless
|
376
349
|
template_file.exist?
|
@@ -396,8 +369,6 @@ class RDoc::Generator::Darkfish
|
|
396
369
|
# Generate a documentation file for each file
|
397
370
|
|
398
371
|
def generate_file_files
|
399
|
-
setup
|
400
|
-
|
401
372
|
page_file = @template_dir + 'page.rhtml'
|
402
373
|
fileinfo_file = @template_dir + 'fileinfo.rhtml'
|
403
374
|
|
@@ -465,8 +436,6 @@ class RDoc::Generator::Darkfish
|
|
465
436
|
# Generate a page file for +file+
|
466
437
|
|
467
438
|
def generate_page file
|
468
|
-
setup
|
469
|
-
|
470
439
|
template_file = @template_dir + 'page.rhtml'
|
471
440
|
|
472
441
|
out_file = @outputdir + file.path
|
@@ -494,8 +463,6 @@ class RDoc::Generator::Darkfish
|
|
494
463
|
# Generates the 404 page for the RDoc servlet
|
495
464
|
|
496
465
|
def generate_servlet_not_found message
|
497
|
-
setup
|
498
|
-
|
499
466
|
template_file = @template_dir + 'servlet_not_found.rhtml'
|
500
467
|
return unless template_file.exist?
|
501
468
|
|
@@ -527,8 +494,6 @@ class RDoc::Generator::Darkfish
|
|
527
494
|
# Generates the servlet root page for the RDoc servlet
|
528
495
|
|
529
496
|
def generate_servlet_root installed
|
530
|
-
setup
|
531
|
-
|
532
497
|
template_file = @template_dir + 'servlet_root.rhtml'
|
533
498
|
return unless template_file.exist?
|
534
499
|
|
@@ -554,8 +519,6 @@ class RDoc::Generator::Darkfish
|
|
554
519
|
# Generate an index page which lists all the classes which are documented.
|
555
520
|
|
556
521
|
def generate_table_of_contents
|
557
|
-
setup
|
558
|
-
|
559
522
|
template_file = @template_dir + 'table_of_contents.rhtml'
|
560
523
|
return unless template_file.exist?
|
561
524
|
|
@@ -617,58 +580,6 @@ class RDoc::Generator::Darkfish
|
|
617
580
|
@modsort = get_sorted_module_list @classes
|
618
581
|
end
|
619
582
|
|
620
|
-
##
|
621
|
-
# Return a string describing the amount of time in the given number of
|
622
|
-
# seconds in terms a human can understand easily.
|
623
|
-
|
624
|
-
def time_delta_string seconds
|
625
|
-
return 'less than a minute' if seconds < 60
|
626
|
-
return "#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}" if
|
627
|
-
seconds < 3000 # 50 minutes
|
628
|
-
return 'about one hour' if seconds < 5400 # 90 minutes
|
629
|
-
return "#{seconds / 3600} hours" if seconds < 64800 # 18 hours
|
630
|
-
return 'one day' if seconds < 86400 # 1 day
|
631
|
-
return 'about one day' if seconds < 172800 # 2 days
|
632
|
-
return "#{seconds / 86400} days" if seconds < 604800 # 1 week
|
633
|
-
return 'about one week' if seconds < 1209600 # 2 week
|
634
|
-
return "#{seconds / 604800} weeks" if seconds < 7257600 # 3 months
|
635
|
-
return "#{seconds / 2419200} months" if seconds < 31536000 # 1 year
|
636
|
-
return "#{seconds / 31536000} years"
|
637
|
-
end
|
638
|
-
|
639
|
-
# %q$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $"
|
640
|
-
SVNID_PATTERN = /
|
641
|
-
\$Id:\s
|
642
|
-
(\S+)\s # filename
|
643
|
-
(\d+)\s # rev
|
644
|
-
(\d{4}-\d{2}-\d{2})\s # Date (YYYY-MM-DD)
|
645
|
-
(\d{2}:\d{2}:\d{2}Z)\s # Time (HH:MM:SSZ)
|
646
|
-
(\w+)\s # committer
|
647
|
-
\$$
|
648
|
-
/x
|
649
|
-
|
650
|
-
##
|
651
|
-
# Try to extract Subversion information out of the first constant whose
|
652
|
-
# value looks like a subversion Id tag. If no matching constant is found,
|
653
|
-
# and empty hash is returned.
|
654
|
-
|
655
|
-
def get_svninfo klass
|
656
|
-
constants = klass.constants or return {}
|
657
|
-
|
658
|
-
constants.find { |c| c.value =~ SVNID_PATTERN } or return {}
|
659
|
-
|
660
|
-
filename, rev, date, time, committer = $~.captures
|
661
|
-
commitdate = Time.parse "#{date} #{time}"
|
662
|
-
|
663
|
-
return {
|
664
|
-
:filename => filename,
|
665
|
-
:rev => Integer(rev),
|
666
|
-
:commitdate => commitdate,
|
667
|
-
:commitdelta => time_delta_string(Time.now - commitdate),
|
668
|
-
:committer => committer,
|
669
|
-
}
|
670
|
-
end
|
671
|
-
|
672
583
|
##
|
673
584
|
# Creates a template from its components and the +body_file+.
|
674
585
|
#
|
@@ -783,6 +694,12 @@ class RDoc::Generator::Darkfish
|
|
783
694
|
template
|
784
695
|
end
|
785
696
|
|
697
|
+
# :stopdoc:
|
698
|
+
ParagraphExcerptRegexpOther = %r[\b\w[^./:]++\.]
|
699
|
+
# use \p/\P{letter} instead of \w/\W in Unicode
|
700
|
+
ParagraphExcerptRegexpUnicode = %r[\b\p{letter}[^./:]++\.]
|
701
|
+
# :startdoc:
|
702
|
+
|
786
703
|
# Returns an excerpt of the comment for usage in meta description tags
|
787
704
|
def excerpt(comment)
|
788
705
|
text = case comment
|
@@ -794,14 +711,22 @@ class RDoc::Generator::Darkfish
|
|
794
711
|
|
795
712
|
# Match from a capital letter to the first period, discarding any links, so
|
796
713
|
# that we don't end up matching badges in the README
|
797
|
-
|
798
|
-
|
714
|
+
pattern = ParagraphExcerptRegexpUnicode
|
715
|
+
begin
|
716
|
+
first_paragraph_match = text.match(pattern)
|
717
|
+
rescue Encoding::CompatibilityError
|
718
|
+
# The doc is non-ASCII text and encoded in other than Unicode base encodings.
|
719
|
+
raise if pattern == ParagraphExcerptRegexpOther
|
720
|
+
pattern = ParagraphExcerptRegexpOther
|
721
|
+
retry
|
722
|
+
end
|
723
|
+
return text[0...150].tr_s("\n", " ").squeeze(" ") unless first_paragraph_match
|
799
724
|
|
800
725
|
extracted_text = first_paragraph_match[0]
|
801
|
-
second_paragraph =
|
726
|
+
second_paragraph = text.match(pattern, first_paragraph_match.end(0))
|
802
727
|
extracted_text << " " << second_paragraph[0] if second_paragraph
|
803
728
|
|
804
|
-
extracted_text[0...150].
|
729
|
+
extracted_text[0...150].tr_s("\n", " ").squeeze(" ")
|
805
730
|
end
|
806
731
|
|
807
732
|
def generate_ancestor_list(ancestors, klass)
|
@@ -821,4 +746,67 @@ class RDoc::Generator::Darkfish
|
|
821
746
|
|
822
747
|
content << '</li></ul>'
|
823
748
|
end
|
749
|
+
|
750
|
+
def generate_class_link(klass, rel_prefix)
|
751
|
+
if klass.display?
|
752
|
+
%(<code><a href="#{rel_prefix}/#{klass.path}">#{klass.name}</a></code>)
|
753
|
+
else
|
754
|
+
%(<code>#{klass.name}</code>)
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
758
|
+
def generate_class_index_content(classes, rel_prefix)
|
759
|
+
grouped_classes = group_classes_by_namespace_for_sidebar(classes)
|
760
|
+
return '' unless top = grouped_classes[nil]
|
761
|
+
|
762
|
+
solo = top.one? { |klass| klass.display? }
|
763
|
+
traverse_classes(top, grouped_classes, rel_prefix, solo)
|
764
|
+
end
|
765
|
+
|
766
|
+
def traverse_classes(klasses, grouped_classes, rel_prefix, solo = false)
|
767
|
+
content = +'<ul class="link-list">'
|
768
|
+
|
769
|
+
klasses.each do |index_klass|
|
770
|
+
if children = grouped_classes[index_klass.full_name]
|
771
|
+
content << %(<li><details#{solo ? ' open' : ''}><summary>#{generate_class_link(index_klass, rel_prefix)}</summary>)
|
772
|
+
content << traverse_classes(children, grouped_classes, rel_prefix)
|
773
|
+
content << '</details></li>'
|
774
|
+
solo = false
|
775
|
+
elsif index_klass.display?
|
776
|
+
content << %(<li>#{generate_class_link(index_klass, rel_prefix)}</li>)
|
777
|
+
end
|
778
|
+
end
|
779
|
+
|
780
|
+
"#{content}</ul>"
|
781
|
+
end
|
782
|
+
|
783
|
+
def group_classes_by_namespace_for_sidebar(classes)
|
784
|
+
grouped_classes = classes.group_by do |klass|
|
785
|
+
klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
|
786
|
+
end.select do |_, klasses|
|
787
|
+
klasses.any?(&:display?)
|
788
|
+
end
|
789
|
+
|
790
|
+
grouped_classes.values.each(&:uniq!)
|
791
|
+
grouped_classes
|
792
|
+
end
|
793
|
+
|
794
|
+
private
|
795
|
+
|
796
|
+
def nesting_namespaces_to_class_modules klass
|
797
|
+
tree = {}
|
798
|
+
|
799
|
+
klass.nesting_namespaces.zip(klass.fully_qualified_nesting_namespaces) do |ns, fqns|
|
800
|
+
tree[ns] = @store.classes_hash[fqns] || @store.modules_hash[fqns]
|
801
|
+
end
|
802
|
+
|
803
|
+
tree
|
804
|
+
end
|
805
|
+
|
806
|
+
def generate_nesting_namespaces_breadcrumb klass, rel_prefix
|
807
|
+
nesting_namespaces_to_class_modules(klass).map do |namespace, class_module|
|
808
|
+
path = class_module ? (rel_prefix + class_module.path).to_s : ""
|
809
|
+
{ name: namespace, path: path, self: klass.full_name == class_module&.full_name }
|
810
|
+
end
|
811
|
+
end
|
824
812
|
end
|
@@ -86,9 +86,7 @@ class RDoc::Generator::JsonIndex
|
|
86
86
|
attr_reader :index # :nodoc:
|
87
87
|
|
88
88
|
##
|
89
|
-
# Creates a new generator.
|
90
|
-
# class_dir and file_dir of links in the output index.
|
91
|
-
#
|
89
|
+
# Creates a new generator.
|
92
90
|
# +options+ are the same options passed to the parent generator.
|
93
91
|
|
94
92
|
def initialize parent_generator, options
|
@@ -265,20 +263,6 @@ class RDoc::Generator::JsonIndex
|
|
265
263
|
end
|
266
264
|
end
|
267
265
|
|
268
|
-
##
|
269
|
-
# The directory classes are written to
|
270
|
-
|
271
|
-
def class_dir
|
272
|
-
@parent_generator.class_dir
|
273
|
-
end
|
274
|
-
|
275
|
-
##
|
276
|
-
# The directory files are written to
|
277
|
-
|
278
|
-
def file_dir
|
279
|
-
@parent_generator.file_dir
|
280
|
-
end
|
281
|
-
|
282
266
|
def reset files, classes # :nodoc:
|
283
267
|
@files = files
|
284
268
|
@classes = classes
|
@@ -34,7 +34,7 @@ module RDoc::Generator::Markup
|
|
34
34
|
def formatter
|
35
35
|
return @formatter if defined? @formatter
|
36
36
|
|
37
|
-
options = @store.
|
37
|
+
options = @store.options
|
38
38
|
this = RDoc::Context === self ? self : @parent
|
39
39
|
|
40
40
|
@formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this
|
@@ -147,7 +147,7 @@ class RDoc::TopLevel
|
|
147
147
|
# command line option to set.
|
148
148
|
|
149
149
|
def cvs_url
|
150
|
-
url = @store.
|
150
|
+
url = @store.options.webcvs
|
151
151
|
|
152
152
|
if /%s/ =~ url then
|
153
153
|
url % @relative_name
|
@@ -35,11 +35,11 @@ class RDoc::Generator::POT::MessageExtractor
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
klass.
|
38
|
+
klass.constants.each do |constant|
|
39
39
|
extract_text(constant.comment, constant.full_name)
|
40
40
|
end
|
41
41
|
|
42
|
-
klass.
|
42
|
+
klass.attributes.each do |attribute|
|
43
43
|
extract_text(attribute.comment, attribute.full_name)
|
44
44
|
end
|
45
45
|
|
data/lib/rdoc/generator/pot.rb
CHANGED
@@ -1,34 +1,5 @@
|
|
1
1
|
<div id="classindex-section" class="nav-section">
|
2
2
|
<h3>Class and Module Index</h3>
|
3
3
|
|
4
|
-
|
5
|
-
all_classes = @classes.group_by do |klass|
|
6
|
-
klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
|
7
|
-
end.delete_if do |_, klasses|
|
8
|
-
!klasses.any?(&:display?)
|
9
|
-
end
|
10
|
-
link = proc do |index_klass, display = index_klass.display?|
|
11
|
-
if display
|
12
|
-
-%><code><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a></code><%-
|
13
|
-
else
|
14
|
-
-%><code><%= index_klass.name %></code><%-
|
15
|
-
end
|
16
|
-
end
|
17
|
-
if top = all_classes[nil]
|
18
|
-
solo = top.one? {|klass| klass.display?}
|
19
|
-
traverse = proc do |klasses| -%>
|
20
|
-
<ul class="link-list">
|
21
|
-
<%- klasses.uniq!(&:full_name) -%>
|
22
|
-
<%- klasses.each do |index_klass| -%>
|
23
|
-
<%- if children = all_classes[index_klass.full_name] -%>
|
24
|
-
<li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
|
25
|
-
<%- traverse.call(children) -%>
|
26
|
-
</ul></details>
|
27
|
-
<%- elsif index_klass.display? -%>
|
28
|
-
<li><% link.call(index_klass, true) %>
|
29
|
-
<%- end -%>
|
30
|
-
<%- end -%>
|
31
|
-
<%- end -%>
|
32
|
-
<%- traverse.call(top) -%>
|
33
|
-
<%- end -%>
|
4
|
+
<%= generate_class_index_content(@classes, rel_prefix) %>
|
34
5
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<h3>Extended With Modules</h3>
|
4
4
|
|
5
5
|
<ul class="link-list">
|
6
|
-
<%- klass.
|
6
|
+
<%- klass.extends.each do |ext| -%>
|
7
7
|
<%- unless String === ext.module then -%>
|
8
8
|
<li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
|
9
9
|
<%- else -%>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<h3>Included Modules</h3>
|
4
4
|
|
5
5
|
<ul class="link-list">
|
6
|
-
<%- klass.
|
6
|
+
<%- klass.includes.each do |inc| -%>
|
7
7
|
<%- unless String === inc.module then -%>
|
8
8
|
<li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
|
9
9
|
<%- else -%>
|
@@ -18,6 +18,21 @@
|
|
18
18
|
</nav>
|
19
19
|
|
20
20
|
<main role="main" aria-labelledby="<%=h klass.aref %>">
|
21
|
+
<%# If nesting level is 1, breadcrumb list is not needed %>
|
22
|
+
<% if breadcrumb.size > 1 %>
|
23
|
+
<ol role="navigation" aria-label="breadcrumb" class="breadcrumb">
|
24
|
+
<% breadcrumb.each do |namespace| %>
|
25
|
+
<li>
|
26
|
+
<% if namespace[:self] %>
|
27
|
+
<span><%= namespace[:name] %></span>
|
28
|
+
<% else %>
|
29
|
+
<a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span>::</span>
|
30
|
+
<% end %>
|
31
|
+
</li>
|
32
|
+
<% end %>
|
33
|
+
</ol>
|
34
|
+
<% end %>
|
35
|
+
|
21
36
|
<h1 id="<%=h klass.aref %>" class="anchor-link <%= klass.type %>">
|
22
37
|
<%= klass.type %> <%= klass.full_name %>
|
23
38
|
</h1>
|
@@ -199,6 +199,19 @@ nav h3,
|
|
199
199
|
font-size: 1em;
|
200
200
|
}
|
201
201
|
|
202
|
+
ol.breadcrumb {
|
203
|
+
display: flex;
|
204
|
+
|
205
|
+
padding: 0;
|
206
|
+
margin: 0 0 1em;
|
207
|
+
}
|
208
|
+
|
209
|
+
ol.breadcrumb li {
|
210
|
+
display: block;
|
211
|
+
list-style: none;
|
212
|
+
font-size: 125%;
|
213
|
+
}
|
214
|
+
|
202
215
|
nav ul,
|
203
216
|
nav dl,
|
204
217
|
nav p {
|
data/lib/rdoc/markdown.kpeg
CHANGED
@@ -992,9 +992,8 @@ Strike = &{ strike? }
|
|
992
992
|
"~~"
|
993
993
|
{ strike a.join }
|
994
994
|
|
995
|
-
|
996
|
-
|
997
|
-
{ "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
|
995
|
+
Image = "!" ExplicitLinkWithLabel:a
|
996
|
+
{ "rdoc-image:#{a[:link]}:#{a[:label]}" }
|
998
997
|
|
999
998
|
Link = ExplicitLink | ReferenceLink | AutoLink
|
1000
999
|
|
@@ -1006,8 +1005,11 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label
|
|
1006
1005
|
ReferenceLinkSingle = Label:content < (Spnl "[]")? >
|
1007
1006
|
{ link_to content, content, text }
|
1008
1007
|
|
1009
|
-
ExplicitLink =
|
1010
|
-
|
1008
|
+
ExplicitLink = ExplicitLinkWithLabel:a
|
1009
|
+
{ "{#{a[:label]}}[#{a[:link]}]" }
|
1010
|
+
|
1011
|
+
ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")"
|
1012
|
+
{ { label: label, link: link } }
|
1011
1013
|
|
1012
1014
|
Source = ( "<" < SourceContents > ">" | < SourceContents > )
|
1013
1015
|
{ text }
|
data/lib/rdoc/markdown.rb
CHANGED
@@ -10978,7 +10978,7 @@ class RDoc::Markdown
|
|
10978
10978
|
return _tmp
|
10979
10979
|
end
|
10980
10980
|
|
10981
|
-
# Image = "!"
|
10981
|
+
# Image = "!" ExplicitLinkWithLabel:a { "rdoc-image:#{a[:link]}:#{a[:label]}" }
|
10982
10982
|
def _Image
|
10983
10983
|
|
10984
10984
|
_save = self.pos
|
@@ -10988,24 +10988,13 @@ class RDoc::Markdown
|
|
10988
10988
|
self.pos = _save
|
10989
10989
|
break
|
10990
10990
|
end
|
10991
|
-
|
10992
|
-
_save1 = self.pos
|
10993
|
-
while true # choice
|
10994
|
-
_tmp = apply(:_ExplicitLink)
|
10995
|
-
break if _tmp
|
10996
|
-
self.pos = _save1
|
10997
|
-
_tmp = apply(:_ReferenceLink)
|
10998
|
-
break if _tmp
|
10999
|
-
self.pos = _save1
|
11000
|
-
break
|
11001
|
-
end # end choice
|
11002
|
-
|
10991
|
+
_tmp = apply(:_ExplicitLinkWithLabel)
|
11003
10992
|
a = @result
|
11004
10993
|
unless _tmp
|
11005
10994
|
self.pos = _save
|
11006
10995
|
break
|
11007
10996
|
end
|
11008
|
-
@result = begin; "rdoc-image:#{a[
|
10997
|
+
@result = begin; "rdoc-image:#{a[:link]}:#{a[:label]}" ; end
|
11009
10998
|
_tmp = true
|
11010
10999
|
unless _tmp
|
11011
11000
|
self.pos = _save
|
@@ -11153,13 +11142,36 @@ class RDoc::Markdown
|
|
11153
11142
|
return _tmp
|
11154
11143
|
end
|
11155
11144
|
|
11156
|
-
# ExplicitLink =
|
11145
|
+
# ExplicitLink = ExplicitLinkWithLabel:a { "{#{a[:label]}}[#{a[:link]}]" }
|
11157
11146
|
def _ExplicitLink
|
11158
11147
|
|
11148
|
+
_save = self.pos
|
11149
|
+
while true # sequence
|
11150
|
+
_tmp = apply(:_ExplicitLinkWithLabel)
|
11151
|
+
a = @result
|
11152
|
+
unless _tmp
|
11153
|
+
self.pos = _save
|
11154
|
+
break
|
11155
|
+
end
|
11156
|
+
@result = begin; "{#{a[:label]}}[#{a[:link]}]" ; end
|
11157
|
+
_tmp = true
|
11158
|
+
unless _tmp
|
11159
|
+
self.pos = _save
|
11160
|
+
end
|
11161
|
+
break
|
11162
|
+
end # end sequence
|
11163
|
+
|
11164
|
+
set_failed_rule :_ExplicitLink unless _tmp
|
11165
|
+
return _tmp
|
11166
|
+
end
|
11167
|
+
|
11168
|
+
# ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")" { { label: label, link: link } }
|
11169
|
+
def _ExplicitLinkWithLabel
|
11170
|
+
|
11159
11171
|
_save = self.pos
|
11160
11172
|
while true # sequence
|
11161
11173
|
_tmp = apply(:_Label)
|
11162
|
-
|
11174
|
+
label = @result
|
11163
11175
|
unless _tmp
|
11164
11176
|
self.pos = _save
|
11165
11177
|
break
|
@@ -11175,7 +11187,7 @@ class RDoc::Markdown
|
|
11175
11187
|
break
|
11176
11188
|
end
|
11177
11189
|
_tmp = apply(:_Source)
|
11178
|
-
|
11190
|
+
link = @result
|
11179
11191
|
unless _tmp
|
11180
11192
|
self.pos = _save
|
11181
11193
|
break
|
@@ -11200,7 +11212,7 @@ class RDoc::Markdown
|
|
11200
11212
|
self.pos = _save
|
11201
11213
|
break
|
11202
11214
|
end
|
11203
|
-
@result = begin;
|
11215
|
+
@result = begin; { label: label, link: link } ; end
|
11204
11216
|
_tmp = true
|
11205
11217
|
unless _tmp
|
11206
11218
|
self.pos = _save
|
@@ -11208,7 +11220,7 @@ class RDoc::Markdown
|
|
11208
11220
|
break
|
11209
11221
|
end # end sequence
|
11210
11222
|
|
11211
|
-
set_failed_rule :
|
11223
|
+
set_failed_rule :_ExplicitLinkWithLabel unless _tmp
|
11212
11224
|
return _tmp
|
11213
11225
|
end
|
11214
11226
|
|
@@ -16711,12 +16723,13 @@ class RDoc::Markdown
|
|
16711
16723
|
Rules[:_StrongStar] = rule_info("StrongStar", "\"**\" !@Whitespace @StartList:a (!\"**\" Inline:b { a << b })+ \"**\" { strong a.join }")
|
16712
16724
|
Rules[:_StrongUl] = rule_info("StrongUl", "\"__\" !@Whitespace @StartList:a (!\"__\" Inline:b { a << b })+ \"__\" { strong a.join }")
|
16713
16725
|
Rules[:_Strike] = rule_info("Strike", "&{ strike? } \"~~\" !@Whitespace @StartList:a (!\"~~\" Inline:b { a << b })+ \"~~\" { strike a.join }")
|
16714
|
-
Rules[:_Image] = rule_info("Image", "\"!\"
|
16726
|
+
Rules[:_Image] = rule_info("Image", "\"!\" ExplicitLinkWithLabel:a { \"rdoc-image:\#{a[:link]}:\#{a[:label]}\" }")
|
16715
16727
|
Rules[:_Link] = rule_info("Link", "(ExplicitLink | ReferenceLink | AutoLink)")
|
16716
16728
|
Rules[:_ReferenceLink] = rule_info("ReferenceLink", "(ReferenceLinkDouble | ReferenceLinkSingle)")
|
16717
16729
|
Rules[:_ReferenceLinkDouble] = rule_info("ReferenceLinkDouble", "Label:content < Spnl > !\"[]\" Label:label { link_to content, label, text }")
|
16718
16730
|
Rules[:_ReferenceLinkSingle] = rule_info("ReferenceLinkSingle", "Label:content < (Spnl \"[]\")? > { link_to content, content, text }")
|
16719
|
-
Rules[:_ExplicitLink] = rule_info("ExplicitLink", "
|
16731
|
+
Rules[:_ExplicitLink] = rule_info("ExplicitLink", "ExplicitLinkWithLabel:a { \"{\#{a[:label]}}[\#{a[:link]}]\" }")
|
16732
|
+
Rules[:_ExplicitLinkWithLabel] = rule_info("ExplicitLinkWithLabel", "Label:label \"(\" @Sp Source:link Spnl Title @Sp \")\" { { label: label, link: link } }")
|
16720
16733
|
Rules[:_Source] = rule_info("Source", "(\"<\" < SourceContents > \">\" | < SourceContents >) { text }")
|
16721
16734
|
Rules[:_SourceContents] = rule_info("SourceContents", "((!\"(\" !\")\" !\">\" Nonspacechar)+ | \"(\" SourceContents \")\")*")
|
16722
16735
|
Rules[:_Title] = rule_info("Title", "(TitleSingle | TitleDouble | \"\"):a { a }")
|
data/lib/rdoc/markup/heading.rb
CHANGED
@@ -66,7 +66,13 @@ RDoc::Markup::Heading =
|
|
66
66
|
# element.
|
67
67
|
|
68
68
|
def plain_html
|
69
|
-
self.
|
69
|
+
text = self.text.dup
|
70
|
+
|
71
|
+
if matched = text.match(/rdoc-image:[^:]+:(.*)/)
|
72
|
+
text = matched[1]
|
73
|
+
end
|
74
|
+
|
75
|
+
self.class.to_html.to_html(text)
|
70
76
|
end
|
71
77
|
|
72
78
|
def pretty_print q # :nodoc:
|
data/lib/rdoc/markup/to_html.rb
CHANGED
@@ -98,7 +98,12 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
98
98
|
|
99
99
|
gen_url CGI.escapeHTML(url), CGI.escapeHTML(text)
|
100
100
|
when /^rdoc-image:/
|
101
|
-
|
101
|
+
url, alt = $'.split(":", 2) # Split the string after "rdoc-image:" into url and alt
|
102
|
+
if alt && !alt.empty?
|
103
|
+
%[<img src="#{CGI.escapeHTML(url)}" alt="#{CGI.escapeHTML(alt)}">]
|
104
|
+
else
|
105
|
+
%[<img src="#{CGI.escapeHTML(url)}">]
|
106
|
+
end
|
102
107
|
when /\Ardoc-[a-z]+:/
|
103
108
|
CGI.escapeHTML($')
|
104
109
|
end
|
data/lib/rdoc/parser/c.rb
CHANGED
@@ -248,9 +248,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
248
248
|
# method that reference the same function.
|
249
249
|
|
250
250
|
def add_alias(var_name, class_obj, old_name, new_name, comment)
|
251
|
-
al = RDoc::Alias.new '', old_name, new_name,
|
252
|
-
al.singleton = @singleton_classes.key? var_name
|
253
|
-
al.comment = comment
|
251
|
+
al = RDoc::Alias.new '', old_name, new_name, comment, singleton: @singleton_classes.key?(var_name)
|
254
252
|
al.record_location @top_level
|
255
253
|
class_obj.add_alias al
|
256
254
|
@stats.add_alias al
|
@@ -810,7 +808,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
810
808
|
|
811
809
|
def find_modifiers comment, meth_obj
|
812
810
|
comment.normalize
|
813
|
-
comment.extract_call_seq
|
811
|
+
meth_obj.call_seq = comment.extract_call_seq
|
814
812
|
|
815
813
|
look_for_directives_in meth_obj, comment
|
816
814
|
end
|
@@ -1015,10 +1013,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1015
1013
|
type = 'method' # force public
|
1016
1014
|
end
|
1017
1015
|
|
1018
|
-
|
1016
|
+
singleton = singleton || %w[singleton_method module_function].include?(type)
|
1017
|
+
meth_obj = RDoc::AnyMethod.new '', meth_name, singleton: singleton
|
1019
1018
|
meth_obj.c_function = function
|
1020
|
-
meth_obj.singleton =
|
1021
|
-
singleton || %w[singleton_method module_function].include?(type)
|
1022
1019
|
|
1023
1020
|
p_count = Integer(param_count) rescue -1
|
1024
1021
|
|