From 0ca87c5f327357781965286f9d60ca967eb3e952 Mon Sep 17 00:00:00 2001 From: despiegk Date: Sun, 30 Nov 2025 09:19:10 +0100 Subject: [PATCH] ... --- lib/web/docusaurus/dsite_link_docs.v | 5 +- lib/web/site/factory.v | 7 ++- lib/web/site/{model_nav.v => model_sidebar.v} | 46 +------------------ lib/web/site/model_site.v | 2 +- 4 files changed, 10 insertions(+), 50 deletions(-) rename lib/web/site/{model_nav.v => model_sidebar.v} (59%) diff --git a/lib/web/docusaurus/dsite_link_docs.v b/lib/web/docusaurus/dsite_link_docs.v index df88e9c1..d82603ad 100644 --- a/lib/web/docusaurus/dsite_link_docs.v +++ b/lib/web/docusaurus/dsite_link_docs.v @@ -22,8 +22,5 @@ pub fn (mut docsite DocSite) link_docs() ! { println(c) - if true{ - panic('link_docs is not yet implemented') - } - // $dbg; + $dbg; } diff --git a/lib/web/site/factory.v b/lib/web/site/factory.v index d5e65bd6..365324ff 100644 --- a/lib/web/site/factory.v +++ b/lib/web/site/factory.v @@ -21,7 +21,12 @@ pub fn new(args FactoryArgs) !&Site { return get(name: name)! } - mut site := Site{} + mut site := Site{ + nav: SideBar{} + siteconfig: SiteConfig{ + name: name + } + } sites_global[name] = &site return get(name: name)! } diff --git a/lib/web/site/model_nav.v b/lib/web/site/model_sidebar.v similarity index 59% rename from lib/web/site/model_nav.v rename to lib/web/site/model_sidebar.v index d4fee447..4ad9b9dc 100644 --- a/lib/web/site/model_nav.v +++ b/lib/web/site/model_sidebar.v @@ -3,11 +3,9 @@ module site import json // Top-level config -pub struct NavConfig { +pub struct SideBar { pub mut: my_sidebar []NavItem - // myTopbar []NavItem //not used yet - // myFooter []NavItem //not used yet } // -------- Variant Type -------- @@ -94,50 +92,10 @@ fn nav_item_to_json(item NavItem) !NavItemJson { } // Convert entire NavConfig sidebar to JSON string -pub fn (nc NavConfig) sidebar_to_json() !string { +pub fn (nc SideBar) sidebar_to_json() !string { mut result := []NavItemJson{} for item in nc.my_sidebar { result << nav_item_to_json(item)! } return json.encode_pretty(result) } - -// // Convert entire NavConfig topbar to JSON-serializable array -// fn (nc NavConfig) topbar_to_json() ![]NavItemJson { -// mut result := []NavItemJson{} -// for item in nc.myTopbar { -// result << nav_item_to_json(item)! -// } -// return result -// } - -// // Convert entire NavConfig footer to JSON-serializable array -// fn (nc NavConfig) footer_to_json() ![]NavItemJson { -// mut result := []NavItemJson{} -// for item in nc.myFooter { -// result << nav_item_to_json(item)! -// } -// return result -// } - -// port topbar as formatted JSON string -// pub fn (nc NavConfig) jsondump_topbar() !string { -// items := nc.topbar_to_json()! -// return json.encode_pretty(items) -// } - -// // Export footer as formatted JSON string -// pub fn (nc NavConfig) jsondump_footer() !string { -// items := nc.footer_to_json()! -// return json.encode_pretty(items) -// } - -// // Export all navigation as object with sidebar, topbar, footer -// pub fn (nc NavConfig) jsondump_all() !string { -// all_nav := map[string][]NavItemJson{ -// 'sidebar': nc.sidebar_to_json()! -// 'topbar': nc.topbar_to_json()! -// 'footer': nc.footer_to_json()! -// } -// return json.encode_pretty(all_nav) -// } diff --git a/lib/web/site/model_site.v b/lib/web/site/model_site.v index 4e4fd723..41b9e172 100644 --- a/lib/web/site/model_site.v +++ b/lib/web/site/model_site.v @@ -4,6 +4,6 @@ module site pub struct Site { pub mut: pages map[string]Page // key: "collection:page_name" - nav NavConfig // Navigation sidebar configuration + nav SideBar // Navigation sidebar configuration siteconfig SiteConfig // Full site configuration }