Serenity Operating System
at master 36 lines 852 B view raw
1/* 2 * Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org> 3 * Copyright (c) 2022, the SerenityOS developers. 4 * 5 * SPDX-License-Identifier: BSD-2-Clause 6 */ 7 8#include "PageNode.h" 9#include "SectionNode.h" 10#include <AK/RefPtr.h> 11 12namespace Manual { 13 14Node const* PageNode::parent() const 15{ 16 return m_section.ptr(); 17} 18 19ErrorOr<Span<NonnullRefPtr<Node const>>> PageNode::children() const 20{ 21 static Vector<NonnullRefPtr<Node const>> empty_vector; 22 return empty_vector.span(); 23} 24 25ErrorOr<String> PageNode::path() const 26{ 27 return TRY(String::formatted("{}/{}.md", TRY(m_section->path()), m_page)); 28} 29 30ErrorOr<NonnullRefPtr<PageNode>> PageNode::help_index_page() 31{ 32 static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], TRY("Help-index"_string))); 33 return help_index_page; 34} 35 36}