Граф коммитов

496 Коммитов

Автор SHA1 Сообщение Дата
Yusuke Endoh bc1e2271af lib/rdoc/markup/parser.rb: remove a unused variable initialization 2019-08-19 10:07:05 +09:00
aycabta 2a65498ca2 Remove CI files from list 2019-08-17 20:20:04 +09:00
Hiroshi SHIBATA e095803c37 Removed formatter_test_case and text_formatter_test_case from Gem::Specification#files. 2019-08-17 20:20:04 +09:00
Hiroshi SHIBATA 3a06c11a7d Removed autoload from Markup. 2019-08-17 20:20:04 +09:00
Hiroshi SHIBATA 79fe84edf5 Removed test_case files from lib directory. 2019-08-17 20:20:04 +09:00
Yusuke Endoh 229ae3269d lib/rdoc/store.rb: Use `Marshal.dump(obj, io)`
instead of dumping obj to a string and then saving the string.
It omits object creation.
2019-08-16 21:27:05 +09:00
Yusuke Endoh cd41378ef9 lib/rdoc/parser/ruby.rb: Avoid `.chars.to_a.last`
The code creates a lot of useless objects.
Instead, using a regexp is shorter and faster.
2019-08-16 11:36:47 +09:00
Yusuke Endoh f71bd7477e RDoc::Parser::C: Integrate do_classes and do_modules by one regexp match
The full scan of the C source code (`@content.scan`) is very slow.
The old code invokes the scan six times in `do_classes` and
`do_modules`.

This change integrates the six scans into one by merging the regexps.
The integrated regexp is a bit hard to maintain, but the speed up is
significant: approx. 30 sec -> 20 sec in Ruby's `make rdoc`.

In addition, this change omits `do_boot_defclass` unless the file name
is `class.c`.  `boot_defclass` is too specific to Ruby's source code, so
RDoc should handle it as a special case.

Before this change:

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       858  (13.6%)         858  (13.6%)     (garbage collection)
       292   (4.6%)         264   (4.2%)     RDoc::Parser::C#do_define_class
       263   (4.2%)         250   (3.9%)     RDoc::Parser::C#do_define_module
       275   (4.3%)         241   (3.8%)     RDoc::Parser::C#do_define_class_under
       248   (3.9%)         237   (3.7%)     RDoc::Parser::C#do_define_module_under
       234   (3.7%)         234   (3.7%)     RDoc::Parser::C#gen_body_table
       219   (3.5%)         219   (3.5%)     Ripper::Lexer#state_obj
       217   (3.4%)         216   (3.4%)     RDoc::Parser::C#do_struct_define_without_accessor
       205   (3.2%)         205   (3.2%)     RDoc::Parser::C#do_boot_defclass
       205   (3.2%)         205   (3.2%)     RDoc::Parser::C#do_singleton_class

The six methods take approx. 22.2%.
`do_define_class` (4.2%) + `do_define_class_under` (3.8%) +
`do_define_module` (3,9$) + `do_define_module_under` (3.7%) +
`do_struct_define_without_accessor` (3.4%) + `do_singleton_class` (3.2%)

After this change, the methods are integrated to `do_classes_and_modules`
which takes only 5.8%.

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
       812  (16.7%)         812  (16.7%)     (garbage collection)
       355   (7.3%)         284   (5.8%)     RDoc::Parser::C#do_classes_and_modules
       225   (4.6%)         225   (4.6%)     RDoc::Parser::C#gen_body_table
       429   (8.8%)         210   (4.3%)     RDoc::Parser::RubyTools#get_tk
       208   (4.3%)         208   (4.3%)     RDoc::TokenStream#add_tokens
2019-08-16 06:07:11 +09:00
Hiroshi SHIBATA e87e10e5e7 Use test/unit instead of test-unit. Because test-unit is only provided standalone gem. 2019-08-16 06:07:11 +09:00
Hiroshi SHIBATA 8a18a639b7 Use Gemfile instead of add_development_dependency. 2019-08-16 06:07:11 +09:00
Nobuyoshi Nakada 1a5304228a Use test-unit instead of minitest
Minitest 6 will err `assert_equal` with `nil`.
https://github.com/seattlerb/minitest/issues/779
2019-08-16 06:07:11 +09:00
aycabta 64f9f512c5 Treat linking to Markdown label correctly 2019-08-16 06:02:45 +09:00
Yusuke Endoh 723a37d038 Separate RDoc::TokenStream#add_tokens and #add_token
The old version of `add_tokens` accepts an array of tokens, and
multiple arguments of tokens by using `Array#flatten`.
And `add_token` was an alias to `add_tokens`.

I think it is unnecessarily flexible; in fact, all callsites of
`add_tokens` (except test) passes only an array of tokens.
And the code created a lot of temporal arrays.

