Skip to content

data.doctree #

fn new #

fn new(args_ TreeArgsGet) !&Tree

new creates a new tree and stores it in global map

fn tree_get #

fn tree_get(name string) !&Tree

tree_get gets tree from global map

fn tree_set #

fn tree_set(tree Tree)

tree_set stores tree in global map

enum TreeState #

enum TreeState {
	init
	ok
	error
}

struct CollectionNewArgs #

@[params]
struct CollectionNewArgs {
mut:
	name          string @[required]
	path          string @[required]
	heal          bool = true // healing means we fix images, if selected will automatically load, remove stale links
	load          bool = true
	fail_on_error bool
}

struct CollectionNotFound #

struct CollectionNotFound {
	Error
pub:
	pointer pointer.Pointer
	msg     string
}

fn (CollectionNotFound) msg #

fn (err CollectionNotFound) msg() string

struct GraphResponse #

struct GraphResponse {
pub:
	graph  map[string]map[string]bool
	errors []CollectionError
}

struct MacroGetArgs #

@[params]
struct MacroGetArgs {
pub mut:
	actor string
	name  string
}

struct NoOrTooManyObjFound #

struct NoOrTooManyObjFound {
	Error
pub:
	tree    &Tree
	pointer pointer.Pointer
	nr      int
}

the next is our custom error for objects not found

fn (NoOrTooManyObjFound) msg #

fn (err NoOrTooManyObjFound) msg() string

struct ObjNotFound #

struct ObjNotFound {
	Error
pub:
	name       string
	collection string
	info       string
}

fn (ObjNotFound) msg #

fn (err ObjNotFound) msg() string

struct Tree #

@[heap]
struct Tree {
pub:
	name          string
	fail_on_error bool
pub mut:
	collections map[string]&collection.Collection
	defs        map[string]&data.Page
	state       TreeState
	// context context.Context
	cid      string = '000'
	replacer ?regext.ReplaceInstructions
}

fn (Tree) add_collection #

fn (mut tree Tree) add_collection(args_ CollectionNewArgs) !

get a new collection

fn (Tree) export #

fn (mut tree Tree) export(args TreeExportArgs) !

export all collections to chosen directory . all names will be in name_fixed mode . all images in img/

fn (Tree) file_exists #

fn (tree Tree) file_exists(pointerstr string) bool

fn (Tree) get_collection #

fn (tree Tree) get_collection(name string) !&collection.Collection

fn (Tree) get_collection_with_pointer #

fn (tree Tree) get_collection_with_pointer(p pointer.Pointer) !&collection.Collection

fn (Tree) get_file #

fn (tree Tree) get_file(pointerstr string) !&data.File

get the file from pointer string: $tree:$collection:$name or $collection:$name or $name

fn (Tree) get_image #

fn (tree Tree) get_image(pointerstr string) !&data.File

get the page from pointer string: $tree:$collection:$name or $collection:$name or $name

fn (Tree) image_exists #

fn (tree Tree) image_exists(pointerstr string) bool

fn (Tree) key #

fn (tree Tree) key() string

the unique key to remember a tree . is unique per circle (based on cid)

fn (Tree) page_exists #

fn (tree Tree) page_exists(pointerstr string) bool

fn (Tree) page_get #

fn (tree Tree) page_get(pointerstr string) !&data.Page

get the page from pointer string: $tree:$collection:$name or $collection:$name or $name

fn (Tree) process_actions_and_macros #

fn (mut tree Tree) process_actions_and_macros() !

adds all action elements to a playbook, calls playmacros.play on the playbook, which processes the macros, then reprocesses every page with the actions' new content

fn (Tree) process_defs #

fn (mut tree Tree) process_defs() !

process definitions (!!wiki.def actions, elements.Def elements) this must be done before processing includes.

fn (Tree) process_includes #

fn (mut tree Tree) process_includes() !

fn (Tree) scan #

fn (mut tree Tree) scan(args_ TreeScannerArgs) !

walk over directory find dirs with .book or .collection inside and add to the tree . a path will not be added unless .collection is in the path of a collection dir or .book in a book

    path string
    heal bool // healing means we fix images, if selected will automatically load, remove stale links
    git_url   string
    git_reset bool
    git_root  string
    git_pull  bool
```	

fn (Tree) scan_concurrent #

fn (mut tree Tree) scan_concurrent(args_ TreeScannerArgs) !

struct TreeArgsGet #

@[params]
struct TreeArgsGet {
pub mut:
	name          string = 'default'
	fail_on_error bool
}

struct TreeExportArgs #

@[params]
struct TreeExportArgs {
pub mut:
	destination    string @[required]
	reset          bool = true
	keep_structure bool // wether the structure of the src collection will be preserved or not
	exclude_errors bool // wether error reporting should be exported as well
	toreplace      string
	concurrent     bool = true
}

struct TreeScannerArgs #

@[params]
struct TreeScannerArgs {
pub mut:
	path      string
	heal      bool = true // healing means we fix images
	git_url   string
	git_reset bool
	git_root  string
	git_pull  bool
	load      bool = true // means we scan automatically the added collection
}