...
This commit is contained in:
@@ -75,6 +75,9 @@ pub fn (mut site DocSite) process_imports() ! {
|
||||
mut f:=factory_get()!
|
||||
|
||||
for item in site.website.siteconfig.imports {
|
||||
|
||||
if true{panic("not implemented import")}
|
||||
|
||||
mypath := gs.get_path(
|
||||
pull: false
|
||||
reset: false
|
||||
@@ -85,7 +88,7 @@ pub fn (mut site DocSite) process_imports() ! {
|
||||
mypatho.copy(dest: '${f.path_build.path}/docs/${item.dest}', delete: false)!
|
||||
|
||||
println(item)
|
||||
replace: {'NAME': 'MyName', 'URGENCY': 'red'}
|
||||
//replace: {'NAME': 'MyName', 'URGENCY': 'red'}
|
||||
mut ri := regext.regex_instructions_new()
|
||||
for key, val in item.replace {
|
||||
ri.add_item('\{${key}\}', val)!
|
||||
@@ -98,4 +101,4 @@ pub fn (mut site DocSite) process_imports() ! {
|
||||
]
|
||||
)!
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -64,16 +64,3 @@ pub fn factory_set(args_ DocSiteFactoryArgs) !DocSiteFactory {
|
||||
|
||||
return factory
|
||||
}
|
||||
|
||||
pub fn dsite_get(name_ string) !&DocSite {
|
||||
name := texttools.name_fix(name_)
|
||||
return docusaurus_sites[name] or {
|
||||
return error('docusaurus site with name "${name}" does not exist')
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dsite_exists(name_ string) !bool {
|
||||
name := texttools.name_fix(name_)
|
||||
d := docusaurus_sites[name] or { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import freeflowuniverse.herolib.develop.gittools
|
||||
import freeflowuniverse.herolib.web.site
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
import freeflowuniverse.herolib.osal.core as osal
|
||||
import freeflowuniverse.herolib.core.playbook
|
||||
// import freeflowuniverse.herolib.data.doctree
|
||||
|
||||
|
||||
|
||||
@[params]
|
||||
pub struct AddArgs {
|
||||
@@ -20,7 +20,6 @@ pub mut:
|
||||
git_root string
|
||||
git_pull bool
|
||||
path_publish string
|
||||
play bool = true
|
||||
}
|
||||
|
||||
pub fn dsite_add(args_ AddArgs) !&DocSite {
|
||||
@@ -30,7 +29,7 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
|
||||
console.print_header('Add Docusaurus Site: ${args.sitename}')
|
||||
|
||||
if args.sitename in docusaurus_sites {
|
||||
return error('Docusaurus site ${args.sitename} already exists, returning existing.')
|
||||
return error('Docusaurus site ${args.sitename} already exists, no need to add again.')
|
||||
}
|
||||
|
||||
mut path := gittools.path(
|
||||
@@ -71,7 +70,7 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
|
||||
path_build_ := '${f.path_build.path}/${args.sitename}'
|
||||
|
||||
// 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)!
|
||||
mut website := site.get(name: args.sitename)!
|
||||
|
||||
// Create the DocSite instance
|
||||
mut dsite := &DocSite{
|
||||
@@ -79,11 +78,23 @@ pub fn dsite_add(args_ AddArgs) !&DocSite {
|
||||
path_src: pathlib.get_dir(path: args.path, create: false)!
|
||||
path_publish: pathlib.get_dir(path: args.path_publish, create: true)!
|
||||
path_build: pathlib.get_dir(path: path_build_, create: true)!
|
||||
config: new_configuration(mysite.siteconfig)!
|
||||
website: mysite
|
||||
config: new_configuration(website.siteconfig)!
|
||||
website: website
|
||||
}
|
||||
|
||||
docusaurus_sites[args.sitename] = dsite
|
||||
return dsite
|
||||
}
|
||||
|
||||
pub fn dsite_get(name_ string) !&DocSite {
|
||||
name := texttools.name_fix(name_)
|
||||
return docusaurus_sites[name] or {
|
||||
return error('docusaurus site with name "${name}" does not exist')
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dsite_exists(name_ string) !bool {
|
||||
name := texttools.name_fix(name_)
|
||||
d := docusaurus_sites[name] or { return false }
|
||||
return true
|
||||
}
|
||||
@@ -13,24 +13,18 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
// This populates the global `site.websites` map.
|
||||
site.play(mut plbook)!
|
||||
|
||||
mut a := plbook.ensure_once(filter: 'docusaurus.define')!
|
||||
|
||||
// check if docusaurus.define exists, if not, we create a default factory
|
||||
mut f := DocSiteFactory{}
|
||||
if plbook.max_once(filter: 'docusaurus.define')! {
|
||||
mut a := plbook.get(filter: 'docusaurus.define') or {
|
||||
panic('docusaurus.define action not found, this should not happen.')
|
||||
}
|
||||
mut p := a.params
|
||||
f = factory_set(
|
||||
path_build: p.get_default('path_build', '')!
|
||||
path_publish: p.get_default('path_publish', '')!
|
||||
reset: p.get_default_false('reset')
|
||||
template_update: p.get_default_false('template_update')
|
||||
install: p.get_default_false('install')
|
||||
)!
|
||||
a.done = true
|
||||
} else {
|
||||
f = factory_get()!
|
||||
}
|
||||
mut p2 := a.params
|
||||
mut f := factory_set(
|
||||
path_build: p2.get_default('path_build', '')!
|
||||
path_publish: p2.get_default('path_publish', '')!
|
||||
reset: p2.get_default_false('reset')
|
||||
template_update: p2.get_default_false('template_update')
|
||||
install: p2.get_default_false('install')
|
||||
)!
|
||||
a.done = true
|
||||
|
||||
// 3. Process `docusaurus.add` actions to create sites.
|
||||
for mut action in plbook.find(filter: 'docusaurus.add')! {
|
||||
@@ -47,7 +41,6 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
git_root: p.get_default('git_root','')!
|
||||
git_pull: p.get_default_false('git_pull')
|
||||
path_publish: p.get_default('path_publish', f.path_publish.path)!
|
||||
play: false // need to make sure we don't play again
|
||||
)!
|
||||
action.done = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user