Tuesday, December 22, 2009

New Tutorial Toolchain

Previously I generated my tutorial pages (Python Tutorial) by hand writing *.shtml files.  I used Apache SSI (server side includes) as a very basic templating system to construct pages from basic building blocks.  For each code sample I create a *py file.

A makefile ties everything together by running a perl utility, code2html over all the python files to create *.py.html files.  These code snippets are then inserted into the tutorial pages with include directives.

I'm currently in the process of migration to a scheme that uses a real templating system (Genshi) and the Pygments library to build the complete tutorial.  The finished scripts should allow me to work directly with HTML and Python files on disk and compile the whole thing into a complete document.

Reasons for migration:
  • The toolchain will be all python eases migration to Django/Twisted web layer
  • Genshi templates will help ensure that the markup is correct and make it considerably easier to modify the entire tutorials look and feel going forward.  (Or reuse these work for other tutorials I'd like to work on in the future).  
  • Pygments is an excellent syntax highligher with support for a ton of languages.
Unfortunately:
  • There is still a build step
  • Creating tutorials still involves writing html by hand
  • No web interface to edit pages or create new ones

Monday, December 21, 2009

Emacs 23 On Leopard


Just a quick note on building emacs-cvs (emacs23+) on Mac OS 10.6.

First, check emacs out:



$ mkdir Emacs; cd Emacs  
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/cvsroot/emacs co emacs-cvs
Or check it out via Bazaar:


$ bzr branch http://bzr.savannah.gnu.org/r/emacs/trunk emacs-bzr 


 Now create a scratch directory:
$ mkdir emacs-build
$ cd emacs-build

To build the mac App bundle of emacs:





$ ../emacs-cvs/configure --with-ns
$ make install 
$ open nextstep/Emacs.app # just a test to confirm it works before installing
$ sudo cp -r src/Emacs.app /Applications

To build a more old school x11/commandline emacs as well as replacing the emacs22 that ships as the
default on Snow Leopard.  This is my preferred install as I tend to stick to the commandline whenever possible:





$ ../emacs-cvs/configure --prefix=/usr --with-x-toolkit=no --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no
$ make
$ ./src/emacs -q # just a test to confirm it's working before installing
$ sudo make install


Saturday, December 12, 2009

Favicon!

Check out my new penguin/dino favicon!

(Belated) Spring Cleaning

I appreciate all the e-mails from folks who've found the Python tutorials useful.  I'm finally starting to clean up the site as it's kind of a mess at the moment.

There's a long todo list and cleaning up the main page of the site is just the logical place to start.

I'll be updating minor problems in the simple HTML tutorials but will I don't plan on making significant changes or additions until I've got a better way to edit and update that content.  Most likely this means that I'll be plugging in a real CMS to better manage it.  I've some interest in creating a custom engine in Django or Twisted, which might be a really nice example for the tutorials as well as an improvement for me in terms of easy editing and improving the quality of the code running the site currently.

Thanks again for all the encouragement to get back to work on the site.

I'll keep you posted.