diff --git a/examples/web/doctree/markdown_example.vsh b/examples/web/doctree/markdown_example.vsh index b14d3fb3..23c3f51d 100755 --- a/examples/web/doctree/markdown_example.vsh +++ b/examples/web/doctree/markdown_example.vsh @@ -31,13 +31,6 @@ console.print_header('Actions:') println('') println(doc1.actions(actor: 'myactor', name: 'myname')) -// console.print_header('Action Pointers:') -// println('') -// for a in doc1.action_pointers(actor: 'myactor', name: 'myname') { -// doc1.content_set(a.element_id, '> THIS IS WHAT WE FILL IN FROM ACTOR') -// println(a) -// } - console.print_header("Markdown output after macro's:") println('') content2 := doc1.treeview() diff --git a/lib/web/docusaurus/dsite_generate.v b/lib/web/docusaurus/dsite_generate.v index 0414f2fa..5e54d40a 100644 --- a/lib/web/docusaurus/dsite_generate.v +++ b/lib/web/docusaurus/dsite_generate.v @@ -49,17 +49,17 @@ pub fn (mut site DocSite) generate() ! { mut aa := site.path_src.dir_get("docs")! aa.copy(dest: '${site.factory.path_build.path}/docs', delete: true)! - site.download_collections()! + site.process_imports()! } -pub fn (mut site DocSite) download_collections() ! { +pub fn (mut site DocSite) process_imports() ! { //this means we need to do doctree version mut tree := doctree.new(name: 'site_${site.name}')! mut gs := gittools.new()! - for item in site.siteconfig.import_collections { + for item in site.siteconfig.imports { mypath := gs.get_path( pull: false reset: false @@ -67,34 +67,7 @@ pub fn (mut site DocSite) download_collections() ! { )! mut mypatho := pathlib.get(mypath) - if item.frontmatter{ - //if frontmatter specified then no need to do as collections just copy to destination - mypatho.copy(dest: '${site.factory.path_build.path}/docs/${item.dest}', delete: true)! - }else{ - tree.add( - path: mypath - name: item.name - )! - } - } - - //now export all collections - tree.export( - destination: '${site.factory.path_build.path}/collections' - reset: true - exclude_errors: false - )! - for item in site.siteconfig.import_collections { - //if dest specified them we consider source to have the docusaurus parts - if item.dest!=""{ - mypatho.copy(dest: '${site.factory.path_build.path}/docs/${item.dest}', delete: true)! - continue - } - - tree.add( - path: mypath - name: item.name - )! + mypatho.copy(dest: '${site.factory.path_build.path}/docs/${item.dest}', delete: true)! // println(item) //replace: {'NAME': 'MyName', 'URGENCY': 'red'} @@ -102,17 +75,11 @@ pub fn (mut site DocSite) download_collections() ! { for key,val in item.replace { ri.add_item("\{${key}\}",val)! } - // println(ri) + mypatho.copy(dest: '${site.factory.path_build.path}/docs/${item.dest}', delete: true)! ri.replace_in_dir(path:"${site.factory.path_build.path}/docs/${item.dest}",extensions:["md"])! - if item.dest:=""{ - mypatho.copy(dest: '${site.factory.path_build.path}/docs/${item.dest}', delete: true)! - }else{ - mypatho.copy(dest: , delete: true)! - } - - } + } } \ No newline at end of file diff --git a/lib/web/siteconfig/config.v b/lib/web/siteconfig/config.v index bb99a62c..f8c0c35e 100644 --- a/lib/web/siteconfig/config.v +++ b/lib/web/siteconfig/config.v @@ -12,7 +12,7 @@ pub mut: copyright string = 'someone' footer Footer menu Menu - import_collections []CollectionsImport + imports []ImportItem pages []Page // New fields for Docusaurus compatibility @@ -86,7 +86,7 @@ pub mut: ssh_name string } -pub struct CollectionsImport { +pub struct ImportItem { pub mut: name string //will normally be empty url string // http git url can be to specific path @@ -94,5 +94,4 @@ pub mut: dest string // location in the docs folder of the place where we will build docusaurus replace map[string]string // will replace ${NAME} in the imported content visible bool = true - frontmatter bool //if frontmatter is part of the document } diff --git a/lib/web/siteconfig/play.v b/lib/web/siteconfig/play.v index c8fe4bc3..00e65df9 100644 --- a/lib/web/siteconfig/play.v +++ b/lib/web/siteconfig/play.v @@ -48,7 +48,7 @@ pub fn play(args_ PlayArgs) ! { mut config := SiteConfig{} play_config(mut plbook, mut config)! - play_collections(mut plbook, mut config)! + play_import(mut plbook, mut config)! play_menu(mut plbook, mut config)! play_footer(mut plbook, mut config)! play_pages(mut plbook, mut config)! @@ -98,30 +98,9 @@ fn play_config(mut plbook PlayBook, mut config SiteConfig) ! { } } -// Remove the old play_config content as it's now part of the new one above -/* - config_actions := plbook.find(filter: 'site.config')! - if config_actions.len == 0 { - return error('no config found') - } - if config_actions.len > 1 { - return error('multiple config found, not ok') - } - for action in config_actions { - mut p := action.params - // Get optional name parameter or use base_url as fallback - config.name = p.get('name')! - config.name = texttools.name_fix(config.name) - config.title = p.get_default('title', 'Documentation Site')! - config.description = p.get_default('description', 'Comprehensive documentation built with Docusaurus.')! - config.tagline = p.get_default('tagline', 'Your awesome documentation')! - config.favicon = p.get_default('favicon', 'img/favicon.png')! - config.image = p.get_default('image', 'img/tf_graph.png')! -*/ - -fn play_collections(mut plbook PlayBook, mut config SiteConfig) ! { - import_actions := plbook.find(filter: 'site.collections')! - // println('import_actions: ${import_actions}') +fn play_import(mut plbook PlayBook, mut config SiteConfig) ! { + import_actions := plbook.find(filter: 'site.import')! + println('import_actions: ${import_actions}') for action in import_actions { mut p := action.params mut replace_map := map[string]string{} @@ -134,16 +113,15 @@ fn play_collections(mut plbook PlayBook, mut config SiteConfig) ! { } } } - mut import_ := CollectionsImport{ + mut import_ := ImportItem{ name: p.get_default('name','')! - frontmatter: p.get_default('frontmatter','')! url: p.get('url')! path: p.get_default('path', '')! dest: p.get_default('dest', '')! replace: replace_map visible: p.get_default_false('visible') } - config.import_collections << import_ + config.imports << import_ } }