From 89c0f84a280778a877b89d1b5f3facf5020095fb Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Mon, 17 Jan 2022 10:43:28 +0100 Subject: [PATCH] Meta: Add icons to online man pages Previously all the added icons weren't available in the online version of the man pages. This patch adds functionality to copy all the used icons over when assembling the HTML version. --- Meta/build-manpages-website.sh | 9 +++++++++ Meta/convert-markdown-links.lua | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/Meta/build-manpages-website.sh b/Meta/build-manpages-website.sh index 4ea9d97eb4..9b4afec226 100755 --- a/Meta/build-manpages-website.sh +++ b/Meta/build-manpages-website.sh @@ -105,3 +105,12 @@ pandoc -f gfm -t html5 -s \ # Copy pre-made files cp Meta/Websites/man.serenityos.org/banner.png output/ + +# Copy icons +mkdir output/icons + +while read -r p; do + rsync -a --relative Base/res/icons/./"$p" output/icons/ +done < icons.txt + +rm icons.txt diff --git a/Meta/convert-markdown-links.lua b/Meta/convert-markdown-links.lua index 30ed1059fe..b94cfbb7ab 100644 --- a/Meta/convert-markdown-links.lua +++ b/Meta/convert-markdown-links.lua @@ -3,3 +3,14 @@ function Link(el) el.target = string.gsub(el.target, "help://man/([^/]*)/(.*)", "../man%1/%2.html") return el end + +function Image(el) + 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