Skip to content

Commit 7a5743c

Browse files
committed
[GR-17457] Rewriting links is now handled when importing files in the website
PullRequest: truffleruby/1918
2 parents 2cb0520 + 9bb2c03 commit 7a5743c

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

tool/generate-user-doc.rb

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,6 @@
22

33
contents = File.read("#{root}/README.md")
44

5-
# Fix links
6-
contents = contents.gsub(/\]\(([^)]+)\)/) {
7-
link = $1
8-
if link.start_with?('#')
9-
# link to same document
10-
elsif link.start_with?('http://') or link.start_with?('https://')
11-
# absolute link
12-
elsif link.start_with?("doc/user/")
13-
link = link.sub("doc/user/", "")
14-
else
15-
if link.end_with?('.png')
16-
link = "https://raw.githubusercontent.com/oracle/truffleruby/master/#{link}"
17-
else
18-
link = "https://github.com/oracle/truffleruby/blob/master/#{link}"
19-
end
20-
end
21-
"](#{link})"
22-
}
23-
245
# Remove the Documentation section for the website (redundant with the sidebar menu)
256
contents = contents.sub(/^## Documentation\n.+?\n##/m, '##')
267

@@ -31,11 +12,3 @@
3112
contents = "# TruffleRuby\n\n#{contents}"
3213

3314
File.write("#{root}/doc/user/README.md", contents)
34-
35-
# Fix links to README for all doc/user files
36-
Dir.glob("#{root}/doc/user/*.md") do |file|
37-
contents = File.read(file)
38-
contents = contents.gsub('](../../README.md#', '](../#')
39-
contents = contents.gsub('](../contributor/', '](https://github.com/oracle/truffleruby/blob/master/doc/contributor/')
40-
File.write(file, contents)
41-
end

0 commit comments

Comments
 (0)