summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorkleines Filmröllchen <malu.bertsch@gmail.com>2022-01-07 14:15:44 +0100
committerLinus Groh <mail@linusgroh.de>2022-01-11 00:24:57 +0100
commit98c0c5e9e65c1ef42f6a3a1da2726950ac79c560 (patch)
treeba08ac8e698584734215bc78ada3000d234644f9 /Userland
parentbecf74097e853d9ad501628f9d6f8b70cdaa8d6e (diff)
downloadserenity-98c0c5e9e65c1ef42f6a3a1da2726950ac79c560.zip
Help+Base: Add help://man URLs for links between man pages
The URLs of the form `help://man/<section>/<page>` link to another help page inside the help application. All previous relative page links are replaced by this new form. This doesn't change any behavior but it looks much nicer :^) Note that man doesn't handle these new links, but the previous relative links didn't work either.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/Help/main.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp
index bf63b6b16f..23e63f4be3 100644
--- a/Userland/Applications/Help/main.cpp
+++ b/Userland/Applications/Help/main.cpp
@@ -243,6 +243,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
history.push(path);
open_page(path);
+ } else if (url.protocol() == "help") {
+ if (url.host() == "man") {
+ if (url.paths().size() != 2) {
+ dbgln("Bad help page URL '{}'", url);
+ return;
+ }
+ auto const section = url.paths()[0];
+ auto const page = url.paths()[1];
+ open_url(URL::create_with_file_scheme(String::formatted("/usr/share/man/man{}/{}.md", section, page), url.fragment()));
+ } else {
+ dbgln("Bad help operation '{}' in URL '{}'", url.host(), url);
+ }
} else {
open_external(url);
}