Commit graph

104 commits

Author SHA1 Message Date
Nobuyoshi Nakada
7973eb7c3f [ruby/rdoc] [DOC] Slightly decorate em and strong
2161157205
2023-11-27 16:07:03 +00:00
Nobuyoshi Nakada
dab6d55db1 [ruby/rdoc] Remove code for versions older than Ruby 2.6
0d10f460eb
2023-09-05 01:14:52 +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
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
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
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
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
nick evans
29862ce273 [ruby/rdoc] Darkfish: group method call-seq in div.method-header
This way, custom CSS styles can be easily applied to the entire method
header at once.  Otherwise, it can be tricky to make a border that goes
around the entire set of method call-seq, but not the method
description.

5db4bce01e
2022-11-27 17:24:17 +00:00
nick evans
ae3817bc61 [ruby/rdoc] Darkfish: Nest sidebar ToC as a tree of headings
This uses `<details><summary>heading</summary><ul>nested</ul></detail>`,
similar to how the classes and pages lists are now nested.

e57beff287
2022-11-27 17:18:16 +00:00
Nobuyoshi Nakada
511864d1a7 [ruby/rdoc] Refine regexp usages and reduce substring allocations
a976fb9d39
2022-11-27 16:35:08 +00:00
Nobuyoshi Nakada
39909d8c18 [ruby/rdoc] Escape search results
https://hackerone.com/reports/1321358

2ebf8fd510
2022-10-07 12:12:09 +09:00
Nobuyoshi Nakada
a3cb09c7d1 [ruby/rdoc] Escape file names
https://hackerone.com/reports/1321358

8c07cc4657
2022-10-07 12:12:08 +09:00
Nobuyoshi Nakada
8d0b2162a0 [ruby/rdoc] Escape main title
https://hackerone.com/reports/1187156

5dedb5741d
2022-10-07 12:09:23 +09:00
Nobuyoshi Nakada
92ef73a918 [ruby/rdoc] Expand the enclosing tree of the current file
f9f90ef2ff
2022-03-22 01:32:13 +09:00
Nobuyoshi Nakada
dafe5c1323 [ruby/rdoc] Fold files in the page directory
b7b4cdab6c
2022-03-22 01:32:12 +09:00
Nobuyoshi Nakada
73541cdc2f
[ruby/rdoc] Allow method source code to scroll [ci skip]
1bb0496c53
2022-03-20 15:42:56 +09:00
Nobuyoshi Nakada
20ad09e560 [ruby/rdoc] Use the custom style details summary only in nav-section
7736d3a89c
2022-03-20 15:38:28 +09:00
Nobuyoshi Nakada
0bf194fb33 [ruby/rdoc] Start with open when only one visible class/module
6bb93001db
2022-03-14 14:48:13 +09:00
Nobuyoshi Nakada
976431d9ed [ruby/rdoc] Fold class and module index
4c7c46fcc4
2022-03-14 14:48:12 +09:00
Masafumi Koba
2e4516be26 [ruby/rdoc] Scrollable sidebar
This change makes the sidebar scrollable via `position: sticky` and `overflow: auto`;
See also <https://caniuse.com/?search=sticky>

4d52e24840
2022-03-11 17:38:13 +09:00
aycabta
4b024234b2 [ruby/rdoc] Update SourceCodePro font files
d3201d0d47
2021-10-11 21:15:07 +09:00
Nobuyoshi Nakada
76c7388c1f [ruby/rdoc] Add tests for --template-stylesheets option
Also flattens `@options.template_stylesheets` when parsing the
command lines.

Fixes #205
Fixes #828 too

857002a763
2021-09-03 19:13:15 +09:00
Nobuyoshi Nakada
10b082064e [ruby/rdoc] Add table style
2219c5ae80
2021-03-16 15:47:27 +09:00
Pankaj Doharey
05898c5b90 [ruby/rdoc] Update Rdoc.css sidebar panel.
Updates css so the sidebar look like a panel instead of looking like chopped edges.

b0098c6d72
2021-03-16 15:47:27 +09:00
Marc-Andre Lafortune
867f0c6793 [ruby/rdoc] Prefer require_relative 2020-09-14 12:59:11 -04:00
Benoit Tigeot
7693aa7056 [ruby/rdoc] Remove empty lines from html file by using ERB trim_mode flag
9e27299a46
2020-07-22 02:34:58 +09:00
Nobuyoshi Nakada
e6d1363ae6 [ruby/rdoc] Fixed inverted CSS for note-list and label-list
a13d6439da
2020-05-24 23:47:24 +09:00
aycabta
32e0ff26e0 [ruby/rdoc] Delegate ERB args correctly
82ff37a822
2020-05-24 23:47:24 +09:00
Jeremy Evans
7e7981c84f [ruby/rdoc] Treat multiple Ruby methods calling the same C method as aliases
Previously, only calls to rb_define_alias were treated as aliases.
This treats calls to rb_define_method with the same C function as
aliases, with the first function defined being the primary method.

