This commit is contained in:
2025-08-11 22:34:23 +02:00
parent 965a2bebb7
commit 2c5a2ace17
2 changed files with 5 additions and 35 deletions

View File

@@ -68,24 +68,11 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
if args.path_publish == '' {
args.path_publish = '${f.path_publish.path}/${args.sitename}'
}
path_build_ := '${f.path_build.path}/${args.sitename}'
// get our website
console.print_debug('Docusaurus site ${args.sitename} at ${args.path}.')
mut mysite := site.new(name: args.sitename)!
mut plbook := playbook.new(path: '${args.path}/cfg')!
if plbook.actions.len == 0 {
return error('No actions found in playbook at ${args.path}/cfg')
}
site.play(mut plbook)!
mysite = site.get(name: args.sitename) or {
return error('Failed to get site after playing playbook: ${args.sitename}')
}
println(mysite)
if true{panic("ss8")}
// Get the site object after processing, this is the website which is a generic definition of a site
mut website := sitegen.get(name: site.name)!
// Create the DocSite instance
mut dsite := &DocSite{
name: args.sitename
@@ -99,3 +86,4 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
docusaurus_sites[args.sitename] = dsite
return dsite
}

View File

@@ -46,25 +46,7 @@ pub fn (mut site DocSite) generate() ! {
mut aa := site.path_src.dir_get('docs')!
aa.copy(dest: '${f.path_build.path}/docs', delete: true)!
}
// now we need to process the pages, call the sitegen module, which will look for statements like
// !!site.page sitename:'atest'
// path:"crazy/sub.md" position:1
// src:"marketplace_specs:tft_tfp_marketplace"
// title:"Just a Page"
// description:"A description not filled in"
// draft:1 hide_title:1
configpath := '${site.path_src.path}/cfg'
// Create a playbook from the config path and run site processing
mut plbook := playbook.new(path: configpath)!
sitegen.play(mut plbook)!
// Get the updated site object after processing
mut website := sitegen.get(name: site.name)!
mut main_file := pathlib.get_file(path: '${cfg_path}/main.json', create: true)!
main_file.write(json.encode_pretty(site.config.main))!