mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
sync_default_gems: Replace the URIs to be redirected
The reference generated by using RDoc without the proper `--page-dir` option (or `.rdoc_options`) file may contain `/doc/`. Since these URIs are redirected by the server now, replace such URIs with the corresponding rdoc-refs too.
This commit is contained in:
parent
3539da64fc
commit
b57ecc3eb8
1 changed files with 1 additions and 1 deletions
|
@ -86,7 +86,7 @@ end
|
||||||
|
|
||||||
def replace_rdoc_ref(file)
|
def replace_rdoc_ref(file)
|
||||||
src = File.binread(file)
|
src = File.binread(file)
|
||||||
src.gsub!(%r[\[\Khttps://docs\.ruby-lang\.org/en/master/(([A-Z]\w+(?:/[A-Z]\w+)*)|\w+_rdoc)\.html(\#\S+)?(?=\])]) do
|
src.gsub!(%r[\[\Khttps://docs\.ruby-lang\.org/en/master(?:/doc)?/(([A-Z]\w+(?:/[A-Z]\w+)*)|\w+_rdoc)\.html(\#\S+)?(?=\])]) do
|
||||||
name, mod, label = $1, $2, $3
|
name, mod, label = $1, $2, $3
|
||||||
mod &&= mod.gsub('/', '::')
|
mod &&= mod.gsub('/', '::')
|
||||||
if label && (m = label.match(/\A\#(?:method-([ci])|(?:(?:class|module)-#{mod}-)?label)-([-+\w]+)\z/))
|
if label && (m = label.match(/\A\#(?:method-([ci])|(?:(?:class|module)-#{mod}-)?label)-([-+\w]+)\z/))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue