X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=roundup%2Ftemplatebuilder.py;h=79b1f1bbb880f464cc13292ca023f4dd0e547dd0;hb=2484bfe7139d184af57a0da1e2e29016a1c2467a;hp=bd47d0c7f1eedb63e236927c7706f9e4625c1f87;hpb=fb1c4f5da7d5606485d684528a2eaf74331d8a15;p=roundup.git diff --git a/roundup/templatebuilder.py b/roundup/templatebuilder.py index bd47d0c..79b1f1b 100644 --- a/roundup/templatebuilder.py +++ b/roundup/templatebuilder.py @@ -1,9 +1,30 @@ -# $Id: templatebuilder.py,v 1.8 2001-07-30 08:12:17 richard Exp $ -import errno +# +# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) +# This module is free software, and you may redistribute it and/or modify +# under the same terms as Python, so long as this copyright message and +# disclaimer are retained in their original form. +# +# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING +# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" +# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, +# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Id: templatebuilder.py,v 1.14 2002-02-05 09:59:05 grubert Exp $ +import errno, re + +__doc__ = """ +Collect template parts and create instance template files. +""" preamble = """ # Do Not Edit (Unless You Want To) -# This file automagically generated by roundup.htmldata.makeHtmlBase +# This file automagically generated by roundup.templatebuilder.makeHtmlBase # """ @@ -20,9 +41,10 @@ def makeHtmlBase(templateDir): for file in filelist: # skip the backup files created by richard's vim if file[-1] == '~': continue - mangled_name = os.path.basename(re.sub(r'\.', 'DOT', file)) + mangled_name = os.path.basename(file).replace('.','DOT') fd.write('%s = """'%mangled_name) - fd.write(open(file).read()) + fd.write(re.sub(r'\$((Id|File|Log).*?)\$', r'dollar\1dollar', + open(file).read(), re.I)) fd.write('"""\n\n') fd.close() @@ -63,10 +85,29 @@ if __name__ == "__main__": elif len(sys.argv) == 3: installHtmlBase(sys.argv[1], sys.argv[2]) else: - raise "what you talkin about willis?" + print "Usage: %s