AsciiDoc Website Builder
|
|
|
|
|
AsciiDoc Website BuilderAsciiDoc Website Builder (awb) is a python program that allows you to write a website in almost plain text (ie AsciiDoc), plus a few simple configuration files. It exists to solve my problem of never updating my own website (which used a lot of PHP) because I couldn’t quickly remember offhand all the changes and specific formatting I needed to add new pages. Features
Getting startedTo start using awb you need to set up at least one website in your user awb configuration file. This is located at ~/.awb/awb.conf It could look something like this: [mywebsite] siteroot: /home/me/mywebsite baseurl: http://my.web.site asciidoc options: -d book -b html4 This simply defines a website known to awb as "mywebsite". The options are:
Once you have a website configured and some source files written, simply issue the command % awb mywebsite awb will only regenerate HTML files that have become out of date. If this doesn’t work for some reason, the option -r can be used to fix it. % awb -r mywebsite This can be done from anywhere in the filesystem. awb knows from its configuration file where to read from and write to. awbdir.confEach directory in the source tree may contain a configuration file named awbdir.conf. This file specifies directory-specific options to be used by awb. [dir setup] section
awbdir.conf [blog] sectionThis section defines settings used if the directory type is blog.
[user] sectionHere you can define any option you like. It can be referred to in the template. This is useful when you want to use the same template across the site, but change small parts of it (eg. an image). awbdir.conf options cascade from a directory to its children. This is quite convenient, as child directories need only override the parent options that do not apply. The only exception is the directory name, which does not cascade. Directory TypesNormalIn a normal directory, all files ending in “.txt” have the template and subtemplate applied, and are then converted via AsciiDoc into HTML files. Blogawb’s blog framework is quite flexible, although for obvious reasons it can’t support reader comments. All you really need to do is to create your blog posts, one per file, using a logical naming structure. The index.html file (showing your most recent posts) and contents.html (listing the titles of all posts, with headings each month) are automatically generated for you. awb uses the path of a post to determine its date. All the path separators are stripped out, leaving a string of digits which are interpreted as follows:
The following paths all produce valid dates. 2007/10/12/13/15.txt 2007/10/121315.txt 2007/1012/1315.txt 200710121315.txt This system leaves you with a lot of flexibility as to how deeply you want your directories nested. The first line of the post file is taken as the title of the post. This title is used in the recent posts list and in contents.html. This is consistent with the AsciiDoc markup that you would normally use. In addition to this standard blog format, awb also supports a magazine-like blog formatting feature. In this model, a collection of posts belong to a magazine, which has its own "table of contents" post which can be used to summarise and/or introduce the other posts. In addition, a magazine-like blog generates two extra insertables. A magazine-like blog also generates a magazine-contents.html file which contains a list of all magazines. You define a magazine-like blog simply by including a post with a .mag.txt extension. Each .mag.txt file is a magazine "table of contents". All posts earlier than a .mag.txt post (and later than the previous .mag.txt post) belong to that magazine. Posts later than the latest .mag.txt belong to a virtual magazine entitled "News". GalleryWhen a directory is specified as a gallery, files with the extension .gal.txt are treated specially. Each .gal.txt file is a room in the gallery, and is formatted as shown in the following example: [room] title: The title of the room. intro: Some text introducing the room. [filename.jpg] title: The title of the photo. caption: A caption for the photo. The title, intro and caption values are optional, but if you don’t use them, don’t include them in your templates either. TemplatesEach directory in the source tree may contain a configuration file named template.conf. This file contains the page templates to be used by awb. If a template is not specified, very basic defaults are provided. Here is an example of template.conf: [main template] This template is the first you would typically define. Typically you would put here some stuff that you want to insert before the main text of your page, like a navigation bar. Then you insert the page content like this: <?insert content?> Then you can write your footer. [sub template] This template replaces <?insert content?> from the main template. Use this when you need to add a little content to each page, but not override the inherited main template. [post template] When you write a blog, this template is applied to each blog post. It replaces <?insert content?> [room template] This template is used a lot like a sub template for a gallery room. [room photo template] This template is applied to each photo in a gallery room. [photo template] This template is a lot like a sub template for each large-sized photo in a gallery. awb templates are cascading. This allows templates to be defined once in the root of the website, and applied everywhere. The only exception to this is the sub template, which does not cascade. awb CommandsGlobal commandsCommands may be used anywhere in an awb source file, but the most common place to use them is in templates. <? and ?> delimit awb commands (like php). The following commands are available:
Blog Commands
Gallery Commands
Ignoring FilesYou may have files in your source directory that aren’t supposed to go onto the website. Or you may have a text file (like Yahoo’s verification file) that shouldn’t get turned into HTML. You can tell awb to ignore these files using two special files in the root of your website source. .ignoreFiles listed here are totally ignored by awb. This file is simply a list of filenames on new lines. The filename can use the unix glob syntax (* and friends). .copytxtFiles listed here are copied straight to the HTML output directory. As with the ignore list, this is a list of filenames on new lines, and uses the glob syntax. |
|
|
Copyright © 2005-2008 Jared Henley This page is best viewed in a standards-compliant web browser. This site was created using: gedit; the GIMP; and AsciiDoc Website Builder. If you would like me to create your website, send me a message. Last updated Monday, June 2, 2008 |
|