Commit graph

745 commits

Author SHA1 Message Date
Petrik
2a57e6e6ed [ruby/rdoc] Don't document aliases with trailing :nodoc directive
Attribute readers and writers can be marked as `:nodoc` to keep them
undocumented:

```ruby
attr_reader :name # :nodoc:
```

For aliases this behaviour should be the same:

```ruby
alias_method :old :new # :nodoc:
```

30f14e8271
2024-02-09 01:07:17 +00:00
Nobuyoshi Nakada
7558625be1 [ruby/rdoc] Respect modeline to detect parser
485468f06f
2024-01-11 06:55:39 +00:00
Nobuyoshi Nakada
7fcc6f04ac [ruby/rdoc] Visibility should begin from public for each scope
Even for singleton class definition such as `class << self` that
shares the same container with the outer scope, its visibility is
separated and set to `public` by default.

baf26363b9
2024-01-07 11:39:46 +00:00
Nobuyoshi Nakada
2325b72cf3 [ruby/rdoc] Singleton method visibility should be isolated
Each singleton method definition of the form `def recv.method` has
visibility separate from the outer scope and is set to `public` by
default.

810913a7ea
2024-01-07 11:39:45 +00:00
Nobuyoshi Nakada
f6847e9456 [ruby/rdoc] Ignore locale at write_options
`@locale` is set from `@locale_name` and loaded from `@locale_dir`
after `write_options`, and `RDoc::I18n::Locale` does not seem to
expected to be loaded.

fd610f7023
2024-01-06 10:17:49 +00:00
Nobuyoshi Nakada
569a06aa2f [ruby/rdoc] Allow empty name rdoc-ref as a local link
914a6af137
2023-12-31 15:19:50 +00:00
Nobuyoshi Nakada
e324953090 [ruby/rdoc] Fix support for rb_file_const and rb_curses_define_const
Constant definitions using these functions have been supported, but
since RDoc::Parser::C#gen_const_table did not consider other than
`rb_define_const` the documents for them have not been found, without
`Document-const` direvtive.

Fixes https://github.com/ruby/rdoc/issues/1067

cdad51a60b
2023-12-25 21:12:49 +09:00
Hiroshi SHIBATA
6c7c4ac407 [ruby/rdoc] Bump up v6.6.2
895f1affc0
2023-12-16 11:42:30 +08:00
Nobuyoshi Nakada
20f4f00764 [ruby/rdoc] [DOC] nodoc for probably internal methods
f7dd147a8c
2023-12-16 00:26:39 +09:00
Nobuyoshi Nakada
e15d690db1 [ruby/rdoc] [DOC] Add missing documents
e4c90340d0
2023-12-16 00:26:37 +09:00
Nobuyoshi Nakada
b257181ccc [ruby/rdoc] Remove unused method RDoc::Encoding.remove_frozen_string_literal
7a8e9a97fa
2023-12-16 00:25:51 +09:00
Nobuyoshi Nakada
e03e872eea [ruby/rdoc] Only word-ending colon separates new definition
When followed by non-space characters, rather it looks like a URL or a
path name on Windows.

72c6560773
2023-12-06 09:35:44 +00:00
Nobuyoshi Nakada
379f06797d [ruby/rdoc] Needs more backslash to match escaping backslashs
1904e9076d
2023-12-06 09:35:43 +00:00
Nobuyoshi Nakada
113f5d7fd7 [ruby/rdoc] Allow any single-word token upto 2 before C method implementation
Previously only unknown word `intern` is allowed between a single-word
token before a C method.  Now any single-word token, such as `inline`
which is used for `ArithmeticSequence` in enumerator.c, is allowed
instead.

3a214c1dd1
2023-12-05 08:48:19 +00:00
Nobuyoshi Nakada
c0baa3783f [ruby/rdoc] Reduce matched substring allocations
aaed688a97
2023-12-05 08:48:18 +00:00
Hiroshi SHIBATA
d691b1a141 [ruby/rdoc] Bump up 6.6.1
7cf353a696
2023-12-05 07:37:08 +00:00
Toshimaru
56ccad060d [ruby/rdoc] Early return when token_stream is nil
04f75d8516

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-12-05 06:21:52 +00:00
toshimaru
cda431f538 [ruby/rdoc] fix: fix NoMethodError when token_stream is nil
The change in #1055 might be a breaking change.
So, just simply wrap `token_stream` with `Array`

