pyMarkdown Minisite

What this script does

This script simply parses a folder with markdown files to html files with an index file containing a list of all files.

More exactly: It parses those files in the passed folder whoose filename ends with .mdwn to html into a subfolder named "static" using the html templates from the "templates" folder.

Also it adds a date footer showing when the file last changed.

For example this scripts main website was created from this readme file. If you're reading this on the web, then you're already on the main website and might be more interested in seeing the markdown code from which this file was parsed :)

Reference

The example style.css has been taken from pybrary.net.

All parsing of files is done using pyMarkdown.

If you like the script, why don't you have a look at its website or its code? (the one of them you aren't reading right now :) )

Requirements

The script requires pyMarkdown to be installed in such a way that markdown.py can be called directly from the command line.

Also it requires a templates directory to be present in the project to be converted:

templates/

Example files are given, so you can just copy the templates folder into your projects folder.

Usage

To use it, just call it with the name of your project, the dir to parse and a main site url.

Usage:

Options: --help - get help --force-update - reparse all sites and update all date tags.

Examples:

Using this script along with Mercurial for simpler static website management

Together with Mercurial hooks this script can be used to manage simple static sites with extremely low effort - if you're on a system with a shell and lftp (commandline ftp client) and naturally Mercurial.

To do so, just add the following hooks to your .hg/hgrc file inside your projects directory (which must be version controlled by Mercurial).

.hg/hgrc:

[hooks]

outgoing.parse = parse_and_list_markdown_files.py "YOUR WEBSITES NAME" . http://YOUR_WEBSITES.URL

outgoing.upload = lftp -c 'open -e "mirror -R ABSOLUTE_PATH_TO_YOUR_PROJECT/static RELATIVE_PATH_ON_YOUR_FTP_SERVER" -u FTP_USERNAME,PASSWORD ftp://YOUR.FTP.URL '

It will then compile every markdown file (*.mdwn) in the top level folder of your project (project/) to html files, put those into the subfolder "static" (project/static/) and then upload the subfolder "static" to the folder on your ftp server which you passed as "RELATIVE_PATH_ON_YOUR_FTP_SERVER".

pyMarkdown Minisite

-- 2013-08-06 23:37:43 --


Created with pyMarkdown Minisite
using the layout from the pybrary.