LibManual: Associate SubsectionNode with similarly named markdown file

For a subsection named `Foo` with a markdown file `Foo.md` in the same
directory, the document `Foo.md` will be returned when the subsection is
selected.

This prevents PageNodes and SubsectionNodes from sharing the same
name, which fixes an issue in Help where subsections could not be
navigated.
This commit is contained in:
Tim Ledbetter 2023-04-16 10:28:45 +01:00 committed by Andrew Kaster
commit 10700ca4c1
Notes: sideshowbarker 2024-07-17 04:10:16 +09:00
3 changed files with 34 additions and 32 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <LibManual/PageNode.h>
#include <LibManual/SectionNode.h>
namespace Manual {
@ -13,7 +14,7 @@ namespace Manual {
// A non-toplevel (i.e. not numbered) manual section.
class SubsectionNode : public SectionNode {
public:
SubsectionNode(NonnullRefPtr<SectionNode const> parent, StringView name);
SubsectionNode(NonnullRefPtr<SectionNode const> parent, StringView name, RefPtr<PageNode> page = {});
virtual ~SubsectionNode() = default;
virtual Node const* parent() const override;
@ -23,6 +24,9 @@ public:
protected:
NonnullRefPtr<SectionNode const> m_parent;
private:
RefPtr<PageNode> m_page;
};
}