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

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
parent f9d8e42636
commit 10700ca4c1
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;
};
}