web.starlight #
fn load_config #
fn load_config(cfg_dir string) !Config
load_config loads all configuration from the specified directory
fn new #
fn new(args_ StarlightArgs) !&StarlightFactory
enum ErrorCat #
enum ErrorCat {
unknown
image_double
file_double
file_not_found
image_not_found
page_double
page_not_found
sidebar
circular_import
def
summary
include
}
struct Config #
struct Config {
pub mut:
footer Footer
main Main
navbar Navbar
}
Combined config structure
fn (Config) write #
fn (c Config) write(path string) !
struct ContentItem #
struct ContentItem {
pub mut:
url string
dest string
replacer map[string]string // items we want to replace
}
pulled from e.g. git and linked to a destination in the astro build location
struct DocSite #
@[heap]
struct DocSite {
pub mut:
name string
url string
path_src pathlib.Path
path_build pathlib.Path
// path_publish pathlib.Path
args SiteGetArgs
errors []SiteError
config Config
factory &StarlightFactory @[skip; str: skip] // Reference to the parent
}
fn (DocSite) build #
fn (mut s DocSite) build() !
fn (DocSite) build_dev_publish #
fn (mut s DocSite) build_dev_publish() !
fn (DocSite) build_publish #
fn (mut s DocSite) build_publish() !
fn (DocSite) clean #
fn (mut site DocSite) clean(args ErrorArgs) !
fn (DocSite) dev #
fn (mut s DocSite) dev() !
fn (DocSite) error #
fn (mut site DocSite) error(args ErrorArgs)
fn (DocSite) generate #
fn (mut site DocSite) generate() !
struct ErrorArgs #
@[params]
struct ErrorArgs {
pub mut:
path string
msg string
cat ErrorCat
}
struct Main #
struct Main {
pub mut:
name string
title string = 'A Test Site'
// tagline string
url string = 'http://localhost/testsite'
// url_home string
// base_url string = '/' @[json: 'baseUrl']
// image string = 'img/tf_graph.png' @[required]
build_dest []string @[json: 'buildDest']
build_dest_dev []string @[json: 'buildDestDev']
content []ContentItem
}
struct SiteError #
struct SiteError {
Error
pub mut:
path string
msg string
cat ErrorCat
}
struct SiteGetArgs #
@[params]
struct SiteGetArgs {
pub mut:
name string
nameshort string
path string
url string
publish_path string
build_path string
production bool
watch_changes bool = true
update bool
init bool // means create new one if needed
deploykey string
config ?Config
}
struct StarlightArgs #
@[params]
struct StarlightArgs {
pub mut:
// publish_path string
build_path string
production bool
update bool
}
struct StarlightFactory #
@[heap]
struct StarlightFactory {
pub mut:
sites []&DocSite @[skip; str: skip]
path_build pathlib.Path
// path_publish pathlib.Path
args StarlightArgs
}
fn (StarlightFactory) get #
fn (mut f StarlightFactory) get(args_ SiteGetArgs) !&DocSite