Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a bug related to order of pages #143

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/types/page.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ function DemoPage(root::String)::DemoPage
page.stylesheet = load_config(page, "stylesheet"; config=config)

section_orders = load_config(page, "order"; config=config)
section_orders = map(sections) do sec
findfirst(x-> x == basename(sec.root), section_orders)
section_orders = map(section_orders) do sec
findfirst(x-> sec == basename(x), sections)
end
ordered_sections = sections[section_orders]

Expand Down
6 changes: 4 additions & 2 deletions test/assets/page/title_and_order/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"title": "Custom Title",
"order": [
"subsection_2",
"subsection_1"
"subsection_4",
"subsection_3",
"subsection_1",
"subsection_2"
]
}
Empty file.
Empty file.
9 changes: 6 additions & 3 deletions test/types/page.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ using DemoCards: infer_pagedir, is_demosection, is_democard
# title and order
page = DemoPage(joinpath(root, "title_and_order"))
@test page.title == "Custom Title"
sec1, sec2 = page.sections
@test sec1.root == joinpath(page.root, "subsection_2")
@test sec2.root == joinpath(page.root, "subsection_1")
sec1, sec2, sec3, sec4 = page.sections
@test sec1.root == joinpath(page.root, "subsection_4")
@test sec2.root == joinpath(page.root, "subsection_3")
@test sec3.root == joinpath(page.root, "subsection_1")
@test sec4.root == joinpath(page.root, "subsection_2")


# template
page = DemoPage(joinpath(root, "template"))
Expand Down