mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
e430667923
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.
22 lines
631 B
Lua
22 lines
631 B
Lua
function Link(el)
|
|
el.target = string.gsub(el.target, "file:///bin/.*", "/cant-run-application.html")
|
|
el.target = string.gsub(el.target, "help://man/([^/]*)/(.*)", "/man%1/%2.html")
|
|
return el
|
|
end
|
|
|
|
function Image(el)
|
|
-- Images that are not icons are always copied to the website root.
|
|
if el.src:find("^/res/icons/") == nil then
|
|
el.src = "/" .. el.src
|
|
return el
|
|
end
|
|
|
|
local pattern = "/res/icons/(.*)"
|
|
local image = string.gsub(el.src, pattern, "%1")
|
|
|
|
el.src = "/icons/" .. image
|
|
file = io.open("icons.txt", "a+")
|
|
file:write(image .. "\n")
|
|
file:close()
|
|
return el
|
|
end
|