summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup
AgeCommit message (Collapse)Author
2024-10-03[ruby/rdoc] Fix ToRdoc#accept_tabletomoya ishida
(https://github.com/ruby/rdoc/pull/1184) https://github.com/ruby/rdoc/commit/7b68545094
2024-07-31[ruby/rdoc] Add new ruby parser that uses Prismtomoya ishida
(https://github.com/ruby/rdoc/pull/1144) * Add a new ruby parser RDoc::Parser::PrismRuby * Add a new ruby parser testcase independent from parser's internal implementation * unknown meta method * Use MethodSignatureVisitor only to scan params, block_params and calls_super * Add calls_super test * Drop ruby 2.6. Prism requires ruby >= 2.7 * Remove duplicated documentation comment from prism_ruby.rb * Add test for wrong argument passed to metaprogramming method * Rename visit_call_[DSL_METHOD_NAME] to make it distinguishable from visit_[NODE_TYPE]_node * Method receiver switch of true/false/nil to a case statement * Extract common part of add_method(by def keyword) and add meta_comment method * Reuse consecutive comments array when collecting comments * Simplify DSL call_node handling * Refactor extracting method visibility arguments https://github.com/ruby/rdoc/commit/fde99f1be6
2024-07-17[ruby/rdoc] Improve rubocop setupStan Lo
(https://github.com/ruby/rdoc/pull/1139) * Rename rake rubocop to rake format_generated_files * Add rubocop rules to ensure spaces are applied consistently * Improve rubocop related CI workflows https://github.com/ruby/rdoc/commit/27932d001c
2024-03-09[ruby/rdoc] Fix ToRdoc generating incorrect {label,name}-listsHartley McGuire
Previously, trying to round-trip label-list and name-lists with the ToRdoc converter was not possible: ```ruby doc = <<~RDOC foo :: bar :: hi RDOC markup = RDoc::Markup.parse(doc) markup # => [doc: [list: NOTE [item: ["foo ", "bar"]; [para: "hi"]]]] rt = RDoc::Markup::ToRdoc.new.convert(markup) rt # => "foo\nbar:\n hi\n\n" rt_markup = RDoc::Markup.parse(rt) rt_markup # => [doc: [para: "foo ", "bar:"], [verb: "hi\n"]] ``` This commit addresses the issue by fixing ToRdoc to generate output that can be properly reparsed by RDoc. ToRdoc tests additionally needed to be updated for the new output. The old implementation of `accept_list_item_start` was copied to ToBs because those tests did not pass with the new changes and I am unfamiliar with the `backspace` format. After: ```ruby doc = <<~RDOC foo :: bar :: hi RDOC markup = RDoc::Markup.parse(doc) markup # => [doc: [list: NOTE [item: ["foo ", "bar"]; [para: "hi"]]]] rt = RDoc::Markup::ToRdoc.new.convert(markup) rt # => "foo::\nbar::\n hi\n\n" rt_markup = RDoc::Markup.parse(rt) rt_markup # => [doc: [list: NOTE [item: ["foo", "bar"]; [para: "hi"], blankline]]] ``` https://github.com/ruby/rdoc/commit/c6c51aa900
2024-03-08[ruby/rdoc] Fix ToMarkdown missing newlines for label-listsHartley McGuire
Previously, using ToMarkdown on a label-list would generate output that could not be reparsed by the RDoc::Markdown parser: ``` md = <<~MD apple : a red fruit banana : a yellow fruit MD doc = RDoc::Markdown.parse(md) doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] new_md = doc.accept(RDoc::Markup::ToMarkdown.new) new_md # => "apple\n: a red fruit\nbanana\n: a yellow fruit\n\n" new_doc = RDoc::Markdown.parse(new_md) new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit\nbanana\n: a yellow fruit"]]]] ``` The issue is that the [PHP Markdown Extra spec][1] requires a newline after each definition list item, but ToMarkdown was not putting newlines between label-list items. This commit fixes the issue by properly appending a newline after each label-list item so that the output of ToMarkdown can be reparsed by RDoc::Markdown: ``` md = <<~MD apple : a red fruit banana : a yellow fruit MD doc = RDoc::Markdown.parse(mdoc) doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] new_md = doc.accept(RDoc::Markup::ToMarkdown.new) new_md # => "apple\n: a red fruit\n\nbanana\n: a yellow fruit\n\n" new_doc = RDoc::Markdown.parse(new_md) new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] ``` [1]: https://michelf.ca/projects/php-markdown/extra/#def-list https://github.com/ruby/rdoc/commit/c65266437c
2023-12-31[ruby/rdoc] Allow empty name rdoc-ref as a local linkNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/914a6af137
2023-12-16[ruby/rdoc] [DOC] nodoc for probably internal methodsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/f7dd147a8c
2023-12-16[ruby/rdoc] [DOC] Add missing documentsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/e4c90340d0
2023-11-27[ruby/rdoc] Place a space between certain character class letters onlyNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/1f568e049d
2023-11-14[ruby/rdoc] Fix TIDYLINK after bracesNobuyoshi Nakada
(https://github.com/ruby/rdoc/pull/1015) TIDYLINK multi-word label should not include braces. https://github.com/ruby/rdoc/commit/41ad3191e9
2023-07-29[ruby/rdoc] Use a more portable way to check if code is parseableBenoit Daloze
* 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. https://github.com/ruby/rdoc/commit/d19f7c66fe
2023-06-14[ruby/rdoc] Use flat_map for better performancePetrik
https://github.com/ruby/rdoc/commit/76192a280d
2023-06-03[ruby/rdoc] Auto-correct trailing new linesVinicius Stock
https://github.com/ruby/rdoc/commit/4b68c0728a
2023-05-02[ruby/rdoc] [DOC] stop documenting fallback `MatchData#match_length`Nobuyoshi Nakada
Also empty document of `Object`. https://github.com/ruby/rdoc/commit/ce32a3102b
2022-11-27[ruby/rdoc] Revert "Refactor `RDoc::Markup::Parser#tokenize`"Nobuyoshi Nakada
This reverts commit https://github.com/ruby/rdoc/commit/41ceae93b3bc. https://github.com/ruby/rdoc/commit/5d2c47e8b8
2022-11-27[ruby/rdoc] Refactor `RDoc::Markup::Parser#tokenize`Nobuyoshi Nakada
Make verbatims text or newline only, and simplify `build_verbatim`. https://github.com/ruby/rdoc/commit/41ceae93b3
2022-11-27[ruby/rdoc] Refine regexp usages and reduce substring allocationsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/a976fb9d39
2022-10-07[ruby/rdoc] Escape HYPERLINKsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/ac35485be6
2022-10-07[ruby/rdoc] Escape RDOCLINKsNobuyoshi Nakada
https://hackerone.com/reports/1187156 https://github.com/ruby/rdoc/commit/7cecf1efae
2022-10-07[ruby/rdoc] Escape TIDYLINKsNobuyoshi Nakada
https://hackerone.com/reports/1187156 https://github.com/ruby/rdoc/commit/1ad2dd3ca2
2022-10-06[ruby/rdoc] Allow RDoc markups in table cellsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/b16d3f1727
2022-07-30[ruby/rdoc] Fix blockquote with word in verbatimNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/75eee668a5
2022-07-29[ruby/rdoc] Fix formatting blockquote in verbatimNobuyoshi Nakada
Reported at https://github.com/ruby/rdoc/pull/907#discussion_r932505816 https://github.com/ruby/rdoc/commit/86384ac7f9
2022-04-14[ruby/rdoc] Apply matching word pairs to underscore-methodsNobuyoshi Nakada
Protected characters with `PROTECT_ATTR` should not have special roles. https://github.com/ruby/rdoc/commit/c318af0ea2
2022-04-13[ruby/rdoc] Only parse valid URLsPeter Zhu
Only valid characters for URLs should be used for generating URLs. A list of valid characters can be found in sections 2.2 and 2.3 of IETF RFC 3986 (https://www.ietf.org/rfc/rfc3986.txt). https://github.com/ruby/rdoc/commit/2bd8fcdd4f
2022-02-22[ruby/rdoc] Prefer `require 'cgi/util'` instead of `require 'cgi'`Yusuke Endoh
RDoc is using only CGI.escape, escapeHTML, and unescape. We don't have to load the whole source code of cgi gem. https://github.com/ruby/rdoc/commit/d096222cc2
2022-02-09[ruby/rdoc] Simplify attribute exclusiveness conditionsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/45e33c4b85
2021-10-16[ruby/rdoc] feat: add support for :category: on C functionsMike Dalessio
https://github.com/ruby/rdoc/commit/45c92005fe
2021-07-05[ruby/rdoc] Fix links without pathsNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/424bd5db4d
2021-07-05[ruby/rdoc] Fix for explicit http linkNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/caf234665c
2021-07-05[ruby/rdoc] Allow a label in a link to another document textNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/85bb2d33bb
2021-04-03[ruby/rdoc] Links to document texts without "rdoc-ref:" prefixNobuyoshi Nakada
While links to generated HTML from RDoc file needs to be prefixed by "rdoc-ref:" currently, in case of explicit references this seems just redundant. Also GitHub RDoc support does not work with this prefix. This patch lets links to such document texts (".rb", ".rdoc" and ".md" now) refer URLs generated by `RDoc::TopLevel#http_url` without the prefix. https://github.com/ruby/rdoc/commit/f18b27b69d
2021-04-03[ruby/rdoc] Treat emphasis tags as excluding other notationsaycabta
And exclusive notations don't exclude other exclusive notations. https://github.com/ruby/rdoc/commit/b8baa9a435
2021-04-03[ruby/rdoc] Treat other tags as word boundariesaycabta
https://github.com/ruby/rdoc/commit/8222f85a17
2021-04-03[ruby/rdoc] Disable other notations in <code> tagsaycabta
https://github.com/ruby/rdoc/commit/0cd3b55210
2021-03-16[ruby/rdoc] Support GFM tableNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/9dc933df16 Notes: Merged: https://github.com/ruby/ruby/pull/4274
2020-10-27Separate `send` into `public_send` and `__send__`Nobuyoshi Nakada
2020-07-22[ruby/rdoc] Create link to unary operator methods correctlyhyrious
https://github.com/ruby/rdoc/commit/54500cf12a
2020-05-24[ruby/rdoc] Process crossref before tidylinkaycabta
The crossref must be linked before tidylink because Klass.method[:sym] will be processed as a tidylink first and will be broken. https://github.com/ruby/rdoc/commit/0f47baf6d2
2020-05-24[ruby/rdoc] Escape method names in HTMLNate Matykiewicz
The following is invalid HTML: <a href="Array.html#method-i-3C-3C"><code><<</code></a></p> Incorrect: <code><<</code> Correct: <code>&lt;&lt;</code> Fixes #761 https://github.com/ruby/rdoc/commit/b120d087f6
2020-03-08Specify explicit separator not to be affected by $;Nobuyoshi Nakada
2019-08-19lib/rdoc/markup/parser.rb: remove a unused variable initializationYusuke Endoh
2019-08-17Removed test_case files from lib directory.Hiroshi SHIBATA
2019-08-16Use test/unit instead of test-unit. Because test-unit is only provided ↵Hiroshi SHIBATA
standalone gem.
2019-08-16Use test-unit instead of minitestNobuyoshi Nakada
Minitest 6 will err `assert_equal` with `nil`. https://github.com/seattlerb/minitest/issues/779
2019-08-16Treat linking to Markdown label correctlyaycabta
2019-08-16Refactor and improve performance of RDoc::Markup::ParserYusuke Endoh
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-07-14Fix links to headingsMaxime Lapointe
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.
2018-12-08Merge RDoc 6.1.0.beta3 from upstreamaycabta
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26lib/rdoc/markup/: Remove wrong call to `=~` against Arraymame
`@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