Skip to content

Commit

Permalink
Script to generate xhtml11 output
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Apr 10, 2012
1 parent f2fef66 commit c3148e2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,8 @@
Contributing to the TicketMonster tutorial
==========================================

Each section of the tutorial is contained in a `.txt` file in this git repository. To build the tutorial you'll need [AsciiDoc](http://www.methods.co.nz/asciidoc/index.html) installed. It's available via most major packaging systems (e.g. Debian, Fedora Extra, MacPorts), and has a Windows installer.

You'll also need pygments for syntax highlighting. It's available as a python egg.

Once you have installed AsciiDoc, you can build individual sections by invoking `asciidoc -b <output of choice> <section.txt>`. If you want to generate the whole tutorial as html, you can call `./generate.sh`.
37 changes: 37 additions & 0 deletions generate.sh
@@ -0,0 +1,37 @@
#!/bin/bash

# Require BASH 3 or newer

REQUIRED_BASH_VERSION=3.0.0

if [[ $BASH_VERSION < $REQUIRED_BASH_VERSION ]]; then
echo "You must use Bash version 3 or newer to run this script"
exit
fi

# Canonicalise the source dir, allow this script to be called anywhere

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# DEFINE

TARGET=$DIR/target

echo "** Building tutorial"

echo "**** Cleaning $TARGET"
rm -rf $TARGET
mkdir -p $TARGET

echo "**** Copying shared resources to $TARGET"
cp -r gfx $TARGET

files=`find * -iname *.txt`
for file in $files
do
output_filename=$TARGET/${file//.txt/.html}
echo "**** Processing $file > ${output_filename}"
asciidoc -b xhtml11 -a pygments -o ${output_filename} $file
done

0 comments on commit c3148e2

Please sign in to comment.