# * P_LZ_COPYRIGHT_BEGIN ****************************************************** # * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. * # * Use is subject to license terms. * # * P_LZ_COPYRIGHT_END ******************************************************** # This file reads a bunch of .html files (in a single folder) and converts # them to website-ready php files. import os, glob, re # Globals OUTPUTDIR = 'build' PHPHEAD = ''' %s ''' PHPFOOT = ''' ''' def checkOutputDir(): if os.path.isdir( OUTPUTDIR ): if not os.access( OUTPUTDIR, os.W_OK ): print 'Can\'t write to output directory' sys.exit() else: try: os.mkdir( OUTPUTDIR ) except: print 'Could not create output directory' def makeFiles(): for f in glob.glob( '*.html' ): s = open(f).read() mouse = '' title = '' if f != 'index.html': # extract title reobj = re.compile( '