1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibManual: Allow directly obtaining any page's main section number

This has previously been incorrectly handled in a variety of
applications, e.g. subsections were not accounted for.
This commit is contained in:
kleines Filmröllchen 2023-07-02 13:25:53 +02:00 committed by Linus Groh
parent b1eacf8801
commit a9053618a8
6 changed files with 13 additions and 4 deletions

View file

@ -27,6 +27,11 @@ ErrorOr<String> PageNode::path() const
return TRY(String::formatted("{}/{}.md", TRY(m_section->path()), m_page));
}
unsigned PageNode::section_number() const
{
return m_section->section_number();
}
ErrorOr<NonnullRefPtr<PageNode>> PageNode::help_index_page()
{
static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], TRY("Help-index"_string)));