This change makes `add_tokens` accept only one array of tokens,
and does `add_token` accept one token.  It is a bit faster (about
1 second in Ruby's `make rdoc`), and it ls also cleaner in my point of
view.
2019-08-16 06:02:45 +09:00
Yusuke Endoh 0a0760aa63 Refactor and improve performance of RDoc::Markup::Parser
This change introduces a wrapper of StringScanner that is aware of the
current position (column and lineno).
It has two advantages: faster and more modular.

The old code frequently runs `@input.byteslice(0, byte_offset).length`
to get the current position, but it was painfully slow.  This change
keeps track of the position at each scan, which reduces about half of
time of "Generating RI format into ..." in Ruby's `make rdoc`
(5.5 sec -> 3.0 sec).

And the old code used four instance variables (`@input`, `@line`,
`@line_pos`, and `@s`) to track the position.  This change factors them
out into MyStringScanner, so now only one variable (`@s`) is needed.
2019-08-16 06:02:45 +09:00
Kazuhiro NISHIYAMA 2e6f777f9e
`/o` should not use with instance variable
for example:
```
class C;def initialize(pat);@pat=pat;end;def re;/#{@pat}/o;end;end
C.new('1').re #=> /1/
C.new('2').re #=> /1/
```
2019-07-30 12:44:38 +09:00
Nobuyoshi Nakada e62a60927e
Should match the beginning/end of string 2019-07-29 23:05:41 +09:00
Nobuyoshi Nakada 3ee63cfe88
Match suffix for content type more precisely
Suffix needs a dot and should match the end of string.
2019-07-29 23:05:41 +09:00
Nobuyoshi Nakada bef398eb87
Chomp html suffix literally
Unescaped dot does not mean a suffix.
2019-07-29 23:05:41 +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.
https://github.com/ruby/rdoc/commit/daf36f9894
2019-07-26 17:32:46 +08:00
aycabta 8bb4892376
[ruby/rdoc] Update jQuery to 3.3.1
https://github.com/ruby/rdoc/commit/17df871ee
2019-07-26 17:32:19 +08:00
aycabta 3b0f952ec8 [ruby/rdoc] Support nesting text page URL
RDoc::Servlet#documentation_page replaces "/" in URL with "::" for class
or module but it's also used for the replaced name on text pages. This
causes a bug when text pages are in nesting directory.

This commit fixes #615.

https://github.com/ruby/rdoc/commit/d73b915b1e
2019-07-26 17:29:17 +08:00
aycabta a86d4eef4b [ruby/rdoc] Normalization of comment should check language
RDoc::Text#normalize_comment that is included RDoc::Comment always
remove Ruby style comment indicator "#" and C style comment indicator
"/**/", but should check language and remove only the language's comment
indicator.

https://github.com/ruby/rdoc/commit/ca68ba1e73
2019-07-26 17:20:58 +08:00
aycabta f7cbbc7074 [ruby/rdoc] ClassModule#add_comment should receive RDoc::Comment
https://github.com/ruby/rdoc/commit/3fb03bf399
2019-07-26 17:20:27 +08:00
aycabta 83171b0ee8 [ruby/rdoc] Bump version to 6.1.1
https://github.com/ruby/rdoc/commit/55c0627fe0
2019-07-15 00:11:07 +09:00
poloka 312d72000a [ruby/rdoc] Correction to include regexp_handling in list of loaded files
https://github.com/ruby/rdoc/commit/1940b2318c
2019-07-15 00:11:07 +09:00
Maxime Lapointe b67b07bd5b Fix links to headings
A previous change made the header's id be fully referenced (for the sidebar I believe) but this broke links to them.
This fixes the issue.
2019-07-14 17:46:16 +09:00
Nobuyoshi Nakada 6566919176
ripper_state_lex.rb: chomp CR
* lib/rdoc/parser/ripper_state_lex.rb (RDoc::Parser::RipperStateLex):
  chomp newline, including CR, from here document terminator.

Closes: ruby/rdoc#694
Closes: ruby/rdoc#697
Closes: ruby/rdoc#705
2019-06-07 18:57:58 +09:00
aycabta 83e905eb4e Revert "Use "require" just for essential"
This reverts commit ab7a6e1a16.
2019-05-29 20:24:00 +09:00
aycabta ab7a6e1a16 Use "require" just for essential
The 559dca509d contains an excess range in
using "require".
2019-05-29 20:21:00 +09:00
aycabta 559dca509d Show documents when completion 2019-05-25 03:30:01 +09:00
Nobuyoshi Nakada f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09: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 fa04b87af4 [DOC] fix missing paren [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-28 08:39:24 +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
nobu edb65a6254 rdoc: ignore gemspec files
[ruby-core:91067] [Bug #15531]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-13 13:49:25 +00:00
nobu 0fb782ea28 rdoc: ignore garbage files
* lib/rdoc/options.rb (RDoc::Options#init_ivars): exclude backup
  files by default.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-13 13:16:56 +00:00
nobu 79aef1272e [DOC] escape descriptions [ci skip]
Escape descriptions not to get parsed as directives.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:49:32 +00:00
nobu 9035e73a14 [DOC] mark function names [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:41:13 +00:00
nobu 8513c20370 [DOC] split a tag for each function name [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:25:32 +00:00
kazu 44aaff6d31 [DOC] Fix close tags [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 09:10:10 +00:00
aycabta 705eb9c110 Merge RDoc 6.1.0 from upstream
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-23 13:14:28 +00:00
aycabta 18911e99d2 Merge RDoc 6.1.0.beta3 from upstream
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-08 17:39:52 +00:00
aycabta 4beec66757 Merge rdoc-6.1.0.bata2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-27 07:02:36 +00:00
mame 03cde6c805 lib/rdoc/markup/: Remove wrong call to `=~` against Array
`@res` is an Array, so `@res =~ /\n\z/` calls `Object#=~` which always
returns nil.
I guess it should be `@res.last =~ /\n\z/`, but the change causes test
failures.

This bug was found during work for removal of `Object#=~`.
[Feature #15231]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26 05:32:50 +00:00
nobu b9ca9169ba Mark up code inside link text as <code>
Merged https://github.com/ruby/rdoc/pull/660

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-29 06:23:21 +00:00
nobu 8586f021f8 rdoc/parser/c.rb: ignore dynamically added methods
* lib/rdoc/parser/c.rb (RDoc::Parser::C#deduplicate_call_seq):
  skip dynamically added methods at runtime, because the class
  name is unknown and the defined methods are not accessible from
  that class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-28 01:56:28 +00:00
aycabta 1b43644edc Merge rdoc-6.1.0.beta2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17 06:28:20 +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 e75d8e0c65 Merge rdoc-6.0.4 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-08 02:07:53 +00:00