mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[DOC] Remove _emphasis_ in code blocks which is not handled as emphasis anymore (#15901)
This commit is contained in:
parent
37c7ee536d
commit
b536c6a849
Notes:
git
2026-01-18 19:59:38 +00:00
Merged-By: tompng <tomoyapenguin@gmail.com>
@ -1803,7 +1803,7 @@ rb_dbl_complex_new(double real, double imag)
|
||||
* Complex.rect(1, Rational(0, 1)).to_i # => 1
|
||||
*
|
||||
* Raises RangeError if <tt>self.imag</tt> is not exactly zero
|
||||
* (either <tt>Integer(0)</tt> or <tt>Rational(0, _n_)</tt>).
|
||||
* (either <tt>Integer(0)</tt> or <tt>Rational(0, n)</tt>).
|
||||
*/
|
||||
static VALUE
|
||||
nucomp_to_i(VALUE self)
|
||||
@ -1827,7 +1827,7 @@ nucomp_to_i(VALUE self)
|
||||
* Complex.rect(1, Rational(0, 1)).to_f # => 1.0
|
||||
*
|
||||
* Raises RangeError if <tt>self.imag</tt> is not exactly zero
|
||||
* (either <tt>Integer(0)</tt> or <tt>Rational(0, _n_)</tt>).
|
||||
* (either <tt>Integer(0)</tt> or <tt>Rational(0, n)</tt>).
|
||||
*/
|
||||
static VALUE
|
||||
nucomp_to_f(VALUE self)
|
||||
@ -1852,7 +1852,7 @@ nucomp_to_f(VALUE self)
|
||||
* Complex.rect(1, 0.0).to_r # => (1/1)
|
||||
*
|
||||
* Raises RangeError if <tt>self.imag</tt> is not exactly zero
|
||||
* (either <tt>Integer(0)</tt> or <tt>Rational(0, _n_)</tt>)
|
||||
* (either <tt>Integer(0)</tt> or <tt>Rational(0, n)</tt>)
|
||||
* and <tt>self.imag.to_r</tt> is not exactly zero.
|
||||
*
|
||||
* Related: Complex#rationalize.
|
||||
|
||||
8
dir.rb
8
dir.rb
@ -319,14 +319,14 @@ class Dir
|
||||
#
|
||||
# Dir.glob('io.?') # => ["io.c"]
|
||||
#
|
||||
# - <tt>'[_set_]'</tt>: Matches any one character in the string _set_;
|
||||
# - <tt>'[set]'</tt>: Matches any one character in the string _set_;
|
||||
# behaves like a {Regexp character class}[rdoc-ref:Regexp@Character+Classes],
|
||||
# including set negation (<tt>'[^a-z]'</tt>):
|
||||
#
|
||||
# Dir.glob('*.[a-z][a-z]').take(3)
|
||||
# # => ["CONTRIBUTING.md", "COPYING.ja", "KNOWNBUGS.rb"]
|
||||
#
|
||||
# - <tt>'{_abc_,_xyz_}'</tt>:
|
||||
# - <tt>'{abc,xyz}'</tt>:
|
||||
# Matches either string _abc_ or string _xyz_;
|
||||
# behaves like {Regexp alternation}[rdoc-ref:Regexp@Alternation]:
|
||||
#
|
||||
@ -388,10 +388,10 @@ class Dir
|
||||
#
|
||||
# - File::FNM_EXTGLOB:
|
||||
# enables the pattern extension
|
||||
# <tt>'{_a_,_b_}'</tt>, which matches pattern _a_ and pattern _b_;
|
||||
# <tt>'{a,b}'</tt>, which matches pattern _a_ and pattern _b_;
|
||||
# behaves like a
|
||||
# {regexp union}[rdoc-ref:Regexp.union]
|
||||
# (e.g., <tt>'(?:_a_|_b_)'</tt>):
|
||||
# (e.g., <tt>'(?:a|b)'</tt>):
|
||||
#
|
||||
# pattern = '{LEGAL,BSDL}'
|
||||
# Dir.glob(pattern) # => ["LEGAL", "BSDL"]
|
||||
|
||||
@ -414,21 +414,21 @@ Each of these anchors matches a boundary:
|
||||
|
||||
Lookahead anchors:
|
||||
|
||||
- <tt>(?=_pat_)</tt>: Positive lookahead assertion:
|
||||
- <tt>(?=pat)</tt>: Positive lookahead assertion:
|
||||
ensures that the following characters match _pat_,
|
||||
but doesn't include those characters in the matched substring.
|
||||
|
||||
- <tt>(?!_pat_)</tt>: Negative lookahead assertion:
|
||||
- <tt>(?!pat)</tt>: Negative lookahead assertion:
|
||||
ensures that the following characters <i>do not</i> match _pat_,
|
||||
but doesn't include those characters in the matched substring.
|
||||
|
||||
Lookbehind anchors:
|
||||
|
||||
- <tt>(?<=_pat_)</tt>: Positive lookbehind assertion:
|
||||
- <tt>(?<=pat)</tt>: Positive lookbehind assertion:
|
||||
ensures that the preceding characters match _pat_, but
|
||||
doesn't include those characters in the matched substring.
|
||||
|
||||
- <tt>(?<!_pat_)</tt>: Negative lookbehind assertion:
|
||||
- <tt>(?<!pat)</tt>: Negative lookbehind assertion:
|
||||
ensures that the preceding characters do not match
|
||||
_pat_, but doesn't include those characters in the matched substring.
|
||||
|
||||
@ -574,7 +574,7 @@ A simple regexp has (at most) one match:
|
||||
re.match('1943-02-04').size # => 1
|
||||
re.match('foo') # => nil
|
||||
|
||||
Adding one or more pairs of parentheses, <tt>(_subexpression_)</tt>,
|
||||
Adding one or more pairs of parentheses, <tt>(subexpression)</tt>,
|
||||
defines _groups_, which may result in multiple matched substrings,
|
||||
called _captures_:
|
||||
|
||||
@ -647,8 +647,8 @@ A regexp may contain any number of groups:
|
||||
|
||||
- For a large number of groups:
|
||||
|
||||
- The ordinary <tt>\\_n_</tt> notation applies only for _n_ in range (1..9).
|
||||
- The <tt>MatchData[_n_]</tt> notation applies for any non-negative _n_.
|
||||
- The ordinary <tt>\\n</tt> notation applies only for _n_ in range (1..9).
|
||||
- The <tt>MatchData[n]</tt> notation applies for any non-negative _n_.
|
||||
|
||||
- <tt>\0</tt> is a special backreference, referring to the entire matched string;
|
||||
it may not be used within the regexp itself,
|
||||
@ -661,7 +661,7 @@ A regexp may contain any number of groups:
|
||||
|
||||
As seen above, a capture can be referred to by its number.
|
||||
A capture can also have a name,
|
||||
prefixed as <tt>?<_name_></tt> or <tt>?'_name_'</tt>,
|
||||
prefixed as <tt>?<name></tt> or <tt>?'name'</tt>,
|
||||
and the name (symbolized) may be used as an index in <tt>MatchData[]</tt>:
|
||||
|
||||
md = /\$(?<dollars>\d+)\.(?'cents'\d+)/.match("$3.67")
|
||||
@ -676,7 +676,7 @@ When a regexp contains a named capture, there are no unnamed captures:
|
||||
/\$(?<dollars>\d+)\.(\d+)/.match("$3.67")
|
||||
# => #<MatchData "$3.67" dollars:"3">
|
||||
|
||||
A named group may be backreferenced as <tt>\k<_name_></tt>:
|
||||
A named group may be backreferenced as <tt>\k<name></tt>:
|
||||
|
||||
/(?<vowel>[aeiou]).\k<vowel>.\k<vowel>/.match('ototomy')
|
||||
# => #<MatchData "ototo" vowel:"o">
|
||||
@ -732,10 +732,10 @@ see {Atomic Group}[https://www.regular-expressions.info/atomic.html].
|
||||
|
||||
==== Subexpression Calls
|
||||
|
||||
As seen above, a backreference number (<tt>\\_n_</tt>) or name (<tt>\k<_name_></tt>)
|
||||
As seen above, a backreference number (<tt>\\n</tt>) or name (<tt>\k<name></tt>)
|
||||
gives access to a captured _substring_;
|
||||
the corresponding regexp _subexpression_ may also be accessed,
|
||||
via the number (<tt>\\g<i>n</i></tt>) or name (<tt>\g<_name_></tt>):
|
||||
via the number n (<tt>\\gn</tt>) or name (<tt>\g<name></tt>):
|
||||
|
||||
/\A(?<paren>\(\g<paren>*\))*\z/.match('(())')
|
||||
# ^1
|
||||
@ -768,12 +768,12 @@ See {Subexpression calls}[https://learnbyexample.github.io/Ruby_Regexp/groupings
|
||||
|
||||
==== Conditionals
|
||||
|
||||
The conditional construct takes the form <tt>(?(_cond_)_yes_|_no_)</tt>, where:
|
||||
The conditional construct takes the form <tt>(?(cond)yes|no)</tt>, where:
|
||||
|
||||
- _cond_ may be a capture number or name.
|
||||
- The match to be applied is _yes_ if _cond_ is captured;
|
||||
otherwise the match to be applied is _no_.
|
||||
- If not needed, <tt>|_no_</tt> may be omitted.
|
||||
- If not needed, <tt>|no</tt> may be omitted.
|
||||
|
||||
Examples:
|
||||
|
||||
@ -802,7 +802,7 @@ The absence operator is a special group that matches anything which does _not_ m
|
||||
|
||||
==== Unicode Properties
|
||||
|
||||
The <tt>/\p{_property_name_}/</tt> construct (with lowercase +p+)
|
||||
The <tt>/\p{property_name}/</tt> construct (with lowercase +p+)
|
||||
matches characters using a Unicode property name,
|
||||
much like a character class;
|
||||
property +Alpha+ specifies alphabetic characters:
|
||||
@ -1033,23 +1033,23 @@ See also {Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
|
||||
|
||||
Each of these modifiers sets a mode for the regexp:
|
||||
|
||||
- +i+: <tt>/_pattern_/i</tt> sets
|
||||
- +i+: <tt>/pattern/i</tt> sets
|
||||
{Case-Insensitive Mode}[rdoc-ref:Regexp@Case-Insensitive+Mode].
|
||||
- +m+: <tt>/_pattern_/m</tt> sets
|
||||
- +m+: <tt>/pattern/m</tt> sets
|
||||
{Multiline Mode}[rdoc-ref:Regexp@Multiline+Mode].
|
||||
- +x+: <tt>/_pattern_/x</tt> sets
|
||||
- +x+: <tt>/pattern/x</tt> sets
|
||||
{Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
|
||||
- +o+: <tt>/_pattern_/o</tt> sets
|
||||
- +o+: <tt>/pattern/o</tt> sets
|
||||
{Interpolation Mode}[rdoc-ref:Regexp@Interpolation+Mode].
|
||||
|
||||
Any, all, or none of these may be applied.
|
||||
|
||||
Modifiers +i+, +m+, and +x+ may be applied to subexpressions:
|
||||
|
||||
- <tt>(?_modifier_)</tt> turns the mode "on" for ensuing subexpressions
|
||||
- <tt>(?-_modifier_)</tt> turns the mode "off" for ensuing subexpressions
|
||||
- <tt>(?_modifier_:_subexp_)</tt> turns the mode "on" for _subexp_ within the group
|
||||
- <tt>(?-_modifier_:_subexp_)</tt> turns the mode "off" for _subexp_ within the group
|
||||
- <tt>(?modifier)</tt> turns the mode "on" for ensuing subexpressions
|
||||
- <tt>(?-modifier)</tt> turns the mode "off" for ensuing subexpressions
|
||||
- <tt>(?modifier:subexp)</tt> turns the mode "on" for _subexp_ within the group
|
||||
- <tt>(?-modifier:subexp)</tt> turns the mode "off" for _subexp_ within the group
|
||||
|
||||
Example:
|
||||
|
||||
@ -1166,22 +1166,22 @@ A regular expression containing non-US-ASCII characters
|
||||
is assumed to use the source encoding.
|
||||
This can be overridden with one of the following modifiers.
|
||||
|
||||
- <tt>/_pat_/n</tt>: US-ASCII if only containing US-ASCII characters,
|
||||
- <tt>/pat/n</tt>: US-ASCII if only containing US-ASCII characters,
|
||||
otherwise ASCII-8BIT:
|
||||
|
||||
/foo/n.encoding # => #<Encoding:US-ASCII>
|
||||
/foo\xff/n.encoding # => #<Encoding:ASCII-8BIT>
|
||||
/foo\x7f/n.encoding # => #<Encoding:US-ASCII>
|
||||
|
||||
- <tt>/_pat_/u</tt>: UTF-8
|
||||
- <tt>/pat/u</tt>: UTF-8
|
||||
|
||||
/foo/u.encoding # => #<Encoding:UTF-8>
|
||||
|
||||
- <tt>/_pat_/e</tt>: EUC-JP
|
||||
- <tt>/pat/e</tt>: EUC-JP
|
||||
|
||||
/foo/e.encoding # => #<Encoding:EUC-JP>
|
||||
|
||||
- <tt>/_pat_/s</tt>: Windows-31J
|
||||
- <tt>/pat/s</tt>: Windows-31J
|
||||
|
||||
/foo/s.encoding # => #<Encoding:Windows-31J>
|
||||
|
||||
|
||||
@ -393,7 +393,7 @@ These keyword-value pairs specify encoding options:
|
||||
|
||||
- <tt>:replace: nil</tt> (default): Set replacement string to default value:
|
||||
<tt>"\uFFFD"</tt> ("<22>") for a Unicode encoding, <tt>'?'</tt> otherwise.
|
||||
- <tt>:replace: _some_string_</tt>: Set replacement string to the given +some_string+;
|
||||
- <tt>:replace: some_string</tt>: Set replacement string to the given +some_string+;
|
||||
overrides +:fallback+.
|
||||
|
||||
Examples:
|
||||
@ -407,12 +407,12 @@ These keyword-value pairs specify encoding options:
|
||||
One of these may be specified:
|
||||
|
||||
- <tt>:fallback: nil</tt> (default): No replacement fallback.
|
||||
- <tt>:fallback: _hash_like_object_</tt>: Set replacement fallback to the given
|
||||
+hash_like_object+; the replacement string is <tt>_hash_like_object_[X]</tt>.
|
||||
- <tt>:fallback: _method_</tt>: Set replacement fallback to the given
|
||||
+method+; the replacement string is <tt>_method_(X)</tt>.
|
||||
- <tt>:fallback: _proc_</tt>: Set replacement fallback to the given
|
||||
+proc+; the replacement string is <tt>_proc_[X]</tt>.
|
||||
- <tt>:fallback: hash_like_object</tt>: Set replacement fallback to the given
|
||||
+hash_like_object+; the replacement string is <tt>hash_like_object[X]</tt>.
|
||||
- <tt>:fallback: method</tt>: Set replacement fallback to the given
|
||||
+method+; the replacement string is <tt>method(X)</tt>.
|
||||
- <tt>:fallback: proc</tt>: Set replacement fallback to the given
|
||||
+proc+; the replacement string is <tt>proc[X]</tt>.
|
||||
|
||||
Examples:
|
||||
|
||||
|
||||
@ -21,16 +21,16 @@ require 'English'
|
||||
|
||||
### Matched \Data
|
||||
|
||||
| Variable | \English | Contains | Initially | Read-Only | Reset By |
|
||||
|:-------------:|:-------------------:|-----------------------------------|:---------:|:---------:|-----------------|
|
||||
| `$~` | `$LAST_MATCH_INFO` | \MatchData object or `nil` | `nil` | No | Matcher methods |
|
||||
| `$&` | `$MATCH` | Matched substring or `nil` | `nil` | No | Matcher methods |
|
||||
| `` $` `` | `$PRE_MATCH` | Substring left of match or `nil` | `nil` | No | Matcher methods |
|
||||
| `$'` | `$POST_MATCH` | Substring right of match or `nil` | `nil` | No | Matcher methods |
|
||||
| `$+` | `$LAST_PAREN_MATCH` | Last group matched or `nil` | `nil` | No | Matcher methods |
|
||||
| `$1` | | First group matched or `nil` | `nil` | Yes | Matcher methods |
|
||||
| `$2` | | Second group matched or `nil` | `nil` | Yes | Matcher methods |
|
||||
| <tt>$_n_</tt> | | <i>n</i>th group matched or `nil` | `nil` | Yes | Matcher methods |
|
||||
| Variable | \English | Contains | Initially | Read-Only | Reset By |
|
||||
|:---------:|:-------------------:|-----------------------------------|:---------:|:---------:|-----------------|
|
||||
| `$~` | `$LAST_MATCH_INFO` | \MatchData object or `nil` | `nil` | No | Matcher methods |
|
||||
| `$&` | `$MATCH` | Matched substring or `nil` | `nil` | No | Matcher methods |
|
||||
| `` $` `` | `$PRE_MATCH` | Substring left of match or `nil` | `nil` | No | Matcher methods |
|
||||
| `$'` | `$POST_MATCH` | Substring right of match or `nil` | `nil` | No | Matcher methods |
|
||||
| `$+` | `$LAST_PAREN_MATCH` | Last group matched or `nil` | `nil` | No | Matcher methods |
|
||||
| `$1` | | First group matched or `nil` | `nil` | Yes | Matcher methods |
|
||||
| `$2` | | Second group matched or `nil` | `nil` | Yes | Matcher methods |
|
||||
| `$n` | | <i>n</i>th group matched or `nil` | `nil` | Yes | Matcher methods |
|
||||
|
||||
### Separators
|
||||
|
||||
@ -167,7 +167,7 @@ English - `$LAST_PAREN_MATCH`.
|
||||
|
||||
### `$1`, `$2`, \Etc. (Matched Group)
|
||||
|
||||
For <tt>$_n_</tt> the <i>n</i>th group of the match.
|
||||
For <tt>$n</tt> the <i>n</i>th group of the match.
|
||||
|
||||
No \English.
|
||||
|
||||
@ -282,9 +282,9 @@ by Kernel#load and Kernel#require.
|
||||
Singleton method `$LOAD_PATH.resolve_feature_path(feature)`
|
||||
returns:
|
||||
|
||||
- <tt>[:rb, _path_]</tt>, where `path` is the path to the Ruby file to be
|
||||
- <tt>[:rb, path]</tt>, where `path` is the path to the Ruby file to be
|
||||
loaded for the given `feature`.
|
||||
- <tt>[:so, _path_]</tt>, where `path` is the path to the shared object file
|
||||
- <tt>[:so, path]</tt>, where `path` is the path to the shared object file
|
||||
to be loaded for the given `feature`.
|
||||
- `nil` if there is no such `feature` and `path`.
|
||||
|
||||
|
||||
4
file.c
4
file.c
@ -7963,11 +7963,11 @@ Init_File(void)
|
||||
*
|
||||
* ==== File::FNM_EXTGLOB
|
||||
*
|
||||
* Flag File::FNM_EXTGLOB enables pattern <tt>'{_a_,_b_}'</tt>,
|
||||
* Flag File::FNM_EXTGLOB enables pattern <tt>'{a,b}'</tt>,
|
||||
* which matches pattern '_a_' and pattern '_b_';
|
||||
* behaves like
|
||||
* a {regexp union}[rdoc-ref:Regexp.union]
|
||||
* (e.g., <tt>'(?:_a_|_b_)'</tt>):
|
||||
* (e.g., <tt>'(?:a|b)'</tt>):
|
||||
*
|
||||
* pattern = '{LEGAL,BSDL}'
|
||||
* Dir.glob(pattern) # => ["LEGAL", "BSDL"]
|
||||
|
||||
@ -211,7 +211,7 @@ class Sentence
|
||||
# returns new sentence object which
|
||||
# _target_ is substituted by the block.
|
||||
#
|
||||
# Sentence#subst invokes <tt>_target_ === _string_</tt> for each
|
||||
# Sentence#subst invokes <tt>target === string</tt> for each
|
||||
# string in the sentence.
|
||||
# The strings which === returns true are substituted by the block.
|
||||
# The block is invoked with the substituting string.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user