pysitegen

pysitegen generates a website from reStructuredText files.

version 0.81 - June 30, 2006

Installation

pysitegen is a Python script meant to be run from the command line. It should run on any system that can run Python. I’ve tested it on Mac OS X and Linux machines, but not on Windows. The instructions below are for *nix systems (including OS X).

In order to use pysitegen, you need the following:

Download pysitegen–0.81.tar.gz

Unpack the archive:

tar xvzf pysitegen-0.81.tar.gz

This will create a subdirectory pysitegen-0.81 containing the pysitegen files.

Now create a symbolic link to pysitegen.py in your home bin directory (assuming it is in your PATH), and make it executable:

ln -s pysitegen-0.81/pysitegen.py ~/bin/pysitegen
chmod +x ~/bin/pysitegen

Usage

Run pysitegen from the directory containing the reStructuredText files. The directory must contain index.page (or index.pagx). Everything else is optional.

site.cfg format::

[DEFAULT]
site-title: Widgets Incorporated
footer: no
exclude-robots: no

[personal.page]
page-title: Personal Page
exclude-robots: yes
footer: yes
hmenu: specialmenu
vmenu: no

[links.page]
footer: linksfooter

Values in [DEFAULT] are defaults for all files. They may be overridden by options in a [filename.page] section.

Keywords for site.cfg:

site-title The default is not to have a site title. If a site title is specified, it will be prepended to the page title in the title of each page.

page-title The page title defaults to the reStructuredText page title_, which is taken from the section heading at the top of the page, if there is one. This can be overridden by a value supplied in the site.cfg file.

header If yes (the default), the html in header is used as a header. If header is not present, the site title (if any) is printed as a header. A no value causes no header to be used. Any other value will be interpreted as a filename containing html for a header. If the file cannot be opened, the site title (if any) will be used.

footer If yes (the default), a footer is included with the time the file was generated and links to docutils and pysitegen web pages. A no value causes no footer to be included. Any other value will be interpreted as a filename containing html for a footer. If the file cannot be opened, an error will be raised.

hmenu If yes (the default), a horizontal menu is included if the file hmenu is present. If no (or if hmenu is not found), no horizontal menu is included. Any other value will be interpreted as the name of an alternative menu definition file. If this file cannot be found, no menu will be included.

vmenu If yes (the default), a vertical menu is included if the file vmenu is present. If no (or if vmenu is not found), no vertical menu is included. Any other value will be interpreted as the name of an alternative menu definition file. If this file cannot be found, no menu will be included.

exclude-robots If yes, code will be inserted into the html telling indexing robots not to index the page or follow links.

Command-line options:

-a force all html files to be rebuilt (by default, a page will be rebuilt only if its source files, including menus or headers, have changed, or if the site configuration file has changed)

-c <file> use an alternative configuration file (default is site.cfg)

-o <dir> put the output html files in the directory <dir> (instead of the current directory)

-i inhibit production of pages from pagx files

-h print help message

-d print detailed documentation

-v print version information

License

Copyright: Copyright (c) 2006 John MacFarlane

Released under the MIT License:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.