summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup/to_html.rb
diff options
context:
space:
mode:
authoraycabta <[email protected]>2020-04-14 19:33:45 +0900
committeraycabta <[email protected]>2020-05-24 23:47:24 +0900
commitf52a4690f8fbd495e8517178a0bf95c69ccea47c (patch)
treed0a909f81c7078513afd922946405a2380c427ed /lib/rdoc/markup/to_html.rb
parentc79f9ea606d072176533b22813653f9fd26940af (diff)
[ruby/rdoc] Process crossref before tidylink
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
Diffstat (limited to 'lib/rdoc/markup/to_html.rb')
-rw-r--r--lib/rdoc/markup/to_html.rb25
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 9ae0fff8a7..3b1b0e9d40 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -52,12 +52,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
@th = nil
@hard_break = "<br>\n"
- # external links
- @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
- :HYPERLINK)
-
- add_regexp_handling_RDOCLINK
- add_regexp_handling_TIDYLINK
+ init_regexp_handlings
init_tags
end
@@ -66,6 +61,24 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
#
# These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling.
+ ##
+ # Adds regexp handlings.
+
+ def init_regexp_handlings
+ # external links
+ @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
+ :HYPERLINK)
+ init_link_notation_regexp_handlings
+ end
+
+ ##
+ # Adds regexp handlings about link notations.
+
+ def init_link_notation_regexp_handlings
+ add_regexp_handling_RDOCLINK
+ add_regexp_handling_TIDYLINK
+ end
+
def handle_RDOCLINK url # :nodoc:
case url
when /^rdoc-ref:/