d8c19d7fa1

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-12-05 06:21:51 +00:00
Nobuyoshi Nakada
c9c1670f7e [ruby/rdoc] Markup punctuations need to be separated with a space
83f0149fc1
2023-12-02 12:40:12 +00:00
Nobuyoshi Nakada
7973eb7c3f [ruby/rdoc] [DOC] Slightly decorate em and strong
2161157205
2023-11-27 16:07:03 +00:00
Nobuyoshi Nakada
196c4aeb76 [ruby/rdoc] Place a space between certain character class letters only
1f568e049d
2023-11-27 15:58:31 +00:00
Nobuyoshi Nakada
e374512682 [ruby/rdoc] Revert "chore: Remove unnecessary argument for join method"
This reverts commit 4a1c74bc0a.

Since RDoc still supports ruby 2.6 which has not deprecated `$,`, the
argument of `Array#join` is not unnecessary yet.

72897d32ed
2023-11-16 02:22:08 +00:00
toshimaru
8d160b9350 [ruby/rdoc] chore: Remove unnecessary argument for join method
4a1c74bc0a
2023-11-16 01:43:12 +00:00
toshimaru
72242e69aa [ruby/rdoc] fix: Fix NoMethodError for tokens_to_s method
Calling `tokens_to_s` gets an error if `token_stream` is nil:

