1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

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.
This commit is contained in:
kleines Filmröllchen 2022-01-07 14:15:44 +01:00 committed by Linus Groh
parent becf74097e
commit 98c0c5e9e6
73 changed files with 177 additions and 165 deletions

View file

@ -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);
}