mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Meta/build-manpages-website: Use absolute paths for all links
Previously, we had some broken cross-manpage links on the website after the introduction of subsections. This is fixed by simply always using an absolute path (leading '/') for links, making all images, icons and page links work in all subsections. Unfortunately, this change means that navigating the website build while opening the files in the browser directly will no longer work. However, a local static server such as `python -m http.server 8080` in the output/ directory will work just fine for testing.
This commit is contained in:
parent
76e601d758
commit
e430667923
Notes:
sideshowbarker
2024-07-18 04:46:35 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/e430667923 Pull-request: https://github.com/SerenityOS/serenity/pull/16885 Reviewed-by: https://github.com/linusg
1 changed files with 5 additions and 7 deletions
|
@ -1,22 +1,20 @@
|
||||||
function Link(el)
|
function Link(el)
|
||||||
el.target = string.gsub(el.target, "file:///bin/.*", "../cant-run-application.html")
|
el.target = string.gsub(el.target, "file:///bin/.*", "/cant-run-application.html")
|
||||||
el.target = string.gsub(el.target, "help://man/([^/]*)/(.*)", "../man%1/%2.html")
|
el.target = string.gsub(el.target, "help://man/([^/]*)/(.*)", "/man%1/%2.html")
|
||||||
return el
|
return el
|
||||||
end
|
end
|
||||||
|
|
||||||
function Image(el)
|
function Image(el)
|
||||||
-- HACK: Handle images that are not icons separately; they're copied manually in the
|
-- Images that are not icons are always copied to the website root.
|
||||||
-- Meta/build-manpages-website.sh script.
|
|
||||||
-- Ideally this would be generalized so the paths export below could handle both.
|
|
||||||
if el.src:find("^/res/icons/") == nil then
|
if el.src:find("^/res/icons/") == nil then
|
||||||
el.src = "../" .. el.src
|
el.src = "/" .. el.src
|
||||||
return el
|
return el
|
||||||
end
|
end
|
||||||
|
|
||||||
local pattern = "/res/icons/(.*)"
|
local pattern = "/res/icons/(.*)"
|
||||||
local image = string.gsub(el.src, pattern, "%1")
|
local image = string.gsub(el.src, pattern, "%1")
|
||||||
|
|
||||||
el.src = "../icons/" .. image
|
el.src = "/icons/" .. image
|
||||||
file = io.open("icons.txt", "a+")
|
file = io.open("icons.txt", "a+")
|
||||||
file:write(image .. "\n")
|
file:write(image .. "\n")
|
||||||
file:close()
|
file:close()
|
||||||
|
|
Loading…
Reference in a new issue