This move the dedup code from the C parser to AnyMethod, and has
AnyMethod look in its aliases to find the call_seq.

Switch the deduplication code to remove lines matching one of the
other aliases, instead of only keeping lines matching the current
alias.  The previous approach could eliminate all call_seq lines
in cases where no line matched.  This was necessary to pass
tests when call_seq does deduplication by default.

The only change to the darkfish template is to not perform
unnecessary work by deduplicating twice.

0ead78616b
2020-05-24 23:47:24 +09:00
Jeremy Evans
d08e1004e0 Fix keyword argument separation issues in lib
Mostly requires adding ** in either calls or method definitions.
2019-08-30 12:39:31 -07:00
Kazuhiro NISHIYAMA
989e8ad322
Remove debug print [ci skip] 2019-08-28 10:34:56 +09:00
aycabta
f308ab2131 Remove jquery.js 2019-08-28 01:12:14 +09:00
aycabta
39810b4035 Good bye jQuery 2019-08-28 00:48:12 +09:00
Maxime Lapointe
21ce8b3298 [ruby/rdoc] Fix image links in rdoc.css
Every image in the rdoc.css that use url has the wrong one. They end up pointing to `css/images/zoom.png` instead of `images/zoom.png`.

Just open this page https://ruby.github.io/rdoc/RDoc/CodeObject.html on chrome and you can see in the console the spam of the failed GET queries.

This fixes it.
daf36f9894
2019-07-26 17:32:46 +08:00
aycabta
8bb4892376
[ruby/rdoc] Update jQuery to 3.3.1
17df871ee
2019-07-26 17:32:19 +08:00
nobu
19e672cce9 rdoc: Colorize background of code/pre [ci skip]
Borrowed the style of code/pre from bugs.ruby-lang.org.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-30 12:39:35 +00:00
nobu
33d026034e rdoc.css: make label-list compact
"Labeled Lists" section in lib/rdoc/markup.rb states labeled-list
will be formatted in same lines.

```
Notice that blank lines right after the label are ignored in labeled lists:

  [one]

      definition 1

  [two]

      definition 2

produces the same output as

  [one]  definition 1
  [two]  definition 2
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-02 06:54:55 +00:00
hsbt
95e213d354 Merge rdoc-6.1.0.beta1.
* https://github.com/ruby/rdoc/compare/v6.0.4...v6.1.0.beta1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 01:30:18 +00:00
hsbt
98c7058bf7 Merge RDoc 6.0.3 from upstream.
It fixed the several bugs that was found after RDoc 6 releasing.

From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-26 05:56:26 +00:00
k0kubun
cc777d09f4 erb.rb: deprecate safe_level of ERB.new
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments
(trim_mode, eoutvar) are changed to keyword arguments.
Old ways to specify arguments are deprecated and warned now.

bin/erb: deprecate -S option.

We'll remove all of deprecated ones at Ruby 2.7+.

enc/make_encmake.rb: stopped using deprecated interface
ext/etc/mkconstants.rb: ditto
ext/socket/mkconstants.rb: ditto
sample/ripper/ruby2html.rb: ditto
spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto
spec/ruby/library/erb/new_spec.rb: ditto
test/erb/test_erb.rb: ditto
test/erb/test_erb_command.rb: ditto
tool/generic_erb.rb: ditto
tool/ruby_vm/helpers/dumper.rb: ditto
tool/transcode-tblgen.rb: ditto
lib/rdoc/erbio.rb: ditto
lib/rdoc/generator/darkfish.rb: ditto

[Feature #14256]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22 13:28:25 +00:00
hsbt
5551871086 Merge rdoc-6.0.0.beta4 from upstream.
It version applied `frozen_string_literal: true`

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-27 10:45:24 +00:00
hsbt
db6c51ec4f Merge rdoc-6.0.0.beta3.
* It version introduced did you mean? feature for ri command:
    https://github.com/ruby/rdoc/pull/533
  * Removed obbsoleted ruby_token.rbb.
    [Bug #13990][ruby-core:83180]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-10 02:01:00 +00:00
hsbt
4790c08906 Merge rdoc-6.0.0.beta1.
This version fixed strange behavior of ruby code parser.
  We will list all of impromovement to Changelog when 6.0.0 releasing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-29 11:52:50 +00:00
hsbt
df3e22ce84 Update rdoc-5.1.0
* Details of changes are following url.
    https://github.com/rdoc/rdoc/blob/master/History.rdoc#510--2017-02-24

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-24 07:39:37 +00:00
hsbt
cdc527db34 * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0
Release note: b825775647/History.rdoc (500--2016-11-05)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 09:18:10 +00:00