Struct gazetta_core::model::Source
[−]
[src]
pub struct Source<SourceMeta = (), EntryMeta = ()> where
SourceMeta: Meta,
EntryMeta: Meta, { pub title: String, pub root: PathBuf, pub origin: String, pub prefix: String, pub entries: Vec<Entry<EntryMeta>>, pub static_entries: Vec<StaticEntry>, pub stylesheets: Vec<PathBuf>, pub javascript: Vec<PathBuf>, pub icon: Option<PathBuf>, pub meta: SourceMeta, }
The Source object reads and interprets a source directory.
The fields are intentionally public. Feel free to manually generate or modify this structure.
Fields
title: String
The website's title.
By default, this field is read from gazetta.yaml
.
root: PathBuf
The source root directory.
This is specified on construction.
origin: String
The website origin (http://mydomain.com:1234)
By default, this field is derived from the value of base
in gazetta.yaml
.
prefix: String
The directory under the origin at which this site will be hosted (e.g. "/").
By default, this field is derived from the value of base
in gazetta.yaml
.
entries: Vec<Entry<EntryMeta>>
The website content to be rendered.
By default, this list is populated with Entries generated from files with the basename index under the root directory excluding:
Files under directories named "static".
Files under
assets/
.
static_entries: Vec<StaticEntry>
The website content to be deployed as-is (no rendering).
By default, this list is populated with directories under the root directory named "static" excluding:
Directories under directories named "static".
Directories under
assets/
.
stylesheets: Vec<PathBuf>
The website stylesheets. When rendered, these will be concatinated into a single stylesheet.
By default, this list is populated by the files in is assets/stylesheets/
in
lexicographical order.
javascript: Vec<PathBuf>
The website javascript. When rendered, these will be concatenated into a single javascript file.
By default, this list is populated by the files in is assets/javascript/
in
lexicographical order.
icon: Option<PathBuf>
The path website's icon.
By default, this points to assets/icon.png
(if it exists).
meta: SourceMeta
Additional metadata read from gazetta.yaml
.
Methods
impl<SourceMeta, EntryMeta> Source<SourceMeta, EntryMeta> where
SourceMeta: Meta,
EntryMeta: Meta,
[src]
SourceMeta: Meta,
EntryMeta: Meta,
fn build_index(&self, entry: &Entry<EntryMeta>) -> Vec<&Entry<EntryMeta>>
Build an index for an entry.
This index includes all entries that "cc" this entry and all entries specified in this entry's index pattern.
fn new<P: AsRef<Path>>(root: P) -> Result<Self, AnnotatedError<SourceError>>
Parse a source directory to create a new source.
fn reload(&mut self) -> Result<(), AnnotatedError<SourceError>>
Reload from the source directory.
Call this after changing source files.
Trait Implementations
impl<SourceMeta: Debug, EntryMeta: Debug> Debug for Source<SourceMeta, EntryMeta> where
SourceMeta: Meta,
EntryMeta: Meta,
[src]
SourceMeta: Meta,
EntryMeta: Meta,
impl<SourceMeta: Clone, EntryMeta: Clone> Clone for Source<SourceMeta, EntryMeta> where
SourceMeta: Meta,
EntryMeta: Meta,
[src]
SourceMeta: Meta,
EntryMeta: Meta,
fn clone(&self) -> Source<SourceMeta, EntryMeta>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more