diff --git a/src/types/page.jl b/src/types/page.jl index ed843a77..6e95a39c 100644 --- a/src/types/page.jl +++ b/src/types/page.jl @@ -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] diff --git a/test/assets/page/title_and_order/config.json b/test/assets/page/title_and_order/config.json index 74637f12..661861e1 100644 --- a/test/assets/page/title_and_order/config.json +++ b/test/assets/page/title_and_order/config.json @@ -1,7 +1,9 @@ { "title": "Custom Title", "order": [ - "subsection_2", - "subsection_1" + "subsection_4", + "subsection_3", + "subsection_1", + "subsection_2" ] } diff --git a/test/assets/page/title_and_order/subsection_3/card_5.md b/test/assets/page/title_and_order/subsection_3/card_5.md new file mode 100644 index 00000000..e69de29b diff --git a/test/assets/page/title_and_order/subsection_4/card_6.md b/test/assets/page/title_and_order/subsection_4/card_6.md new file mode 100644 index 00000000..e69de29b diff --git a/test/types/page.jl b/test/types/page.jl index 8998c156..fd44ed1b 100644 --- a/test/types/page.jl +++ b/test/types/page.jl @@ -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"))