summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dir.rb4
-rw-r--r--doc/.document2
-rw-r--r--doc/_regexp.rdoc (renamed from doc/regexp.rdoc)71
-rw-r--r--re.c4
-rw-r--r--string.rb4
5 files changed, 42 insertions, 43 deletions
diff --git a/dir.rb b/dir.rb
index 7de62da921..632c49eee9 100644
--- a/dir.rb
+++ b/dir.rb
@@ -320,7 +320,7 @@ class Dir
# Dir.glob('io.?') # => ["io.c"]
#
# - <tt>'[_set_]'</tt>: Matches any one character in the string _set_;
- # behaves like a {Regexp character class}[rdoc-ref:regexp.rdoc@Character+Classes],
+ # 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)
@@ -328,7 +328,7 @@ class Dir
#
# - <tt>'{_abc_,_xyz_}'</tt>:
# Matches either string _abc_ or string _xyz_;
- # behaves like {Regexp alternation}[rdoc-ref:regexp.rdoc@Alternation]:
+ # behaves like {Regexp alternation}[rdoc-ref:Regexp@Alternation]:
#
# Dir.glob('{LEGAL,BSDL}') # => ["LEGAL", "BSDL"]
#
diff --git a/doc/.document b/doc/.document
index 4b90648377..061fa7d3ef 100644
--- a/doc/.document
+++ b/doc/.document
@@ -1,6 +1,6 @@
*.md
*.rb
-*.rdoc
+[^_]*.rdoc
contributing
NEWS
syntax
diff --git a/doc/regexp.rdoc b/doc/_regexp.rdoc
index 309e109afd..ffba14e78f 100644
--- a/doc/regexp.rdoc
+++ b/doc/_regexp.rdoc
@@ -25,46 +25,46 @@ A regexp may be used:
re.match('food') # => #<MatchData "foo">
re.match('good') # => nil
- See sections {Method match}[rdoc-ref:regexp.rdoc@Method+match]
- and {Operator =~}[rdoc-ref:regexp.rdoc@Operator+-3D~].
+ See sections {Method match}[rdoc-ref:Regexp@Method+match]
+ and {Operator =~}[rdoc-ref:Regexp@Operator+-3D~].
- To determine whether a string matches a given pattern:
re.match?('food') # => true
re.match?('good') # => false
- See section {Method match?}[rdoc-ref:regexp.rdoc@Method+match-3F].
+ See section {Method match?}[rdoc-ref:Regexp@Method+match-3F].
- As an argument for calls to certain methods in other classes and modules;
most such methods accept an argument that may be either a string
or the (much more powerful) regexp.
- See {Regexp Methods}[./Regexp/methods_rdoc.html].
+ See {Regexp Methods}[rdoc-ref:regexp/methods.rdoc].
== \Regexp Objects
A regexp object has:
-- A source; see {Sources}[rdoc-ref:regexp.rdoc@Sources].
+- A source; see {Sources}[rdoc-ref:Regexp@Sources].
-- Several modes; see {Modes}[rdoc-ref:regexp.rdoc@Modes].
+- Several modes; see {Modes}[rdoc-ref:Regexp@Modes].
-- A timeout; see {Timeouts}[rdoc-ref:regexp.rdoc@Timeouts].
+- A timeout; see {Timeouts}[rdoc-ref:Regexp@Timeouts].
-- An encoding; see {Encodings}[rdoc-ref:regexp.rdoc@Encodings].
+- An encoding; see {Encodings}[rdoc-ref:Regexp@Encodings].
== Creating a \Regexp
A regular expression may be created with:
- A regexp literal using slash characters
- (see {Regexp Literals}[https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-Regexp+Literals]):
+ (see {Regexp Literals}[rdoc-ref:syntax/literals.rdoc@Regexp+Literals]):
# This is a very common usage.
/foo/ # => /foo/
- A <tt>%r</tt> regexp literal
- (see {%r: Regexp Literals}[https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-25r-3A+Regexp+Literals]):
+ (see {%r: Regexp Literals}[rdoc-ref:syntax/literals.rdoc@25r-3A+Regexp+Literals]):
# Same delimiter character at beginning and end;
# useful for avoiding escaping characters
@@ -84,7 +84,7 @@ A regular expression may be created with:
Each of the methods Regexp#match, String#match, and Symbol#match
returns a MatchData object if a match was found, +nil+ otherwise;
-each also sets {global variables}[rdoc-ref:regexp.rdoc@Global+Variables]:
+each also sets {global variables}[rdoc-ref:Regexp@Global+Variables]:
'food'.match(/foo/) # => #<MatchData "foo">
'food'.match(/bar/) # => nil
@@ -93,7 +93,7 @@ each also sets {global variables}[rdoc-ref:regexp.rdoc@Global+Variables]:
Each of the operators Regexp#=~, String#=~, and Symbol#=~
returns an integer offset if a match was found, +nil+ otherwise;
-each also sets {global variables}[rdoc-ref:regexp.rdoc@Global+Variables]:
+each also sets {global variables}[rdoc-ref:Regexp@Global+Variables]:
/bar/ =~ 'foo bar' # => 4
'foo bar' =~ /bar/ # => 4
@@ -103,7 +103,7 @@ each also sets {global variables}[rdoc-ref:regexp.rdoc@Global+Variables]:
Each of the methods Regexp#match?, String#match?, and Symbol#match?
returns +true+ if a match was found, +false+ otherwise;
-none sets {global variables}[rdoc-ref:regexp.rdoc@Global+Variables]:
+none sets {global variables}[rdoc-ref:Regexp@Global+Variables]:
'food'.match?(/foo/) # => true
'food'.match?(/bar/) # => false
@@ -112,8 +112,8 @@ none sets {global variables}[rdoc-ref:regexp.rdoc@Global+Variables]:
Certain regexp-oriented methods assign values to global variables:
-- <tt>#match</tt>: see {Method match}[rdoc-ref:regexp.rdoc@Method+match].
-- <tt>#=~</tt>: see {Operator =~}[rdoc-ref:regexp.rdoc@Operator+-3D~].
+- <tt>#match</tt>: see {Method match}[rdoc-ref:Regexp@Method+match].
+- <tt>#=~</tt>: see {Operator =~}[rdoc-ref:Regexp@Operator+-3D~].
The affected global variables are:
@@ -172,17 +172,17 @@ As seen above, the simplest regexp uses a literal expression as its source:
A rich collection of available _subexpressions_
gives the regexp great power and flexibility:
-- {Special characters}[rdoc-ref:regexp.rdoc@Special+Characters]
-- {Source literals}[rdoc-ref:regexp.rdoc@Source+Literals]
-- {Character classes}[rdoc-ref:regexp.rdoc@Character+Classes]
-- {Shorthand character classes}[rdoc-ref:regexp.rdoc@Shorthand+Character+Classes]
-- {Anchors}[rdoc-ref:regexp.rdoc@Anchors]
-- {Alternation}[rdoc-ref:regexp.rdoc@Alternation]
-- {Quantifiers}[rdoc-ref:regexp.rdoc@Quantifiers]
-- {Groups and captures}[rdoc-ref:regexp.rdoc@Groups+and+Captures]
-- {Unicode}[rdoc-ref:regexp.rdoc@Unicode]
-- {POSIX Bracket Expressions}[rdoc-ref:regexp.rdoc@POSIX+Bracket+Expressions]
-- {Comments}[rdoc-ref:regexp.rdoc@Comments]
+- {Special characters}[rdoc-ref:Regexp@Special+Characters]
+- {Source literals}[rdoc-ref:Regexp@Source+Literals]
+- {Character classes}[rdoc-ref:Regexp@Character+Classes]
+- {Shorthand character classes}[rdoc-ref:Regexp@Shorthand+Character+Classes]
+- {Anchors}[rdoc-ref:Regexp@Anchors]
+- {Alternation}[rdoc-ref:Regexp@Alternation]
+- {Quantifiers}[rdoc-ref:Regexp@Quantifiers]
+- {Groups and captures}[rdoc-ref:Regexp@Groups+and+Captures]
+- {Unicode}[rdoc-ref:Regexp@Unicode]
+- {POSIX Bracket Expressions}[rdoc-ref:Regexp@POSIX+Bracket+Expressions]
+- {Comments}[rdoc-ref:Regexp@Comments]
=== Special Characters
@@ -222,7 +222,7 @@ In particular, a source literal may contain interpolated expressions:
/#{2 + 2}/ # => /4/
There are differences between an ordinary string literal and a source literal;
-see {Shorthand Character Classes}[rdoc-ref:regexp.rdoc@Shorthand+Character+Classes].
+see {Shorthand Character Classes}[rdoc-ref:Regexp@Shorthand+Character+Classes].
- <tt>\s</tt> in an ordinary string literal is equivalent to a space character;
in a source literal, it's shorthand for matching a whitespace character.
@@ -279,7 +279,7 @@ for a character class:
/./.match("\n") # => nil
- <tt>/./m</tt>: Matches any character, including a newline;
- see {Multiline Mode}[rdoc-ref:regexp.rdoc@Multiline+Mode}:
+ see {Multiline Mode}[rdoc-ref:Regexp@Multiline+Mode]:
/./m.match("\n") # => #<MatchData "\n">
@@ -578,8 +578,7 @@ called _captures_:
The first capture is the entire matched string;
the other captures are the matched substrings from the groups.
-A group may have a
-{quantifier}[rdoc-ref:regexp.rdoc@Quantifiers]:
+A group may have a {quantifier}[rdoc-ref:Regexp@Quantifiers]:
re = /July 4(th)?/
re.match('July 4') # => #<MatchData "July 4" 1:nil>
@@ -815,7 +814,7 @@ Or by using <tt>\P</tt> (uppercase +P+):
/\P{Alpha}/.match('1') # => #<MatchData "1">
/\P{Alpha}/.match('a') # => nil
-See {Unicode Properties}[./Regexp/unicode_properties_rdoc.html]
+See {Unicode Properties}[rdoc-ref:regexp/unicode_properties.rdoc]
for regexps based on the numerous properties.
Some commonly-used properties correspond to POSIX bracket expressions:
@@ -1012,20 +1011,20 @@ arbitrary text ignored by the regexp engine:
The comment may not include an unescaped terminator character.
-See also {Extended Mode}[rdoc-ref:regexp.rdoc@Extended+Mode].
+See also {Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
== Modes
Each of these modifiers sets a mode for the regexp:
- +i+: <tt>/_pattern_/i</tt> sets
- {Case-Insensitive Mode}[rdoc-ref:regexp.rdoc@Case-Insensitive+Mode].
+ {Case-Insensitive Mode}[rdoc-ref:Regexp@Case-Insensitive+Mode].
- +m+: <tt>/_pattern_/m</tt> sets
- {Multiline Mode}[rdoc-ref:regexp.rdoc@Multiline+Mode].
+ {Multiline Mode}[rdoc-ref:Regexp@Multiline+Mode].
- +x+: <tt>/_pattern_/x</tt> sets
- {Extended Mode}[rdoc-ref:regexp.rdoc@Extended+Mode].
+ {Extended Mode}[rdoc-ref:Regexp@Extended+Mode].
- +o+: <tt>/_pattern_/o</tt> sets
- {Interpolation Mode}[rdoc-ref:regexp.rdoc@Interpolation+Mode].
+ {Interpolation Mode}[rdoc-ref:Regexp@Interpolation+Mode].
Any, all, or none of these may be applied.
diff --git a/re.c b/re.c
index 242b78a95f..86090fc00f 100644
--- a/re.c
+++ b/re.c
@@ -538,7 +538,7 @@ static VALUE rb_reg_str_with_term(VALUE re, int term);
*
* The returned string may be used as an argument to Regexp.new,
* or as interpolated text for a
- * {Regexp interpolation}[rdoc-ref:regexp.rdoc@Interpolation+Mode]:
+ * {Regexp interpolation}[rdoc-ref:Regexp@Interpolation+Mode]:
*
* r1 = Regexp.new(s0) # => /(?ix-m:ab+c)/
* r2 = /#{s0}/ # => /(?ix-m:ab+c)/
@@ -4692,7 +4692,7 @@ rb_reg_timeout_get(VALUE re)
/*
* Document-class: Regexp
*
- * :include: doc/regexp.rdoc
+ * :include: doc/_regexp.rdoc
*/
void
diff --git a/string.rb b/string.rb
index e4de709dc5..137cbe7a88 100644
--- a/string.rb
+++ b/string.rb
@@ -76,7 +76,7 @@
# - <tt>\n</tt> (_n_ a non-negative integer) refers to <tt>$n</tt>.
# - <tt>\k<name></tt> refers to the named capture +name+.
#
-# See rdoc-ref:regexp.rdoc for details.
+# See Regexp for details.
#
# Note that within the string +replacement+, a character combination
# such as <tt>$&</tt> is treated as ordinary text, and not as
@@ -93,7 +93,7 @@
# - <tt>\\+</tt> corresponds to <tt>$+</tt>,
# which contains last capture group.
#
-# See rdoc-ref:regexp.rdoc for details.
+# See Regexp for details.
#
# Note that <tt>\\\\</tt> is interpreted as an escape, i.e., a single backslash.
#