Albatros
in package
Blogging site generation
Class that actually implements Albatros
albatros is a static Blogging site generator intended to be similar to pelican static site generator.
I wrote it to migrate my private home site to NacoWiki static site generation. I had been using NacoWiki as a front-end to edit my pelican content. However, eventhough they are both using Markdown as its format, there is always implementation differences. By doing this I could use the same renderer for my wiki and my Blog.
albatros is able to use pelican v3.x themes after some tweaking. Also, content follows a simmilar structure as pelican, so migration from pelican to albatros should not be too complicated.
Configuration
albatros settings are stored in the wiki
under an opts.yaml
file
at the root of the wiki
data store. There must be a albatros
key if opts.yaml
storing all the relevant albatros settings.
Tags
Table of Contents
Constants
- VERSION = '0.0.0'
- var string
Properties
- $articles : mixed
- var string[] list of articles. Only contains paths pointing to entries in self::$files. This is due to this array not being used directly but used to assemble articles_page arrays.
- $authors : mixed
- array list of articles per author.
- $categories : mixed
- array list of articles per category.
- $drafts : mixed
- array list of draft articles.
- $exts : mixed
- var string[]
- $files : mixed
- var array containing files meta data
- $htmlcache : mixed
- cache of HTML generated pages
- $opts : mixed
- var array Albatros config settings from opts.yaml
- $pages : mixed
- var string[] list of pages
- $tags : mixed
- array list of articles per tag.
- $twig : mixed
- Twig template globals
Methods
- checkDefaults() : void
- Check configured defaults
- fixLinks() : string
- Fix generated links
- generate() : mixed
- Generate static blog site
- genFile() : void
- Generate individual files
- indexFile() : void
- Index file
- linkFile() : void
- Link references
- load() : void
- Loading entry point for this class
- makeArchive() : void
- Generate Archive page
- makeAuthors() : void
- Generate Author pages
- makeCategories() : void
- Generate category pages
- makeDrafts() : void
- Generate drafts
- makeFeeds() : void
- Generate feeds
- makeIndex() : void
- Generate index pages
- makeSitemap() : void
- Generate Sitemap
- makeTags() : void
- Generate tag pages
- paginator() : void
- Paginate Create paginated views.
- path() : path
- Return this plugin's path
- render() : void
- Process WIKI files into HTML
- selectArticles() : array<string|int, mixed>
- Generate list of articles
- serve() : mixed
- Serve pages
- twigTpl() : Twig
- Load twig template
- xrefFile() : void
- Creates Cross references
Constants
VERSION
var string
public
mixed
VERSION
= '0.0.0'
Properties
$articles
var string[] list of articles. Only contains paths pointing to entries in self::$files. This is due to this array not being used directly but used to assemble articles_page arrays.
public
static mixed
$articles
= []
$authors
array list of articles per author.
public
static mixed
$authors
= []
$categories
array list of articles per category.
public
static mixed
$categories
= []
$drafts
array list of draft articles.
public
static mixed
$drafts
= []
$exts
var string[]
public
static mixed
$exts
= \NULL
$files
var array containing files meta data
public
static mixed
$files
= []
$htmlcache
cache of HTML generated pages
public
static mixed
$htmlcache
= []
$opts
var array Albatros config settings from opts.yaml
public
static mixed
$opts
= []
$pages
var string[] list of pages
public
static mixed
$pages
= []
$tags
array list of articles per tag.
public
static mixed
$tags
= []
$twig
Twig template globals
public
static mixed
$twig
= []
Methods
checkDefaults()
Check configured defaults
public
static checkDefaults(array<string|int, mixed> &$data) : void
Makes sure that certain keys are defined in the albatros
section
with suitable defaults
Parameters
- $data : array<string|int, mixed>
-
- content of $wiki->opts['albatros']
fixLinks()
Fix generated links
public
static fixLinks(NanoWikiApp $wiki, string $html) : string
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $html : string
-
input html
Return values
string —fixed html
generate()
Generate static blog site
public
static generate(NanoWikiApp $wiki, array<string|int, mixed> $argv) : mixed
Usage:
php web/albatros.php bloggen [options]
Options
-
--cfg-[setting]=value : Modifes the setting
setting
which normally would be configured in NacoWiki definition to value. - --output=directory-path : Sets the output directory path.
Note that most of the configuration is in the opts.yaml
at the
root of the wiki.
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $argv : array<string|int, mixed>
-
Command line arguments
Tags
genFile()
Generate individual files
public
static genFile(NanoWikiApp $wiki, string $output, string $f, array<string|int, mixed> $meta) : void
Generate files in the output direcotry
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
- $f : string
-
: file being generated
- $meta : array<string|int, mixed>
-
: file meta data
indexFile()
Index file
public
static indexFile(NanoWikiApp $wiki, string $f) : void
Examine a file and add it to the self::$files array.
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $f : string
-
: file being indexed
linkFile()
Link references
public
static linkFile(NanoWikiApp $wiki, string $f, array<string|int, mixed> &$meta) : void
Expand the meta data and expand link refernces
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $f : string
-
: file being indexed
- $meta : array<string|int, mixed>
-
: file meta data -- this will be modified.
load()
Loading entry point for this class
public
static load(array<string|int, mixed> $cfg) : void
Adds commands implemented by this class
Parameters
- $cfg : array<string|int, mixed>
makeArchive()
Generate Archive page
public
static makeArchive(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeAuthors()
Generate Author pages
public
static makeAuthors(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeCategories()
Generate category pages
public
static makeCategories(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeDrafts()
Generate drafts
public
static makeDrafts(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeFeeds()
Generate feeds
public
static makeFeeds(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeIndex()
Generate index pages
public
static makeIndex(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeSitemap()
Generate Sitemap
public
static makeSitemap(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
makeTags()
Generate tag pages
public
static makeTags(NanoWikiApp $wiki, string $output) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
paginator()
Paginate Create paginated views.
public
static paginator(NanoWikiApp $wiki, string $output, string $twig, string $pgname, array<string|int, mixed> &$alst[, array<string|int, mixed> $vvs = [] ]) : void
..
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $output : string
-
: output directory path
- $twig : string
-
: name of Twig template
- $pgname : string
-
: base page name
- $alst : array<string|int, mixed>
-
: list articles
- $vvs : array<string|int, mixed> = []
-
: additional settings
path()
Return this plugin's path
public
static path([string $f = '' ]) : path
Parameters
- $f : string = ''
-
optional item
Return values
path —to filesystem for $f
render()
Process WIKI files into HTML
public
static render(NanoWikiApp $wiki, array<string|int, mixed> $ex) : void
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $ex : array<string|int, mixed>
-
extra data
selectArticles()
Generate list of articles
public
static selectArticles(function $cb[, mixed $sort = true ]) : array<string|int, mixed>
Parameters
- $cb : function
-
function to call to select articles
- $sort : mixed = true
Return values
array<string|int, mixed> —containing article paths
serve()
Serve pages
public
static serve(NanoWikiApp $wiki, array<string|int, mixed> $argv) : mixed
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $argv : array<string|int, mixed>
-
Command line arguments
Tags
twigTpl()
Load twig template
public
static twigTpl(string $template) : Twig
Parameters
- $template : string
Return values
Twig —template object
xrefFile()
Creates Cross references
public
static xrefFile(NanoWikiApp $wiki, string $f, array<string|int, mixed> $meta) : void
Examine a file meta data and generate cross references
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $f : string
-
: file being indexed
- $meta : array<string|int, mixed>
-
: file meta data