rdoc 6.14.2 → 6.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff34d02bfaa6b5e36bd3ab29b6fdfc10e41a50ba0fbef3841aed3e59d22e8d29
4
- data.tar.gz: bee9f682708babef768b5fe0b5b68a505ad09ba255c20c00fdefb52cd5135566
3
+ metadata.gz: 737b80cad7809fc0b20efe70270867bcc3a7f3ae7c5c0e1f818769b8ab40c7cc
4
+ data.tar.gz: 6754787e054cab04658a068f8e3a2be8cacb1473991d91a330beb0118bf22930
5
5
  SHA512:
6
- metadata.gz: 10729c09826000d5ac6d4137fdba80b36dd7da96c66475ee03fcfe527dd159a74f41ec8c1a5cb588373c4007ea02a18cd9ca5e09e1766125daab7e84ca17a6ae
7
- data.tar.gz: 785c69b91032d0e72810f91c56271d100d03439355bda96f808faaea60ec2768caab376a8420bbbb72e7bbeb6c50a06ed5a002c668342aa80444ee7d0b1c2a6f
6
+ metadata.gz: fad664b000fbb058f96f2e7f032ba767b86213a21380cf584d30ff34710acc5c383bc5053b2a06e3e7190c9f4188d397ba7bc9be226d82231fd2bad76c046258
7
+ data.tar.gz: 5afe676ff848a49515c6fba65fc5e8a4b765c5e52af6c0128caa36a7a1253a41fc3ac0b0ef2098f74fd69269e285c8d3ec67128cc631b60c97062c5c9fe7cbc0
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # RDoc - Ruby Documentation System
2
+
3
+ - GitHub: [https://github.com/ruby/rdoc](https://github.com/ruby/rdoc)
4
+ - Issues: [https://github.com/ruby/rdoc/issues](https://github.com/ruby/rdoc/issues)
5
+
6
+ ## Description
7
+
8
+ RDoc produces HTML and command-line documentation for Ruby projects. RDoc includes the `rdoc` and `ri` tools for generating and displaying documentation from the command-line.
9
+
10
+ ## Generating Documentation
11
+
12
+ Once installed, you can create documentation using the `rdoc` command
13
+
14
+ ```shell
15
+ rdoc [options] [names...]
16
+ ```
17
+
18
+ For an up-to-date option summary, type
19
+
20
+ ```shell
21
+ rdoc --help
22
+ ```
23
+
24
+ A typical use might be to generate documentation for a package of Ruby source (such as RDoc itself).
25
+
26
+ ```shell
27
+ rdoc
28
+ ```
29
+
30
+ This command generates documentation for all the Ruby and C source files in and below the current directory. These will be stored in a documentation tree starting in the subdirectory `doc`.
31
+
32
+ You can make this slightly more useful for your readers by having the index page contain the documentation for the primary file. In our case, we could type
33
+
34
+ ```shell
35
+ rdoc --main README.md
36
+ ```
37
+
38
+ You'll find information on the various formatting tricks you can use in comment blocks in the documentation this generates.
39
+
40
+ RDoc uses file extensions to determine how to process each file. File names ending `.rb` and `.rbw` are assumed to be Ruby source. Files ending `.c` are parsed as C files. All other files are assumed to contain just Markup-style markup (with or without leading `#` comment markers). If directory names are passed to RDoc, they are scanned recursively for C and Ruby source files only.
41
+
42
+ To generate documentation using `rake` see [RDoc::Task](https://ruby.github.io/rdoc/RDoc/Task.html).
43
+
44
+ To generate documentation programmatically:
45
+
46
+ ```rb
47
+ require 'rdoc/rdoc'
48
+
49
+ options = RDoc::Options.new
50
+ options.files = ['a.rb', 'b.rb']
51
+ options.setup_generator 'darkfish'
52
+ # see RDoc::Options
53
+
54
+ rdoc = RDoc::RDoc.new
55
+ rdoc.document options
56
+ # see RDoc::RDoc
57
+ ```
58
+
59
+ You can specify the target files for document generation with `.document` file in the project root directory. `.document` file contains a list of file and directory names including comment lines starting with `#`. See [https://github.com/ruby/rdoc/blob/master/.document](https://github.com/ruby/rdoc/blob/master/.document) as an example.
60
+
61
+ ## Writing Documentation
62
+
63
+ To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
64
+
65
+ ```rb
66
+ ##
67
+ # This class represents an arbitrary shape by a series of points.
68
+ class Shape
69
+ ##
70
+ # Creates a new shape described by a +polyline+.
71
+ #
72
+ # If the +polyline+ does not end at the same point it started at the
73
+ # first pointed is copied and placed at the end of the line.
74
+ #
75
+ # An ArgumentError is raised if the line crosses itself, but shapes may
76
+ # be concave.
77
+ def initialize polyline
78
+ # ...
79
+ end
80
+ end
81
+ ```
82
+
83
+ The default comment markup format is the RDoc::Markup format. TomDoc, Markdown and RD format comments are also supported. You can set the default comment format for your entire project by creating a `.rdoc_options` file. See RDoc::Options@Saved+Options for instructions on creating one. You can also set the comment format for a single file through the `:markup:` directive, but this is only recommended if you wish to switch markup formats. See RDoc::Markup@Other+directives.
84
+
85
+ Comments can contain directives that tell RDoc information that it cannot otherwise discover through parsing. See RDoc::Markup@Directives to control what is or is not documented, to define method arguments or to break up methods in a class by topic. See RDoc::Parser::Ruby for directives used to teach RDoc about metaprogrammed methods.
86
+
87
+ See RDoc::Parser::C for documenting C extensions with RDoc.
88
+
89
+ To determine how well your project is documented run `rdoc -C lib` to get a documentation coverage report. `rdoc -C1 lib` includes parameter names in the documentation coverage report.
90
+
91
+ ## Theme Options
92
+
93
+ There are a few community-maintained themes for RDoc:
94
+
95
+ - [rorvswild-theme-rdoc](https://github.com/BaseSecrete/rorvswild-theme-rdoc)
96
+ - [hanna](https://github.com/jeremyevans/hanna) (a fork maintained by [Jeremy Evans](https://github.com/jeremyevans))
97
+
98
+ Please follow the theme's README for usage instructions.
99
+
100
+ ## Bugs
101
+
102
+ See CONTRIBUTING.rdoc for information on filing a bug report. It's OK to file a bug report for anything you're having a problem with. If you can't figure out how to make RDoc produce the output you like that is probably a documentation bug.
103
+
104
+ ## License
105
+
106
+ RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. Portions (c) 2007-2011 Eric Hodel. Portions copyright others, see individual files and LEGAL.rdoc for details.
107
+
108
+ RDoc is free software, and may be redistributed under the terms specified in LICENSE.rdoc.
109
+
110
+ ## Warranty
111
+
112
+ This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
data/RI.md CHANGED
@@ -48,7 +48,7 @@ the [Ruby online documentation](https://docs.ruby-lang.org/en/master):
48
48
  - If you are working in a terminal window, typing `ri _whatever_` (or just `ri`)
49
49
  may be faster than navigating to a browser window and searching for documentation.
50
50
  - If you are working in an
51
- [irb \(interactive Ruby\)](https://docs.ruby-lang.org/en/master/IRB.html)
51
+ [irb \(interactive Ruby\)](https://ruby.github.io/irb/index.html)
52
52
  session, you _already_ have immediate access to `ri`:
53
53
  just type `'show_doc'`.
54
54
 
@@ -114,14 +114,6 @@ class RDoc::TopLevel < RDoc::Context
114
114
 
115
115
  alias name base_name
116
116
 
117
- ##
118
- # Only a TopLevel that contains text file) will be displayed. See also
119
- # RDoc::CodeObject#display?
120
-
121
- def display?
122
- text? and super
123
- end
124
-
125
117
  ##
126
118
  # See RDoc::TopLevel::find_class_or_module
127
119
  #--
@@ -200,7 +200,7 @@ class RDoc::CrossReference
200
200
  ref = resolve_method name unless ref
201
201
 
202
202
  # Try a page name
203
- ref = @store.page name if not ref and name =~ /^[\w.]+$/
203
+ ref = @store.page name if not ref and name =~ /^[\w.\/]+$/
204
204
 
205
205
  ref = nil if RDoc::Alias === ref # external alias, can't link to it
206
206
 
@@ -72,10 +72,30 @@ function hookSearch() {
72
72
  }
73
73
 
74
74
  search.select = function(result) {
75
- window.location.href = result.firstChild.firstChild.href;
75
+ var href = result.firstChild.firstChild.href;
76
+ var query = this.input.value;
77
+ if (query) {
78
+ var url = new URL(href, window.location.origin);
79
+ url.searchParams.set('q', query);
80
+ url.searchParams.set('nav', '0');
81
+ href = url.toString();
82
+ }
83
+ window.location.href = href;
76
84
  }
77
85
 
78
86
  search.scrollIntoView = search.scrollInWindow;
87
+
88
+ // Check for ?q= URL parameter and trigger search automatically
89
+ if (typeof URLSearchParams !== 'undefined') {
90
+ var urlParams = new URLSearchParams(window.location.search);
91
+ var queryParam = urlParams.get('q');
92
+ if (queryParam) {
93
+ var navParam = urlParams.get('nav');
94
+ var autoSelect = navParam !== '0';
95
+ input.value = queryParam;
96
+ search.search(queryParam, autoSelect);
97
+ }
98
+ }
79
99
  };
80
100
 
81
101
  function hookFocus() {
@@ -34,6 +34,8 @@ Search.prototype = Object.assign({}, Navigation, new function() {
34
34
  }
35
35
 
36
36
  this.search = function(value, selectFirstMatch) {
37
+ this.selectFirstMatch = selectFirstMatch;
38
+
37
39
  value = value.trim().toLowerCase();
38
40
  if (value) {
39
41
  this.setNavigationActive(true);
@@ -76,7 +78,15 @@ Search.prototype = Object.assign({}, Navigation, new function() {
76
78
  //TODO: ECMAScript
77
79
  //if (jQuery.browser.msie) this.$element[0].className += '';
78
80
 
79
- if (isLast) this.result.setAttribute('aria-busy', 'false');
81
+ if (this.selectFirstMatch && this.current) {
82
+ this.selectFirstMatch = false;
83
+ this.select(this.current);
84
+ }
85
+
86
+ if (isLast) {
87
+ this.selectFirstMatch = false;
88
+ this.result.setAttribute('aria-busy', 'false');
89
+ }
80
90
  }
81
91
 
82
92
  this.move = function(isDown) {
@@ -58,7 +58,12 @@ Searcher.prototype = new function() {
58
58
 
59
59
  function buildRegexps(queries) {
60
60
  return queries.map(function(query) {
61
- return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
61
+ var pattern = [];
62
+ for (var i = 0; i < query.length; i++) {
63
+ var char = RegExp.escape(query[i]);
64
+ pattern.push('([' + char + '])([^' + char + ']*?)');
65
+ }
66
+ return new RegExp(pattern.join(''), 'i');
62
67
  });
63
68
  }
64
69
 
@@ -497,6 +497,17 @@
497
497
  end
498
498
  end
499
499
 
500
+ ##
501
+ # Wraps `text` in code markup for rdoc inline formatting
502
+
503
+ def code text
504
+ # trim even spaces
505
+ text = $2 while /\A( +|\t+)(.*)\1\z/ =~ text
506
+ # escape unescaped backslash at the end
507
+ backslash_at_end = "\\" if /(?<!\\)(?:\\\\)*\\\z/.match?(text)
508
+ "<code>#{text}#{backslash_at_end}</code>"
509
+ end
510
+
500
511
  ##
501
512
  # Parses inline markdown in table cells
502
513
 
@@ -1104,32 +1115,32 @@ Ticks3 = "```" !"`"
1104
1115
  Ticks4 = "````" !"`"
1105
1116
  Ticks5 = "`````" !"`"
1106
1117
 
1107
- Code = ( Ticks1 @Sp < (
1118
+ Code = ( Ticks1 < (
1108
1119
  ( !"`" Nonspacechar )+ | !Ticks1 /`+/ |
1109
- !( @Sp Ticks1 ) ( @Spacechar | @Newline !@BlankLine )
1110
- )+ > @Sp Ticks1 |
1111
- Ticks2 @Sp < (
1120
+ !Ticks1 ( @Spacechar | @Newline !@BlankLine )
1121
+ )+ > Ticks1 |
1122
+ Ticks2 < (
1112
1123
  ( !"`" Nonspacechar )+ |
1113
1124
  !Ticks2 /`+/ |
1114
- !( @Sp Ticks2 ) ( @Spacechar | @Newline !@BlankLine )
1115
- )+ > @Sp Ticks2 |
1116
- Ticks3 @Sp < (
1125
+ !Ticks2 ( @Spacechar | @Newline !@BlankLine )
1126
+ )+ > Ticks2 |
1127
+ Ticks3 < (
1117
1128
  ( !"`" Nonspacechar )+ |
1118
1129
  !Ticks3 /`+/ |
1119
- !( @Sp Ticks3 ) ( @Spacechar | @Newline !@BlankLine )
1120
- )+ > @Sp Ticks3 |
1121
- Ticks4 @Sp < (
1130
+ !Ticks3 ( @Spacechar | @Newline !@BlankLine )
1131
+ )+ > Ticks3 |
1132
+ Ticks4 < (
1122
1133
  ( !"`" Nonspacechar )+ |
1123
1134
  !Ticks4 /`+/ |
1124
- !( @Sp Ticks4 ) ( @Spacechar | @Newline !@BlankLine )
1125
- )+ > @Sp Ticks4 |
1126
- Ticks5 @Sp < (
1135
+ !Ticks4 ( @Spacechar | @Newline !@BlankLine )
1136
+ )+ > Ticks4 |
1137
+ Ticks5 < (
1127
1138
  ( !"`" Nonspacechar )+ |
1128
1139
  !Ticks5 /`+/ |
1129
- !( @Sp Ticks5 ) ( @Spacechar | @Newline !@BlankLine )
1130
- )+ > @Sp Ticks5
1140
+ !Ticks5 ( @Spacechar | @Newline !@BlankLine )
1141
+ )+ > Ticks5
1131
1142
  )
1132
- { "<code>#{text}</code>" }
1143
+ { code text }
1133
1144
 
1134
1145
  RawHtml = < (HtmlComment | HtmlBlockScript | HtmlTag) >
1135
1146
  { if html? then text else '' end }
@@ -1253,7 +1264,7 @@ TableRow = ( ( TableItem:item1 TableItem2*:items { [item1, *items] } ):row | Tab
1253
1264
  { row }
1254
1265
  TableItem2 = "|" TableItem
1255
1266
  TableItem = < /(?:\\.|[^|\n])+/ >
1256
- { text.strip.gsub(/\\(.)/, '\1') }
1267
+ { text.strip.gsub(/\\([|])/, '\1') }
1257
1268
 
1258
1269
  TableLine = ( ( TableAlign:align1 TableAlign2*:aligns {[align1, *aligns] } ):line | TableAlign2+:line ) "|"? @Newline
1259
1270
  { line }