```
undefined method `compact' for nil:NilClass (NoMethodError)
```

So, fall back to an empty array if `@token_stream` is nil.

452e4a2600
2023-11-16 01:43:12 +00:00
Nobuyoshi Nakada
9935512275 [ruby/rdoc] Fix TIDYLINK after braces
(https://github.com/ruby/rdoc/pull/1015)

TIDYLINK multi-word label should not include braces.

41ad3191e9
2023-11-14 07:59:56 +00:00
Hiroshi SHIBATA
7a6c72e03d
Update rdoc parsers generated by racc-1.7.3 2023-11-06 17:53:00 +09:00
Hiroshi SHIBATA
ee13da3e2a [ruby/rdoc] Bump up 6.6.0
9c14229876
2023-11-06 17:40:34 +09:00
tompng
2a8ac8ead5 [ruby/rdoc] Delay DidYouMean until NotFoundError#message is called
b59ca2f981
2023-10-17 11:07:57 +00:00
BurdetteLamar
b4ab013b27
[DOC] Link fixes 2023-10-03 16:31:34 +09:00
Nobuyoshi Nakada
dab6d55db1 [ruby/rdoc] Remove code for versions older than Ruby 2.6
0d10f460eb
2023-09-05 01:14:52 +00:00
Nobuyoshi Nakada
736092ec11 [ruby/rdoc] Remove code for versions older than Ruby 2.3
a61b777df0
2023-09-05 01:14:51 +00:00
Jeremy Evans
3f6c92e9d5 [ruby/rdoc] Omit descriptions and parameter lists for methods defined in C not mentioned in call-seq
This allows RDoc to better generate documentation for methods
following the Ruby core documentation guide (which omits aliases
in call-seq in most cases).  This makes documentation for methods
defined in C more similar to methods defined in Ruby.  For methods
defined in Ruby, the method description of the aliased method is
already not used (you have to explicitly document the alias to
use it).

Internally, this adds AnyMethod#has_call_seq? and #skip_description?,
and updates Darkfish to:

* only show the method name if there is a call-seq for the method,
  but the call-seq omits the method
* to omit the method description if the method is an alias or has
  aliases and has a call-seq that does not include the method

See discussion in https://github.com/ruby/ruby/pull/7316 for
details.

e3688de49b
2023-09-05 00:45:42 +00:00
theo-squadracer
a14ba622da [ruby/rdoc] handle symbols declared with %s
ed91c4b784
2023-09-05 00:37:30 +00:00
Benoit Daloze
df5330b04e [ruby/rdoc] Use a more portable way to check if code is parseable
* The same as used in irb: https://github.com/ruby/irb/pull/134/files
* This works on all Ruby implementations, unlike `return` in BEGIN which
  can be quite difficult to support.

d19f7c66fe
2023-07-29 15:31:48 +00:00
Masafumi Koba
62b4983416 [ruby/rdoc] [DOC] Improve CSS for "toggle source" hovering over one more method signatures
This commit improves the behavior of showing the "toggle source" element on mouseover.

For example, when a method has one more signatures by using `:call-seq:`,

```ruby
# :call-seq:
#   foo {|element| ... } -> self
#   foo -> new_enumeration
def foo
end
```

The current CSS doesn't show "toggle source" even when hovering the second signature `foo -> new_enumeration`.
But this change will show "toggle source" always when hovering over any signature.

For details about the `.method-header` element, see `lib/rdoc/generator/template/darkfish/class.rhtml`:
0e060c69f5/lib/rdoc/generator/template/darkfish/class.rhtml (L101-L124)

For example, see https://docs.ruby-lang.org/en/3.2/Array.html#method-i-delete
2023-07-05 04:09:08 +00:00
Vinicius Stock
f9288fb585 [ruby/rdoc] Add source_code, homepage and changelog uris to gemspec metadata [ci skip]
b93687fdd0
2023-07-05 04:08:17 +00:00
gemmaro
62754503d8 [ruby/rdoc] [DOC] Fix to use KeyboardEvent.key over keyCode
663edc807c
2023-07-05 03:39:18 +00:00
gemmaro
77fa4787bd [ruby/rdoc] Add keydown event listener to focus on search field
db62e47df2
2023-07-05 03:37:28 +00:00
Petrik
0c55ef1150 [ruby/rdoc] Use flat_map for better performance
76192a280d
2023-06-14 23:47:25 +00:00
Hiroshi SHIBATA
6e93320c1b
Update RDoc::RD parsers generated by racc-1.7.1 2023-06-14 12:56:34 +09:00
Hiroshi SHIBATA
7ef1a2387e
Re-generate RDoc::RD parsers with racc-1.7.0 2023-06-08 10:20:32 +09:00
Vinicius Stock
a4d92475f6 [ruby/rdoc] Auto-correct trailing new lines
4b68c0728a
2023-06-03 01:42:29 +00:00
Masafumi Koba
94e5ecbbdd [ruby/rdoc] Improve <summary> CSS on sidebar
- Use a smaller font size for the toggle symbol. (Currently, it seems a little too large)
- Use the child combinator (`>`) to unify selectors.
- Use `margin-left` instead of whitespace within the `content` property.
- Use `::` instead of outdated `:` for the pseudo-element symbol.
  (See https://developer.mozilla.org/en-US/docs/Web/CSS/::before)

61ce0a7d75
2023-05-26 16:26:46 +00:00
Masafumi Koba
54b7ce0bff [ruby/rdoc] Improve layout CSS
- Use the `grid` property for the page layout.
  - https://caniuse.com/css-grid
- Adjust the `<main>` margin.
- Make the sidebar responsive and resizable.
  - https://caniuse.com/css-math-functions
  - https://caniuse.com/css-resize

Note all modern browsers support the new CSS properties and functions used by this change.

2db5097c41
2023-05-26 16:24:57 +00:00
zzak
8b2884c0b5 [ruby/rdoc] Isolate root dir if specified
This ensures only files from the root directory are chosen, in order to allow a clean build from outside the source directory.

f3b389aa9e
2023-05-06 07:39:24 +00:00
Nobuyoshi Nakada
40438fc4d3 [ruby/rdoc] Drop the support for 2.5 or earlier because of CVE-2021-31799
26136138aa
2023-05-05 14:01:50 +00:00
Nobuyoshi Nakada
32cc6301b3 [ruby/rdoc] [DOC] stop documenting fallback MatchData#match_length
Also empty document of `Object`.

ce32a3102b
2023-05-02 17:06:36 +00:00
Nobuyoshi Nakada
e47aa27dc7 [ruby/rdoc] Section may not have label
945f0cb3e9
2023-05-02 05:42:37 +00:00
Nobuyoshi Nakada
3833d0fee6 [ruby/rdoc] Fix references to nested label in table_of_contents
Fixes https://github.com/ruby/rdoc/pull/1000

291e2b7e8b
2023-05-02 04:19:46 +00:00
Nobuyoshi Nakada
c2871161b4 [ruby/rdoc] Fix polynominal backtracking
Fix https://github.com/ruby/rdoc/pull/995

1311ca8c50
2023-04-29 16:55:37 +00:00