mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
Sync RDoc 6.14.0
This commit is contained in:
parent
ca1ea95784
commit
03eb777c69
185 changed files with 2008 additions and 1655 deletions
|
@ -9,7 +9,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Creates a new formatter that will output Markdown format text
|
||||
|
||||
def initialize markup = nil
|
||||
def initialize(markup = nil)
|
||||
super
|
||||
|
||||
@headings[1] = ['# ', '']
|
||||
|
@ -37,21 +37,21 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Adds a newline to the output
|
||||
|
||||
def handle_regexp_HARD_BREAK target
|
||||
def handle_regexp_HARD_BREAK(target)
|
||||
" \n"
|
||||
end
|
||||
|
||||
##
|
||||
# Finishes consumption of `list`
|
||||
|
||||
def accept_list_end list
|
||||
def accept_list_end(list)
|
||||
super
|
||||
end
|
||||
|
||||
##
|
||||
# Finishes consumption of `list_item`
|
||||
|
||||
def accept_list_item_end list_item
|
||||
def accept_list_item_end(list_item)
|
||||
width = case @list_type.last
|
||||
when :BULLET then
|
||||
4
|
||||
|
@ -72,7 +72,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Prepares the visitor for consuming `list_item`
|
||||
|
||||
def accept_list_item_start list_item
|
||||
def accept_list_item_start(list_item)
|
||||
type = @list_type.last
|
||||
|
||||
case type
|
||||
|
@ -97,7 +97,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Prepares the visitor for consuming `list`
|
||||
|
||||
def accept_list_start list
|
||||
def accept_list_start(list)
|
||||
case list.type
|
||||
when :BULLET, :LABEL, :NOTE then
|
||||
@list_index << nil
|
||||
|
@ -114,7 +114,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Adds `rule` to the output
|
||||
|
||||
def accept_rule rule
|
||||
def accept_rule(rule)
|
||||
use_prefix or @res << ' ' * @indent
|
||||
@res << '-' * 3
|
||||
@res << "\n"
|
||||
|
@ -123,7 +123,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Outputs `verbatim` indented 4 columns
|
||||
|
||||
def accept_verbatim verbatim
|
||||
def accept_verbatim(verbatim)
|
||||
indent = ' ' * (@indent + 4)
|
||||
|
||||
verbatim.parts.each do |part|
|
||||
|
@ -137,7 +137,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Creates a Markdown-style URL from +url+ with +text+.
|
||||
|
||||
def gen_url url, text
|
||||
def gen_url(url, text)
|
||||
scheme, url, = parse_url url
|
||||
|
||||
"[#{text.sub(%r{^#{scheme}:/*}i, '')}](#{url})"
|
||||
|
@ -146,7 +146,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Handles <tt>rdoc-</tt> type links for footnotes.
|
||||
|
||||
def handle_rdoc_link url
|
||||
def handle_rdoc_link(url)
|
||||
case url
|
||||
when /^rdoc-ref:/ then
|
||||
$'
|
||||
|
@ -166,7 +166,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Converts the RDoc markup tidylink into a Markdown.style link.
|
||||
|
||||
def handle_regexp_TIDYLINK target
|
||||
def handle_regexp_TIDYLINK(target)
|
||||
text = target.text
|
||||
|
||||
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
|
||||
|
@ -184,7 +184,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
|
|||
##
|
||||
# Converts the rdoc-...: links into a Markdown.style links.
|
||||
|
||||
def handle_regexp_RDOCLINK target
|
||||
def handle_regexp_RDOCLINK(target)
|
||||
handle_rdoc_link target.text
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue