2022-07-12 22:20:27 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "PageNode.h"
|
|
|
|
#include "SectionNode.h"
|
2022-12-11 21:32:35 +00:00
|
|
|
#include <AK/RefPtr.h>
|
2022-07-12 22:20:27 +00:00
|
|
|
|
|
|
|
namespace Manual {
|
|
|
|
|
|
|
|
Node const* PageNode::parent() const
|
|
|
|
{
|
|
|
|
return m_section.ptr();
|
|
|
|
}
|
|
|
|
|
2023-02-20 17:59:53 +00:00
|
|
|
ErrorOr<Span<NonnullRefPtr<Node const>>> PageNode::children() const
|
2022-07-12 22:20:27 +00:00
|
|
|
{
|
2023-03-06 13:17:01 +00:00
|
|
|
static Vector<NonnullRefPtr<Node const>> empty_vector;
|
2022-12-14 12:33:28 +00:00
|
|
|
return empty_vector.span();
|
2022-07-12 22:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrorOr<String> PageNode::path() const
|
|
|
|
{
|
|
|
|
return TRY(String::formatted("{}/{}.md", TRY(m_section->path()), m_page));
|
|
|
|
}
|
|
|
|
|
2023-07-02 11:25:53 +00:00
|
|
|
unsigned PageNode::section_number() const
|
|
|
|
{
|
|
|
|
return m_section->section_number();
|
|
|
|
}
|
|
|
|
|
2022-12-11 21:32:35 +00:00
|
|
|
ErrorOr<NonnullRefPtr<PageNode>> PageNode::help_index_page()
|
|
|
|
{
|
2023-08-07 09:12:38 +00:00
|
|
|
static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], "Help-index"_string));
|
2022-12-11 21:32:35 +00:00
|
|
|
return help_index_page;
|
|
|
|
}
|
|
|
|
|
2022-07-12 22:20:27 +00:00
|
|
|
}
|