#!/usr/bin/env python # Siter # Generate full johnj.com Web site from content markup, navigation skeletons, CSS, etc. # John Jacobsen, NPX Designs, Inc., john@mail.npxdesigns.com # (C) 2007 NPX Designs, Inc. # Started: Sun Sep 30 14:01:22 2007 import optparse, os, sys, re from xml.dom import minidom import Image class NavTree: def __init__(self, url=None, txt=None, isHomeLink=False): self.items = [] self.linkURL = url self.linkTxt = txt self.isHomeLink = isHomeLink def __str__(self): return self.pr(0) def pr(self, indent=0): s = "'%s'->%s\n" % (self.linkTxt, self.linkURL) for x in self.items: s += ' '*indent + x.pr(indent+3) return s class SourceHTML: """ Object for parsing directory source HTML files (gallery.html or post.html) """ def __init__(self, f): # Get content content = open(f).read() # Get title self.title = "" m = re.search("

Gallery '%s'
" % galDir else: s = SourceHTML(srcFile) title = "%s: %s" % (self.siteTitle, s.title) text = "'%s'
" % f else: s = SourceHTML(srcFile) title = "%s: %s" % (self.siteTitle, s.title) text = "