Skip to content

webtools.mdbook #

heroscript

config


!!books.config 	coderoot:'/tmp/code' install:true reset:true publishroot:'/tmp/publish'

//DEFAULTS:
// coderoot    '${os.home_dir()}/hero/code'
// buildroot   '${os.home_dir()}/hero/var/mdbuild'
// publishroot '${os.home_dir()}/hero/www/info'
// install     true
// reset       false

fn book_edit #

fn book_edit(name string) !

fn book_open #

fn book_open(name string) !

fn get #

fn get(cfg_ Config) !MDBooks[Config]

fn (MDBooks[Config]) generate #

fn (mut books MDBooks[Config]) generate(args_ MDBookArgs) !&MDBook

struct Config #

@[params]
struct Config {
pub mut:
	path_build   string ='${os.home_dir()}/hero/var/mdbuild'
	path_publish string ='${os.home_dir()}/hero/www/info'
}

struct ErrorArgs #

@[params]
struct ErrorArgs {
pub mut:
	path string
	msg  string
	cat  doctree.CollectionErrorCat
}

struct FileLoader #

@[heap]
struct FileLoader {
pub mut:
	embedded_files []embed_file.EmbedFileData @[skip; str: skip]
}

struct MDBook #

@[heap]
struct MDBook {
pub mut:
	name         string
	books        &MDBooks[Config] @[skip; str: skip]
	path_build   pathlib.Path
	path_publish pathlib.Path
	args         MDBookArgs
	errors       []doctree.CollectionError
}

fn (MDBook) error #

fn (mut book MDBook) error(args ErrorArgs)

fn (MDBook) generate #

fn (mut book MDBook) generate() !

fn (MDBook) open #

fn (mut book MDBook) open() !

fn (MDBook) summary #

fn (mut book MDBook) summary(production bool) !Summary

struct MDBookArgs #

@[params]
struct MDBookArgs {
pub mut:
	name  string @[required]
	title string

	foldlevel    int
	printbook    bool
	summary_url  string // url of the summary.md file
	summary_path string // can also give the path to the summary file (can be the dir or the summary itself)
	doctree_url  string
	doctree_path string
	publish_path string
	build_path   string
	production   bool
}

struct MDBooks #

@[heap]
struct MDBooks[T] {
	base.BaseConfig[T]
}

struct Summary #

@[heap]
struct Summary {
pub mut:
	items       []SummaryItem
	errors      []SummaryItem // means we found errors, so we need to add to summary
	addpages    []SummaryItem // means we found pages as links, so we need to add them to the summary
	collections []string
	production  bool
}

fn (Summary) str #

fn (mut self Summary) str() string

struct SummaryItem #

struct SummaryItem {
pub mut:
	level       int
	description string
	path        string
	collection  string
	pagename    string
}