tweecode/twine — pull request #103 by mthuurne (2014-01-08 05:35:31+00:00)
Title: Add "twee" command line compiler to Twine package

The Twee compiler from the separate "twee" package hasn't been updated in over a year and can no longer compile Twee files exported by Twine 1.4.1. Instead of trying to keep the two packages in sync, I propose to add the "twee" command line tool into the Twine package. This pull request contains the required changes.

The first commit solves an issue with Unicode byte order markers in input files. If these are not stripped off, they will lead to encoding errors when running "twee" if stdout is set to encode to ASCII (default). Even if stdout is set to encode to UTF8 using the PYTHONIOENCODING environment variable, the byte order marker will end up in the middle of the output HTML, where it doesn't belong. So it is better to strip it off when reading the file.

The second commit adds an updated version of the "twee" script. See the commit message for details.

The third commit puts the Twine package version string into a separate module. Including the new "twee" script, there were 4 sources that contained that same version string, so to ease maintenance I think it would be better to create a single location for it.