refactor: adapt docusaurus to use generic site module

- Introduce a new generic `site` module for web generation
- Update `herocmds` to use the new site creation flow
- Simplify docusaurus playbook logic with a `docusaurus.play` fn
- Refactor site generation to act on `Site` struct directly
- Fix playbook find filter to use wildcard `*`
This commit is contained in:
Mahmoud-Emad
2025-07-31 14:42:36 +03:00
parent e837912363
commit 697c500e35
7 changed files with 35 additions and 69 deletions

View File

@@ -8,10 +8,10 @@ import os
pub struct SiteGenerator {
pub mut:
siteconfig_name string
path pathlib.Path
client &doctreeclient.DocTreeClient
flat bool // if flat then won't use sitenames as subdir's
siteconfig_name string
path pathlib.Path
client &doctreeclient.DocTreeClient
flat bool // if flat then won't use sitenames as subdir's
}
@[params]
@@ -22,7 +22,7 @@ pub mut:
}
// new creates a new siteconfig and stores it in redis, or gets an existing one
pub fn (siteconfig SiteConfig)generate(args SiteGeneratorArgs) ! {
pub fn (site Site) generate(args SiteGeneratorArgs) ! {
mut path := args.path
if path == '' {
path = '${os.home_dir()}/hero/var/sitegen'
@@ -33,11 +33,11 @@ pub fn (siteconfig SiteConfig)generate(args SiteGeneratorArgs) ! {
flat: args.flat
}
for section in siteconfig.sections {
for section in site.sections {
factory.section_generate(section)!
}
for page in siteconfig.pages {
for page in site.pages {
factory.page_generate(page)!
}
}