epp - The Everything Pre-Processor


Alex Leone / codes / epp

The Google Code Homepage: epp - The Everything Preprocessor

epp is a pre-processor that uses python-like indentation - no escape characters needed. This website uses epp as a template system (download the source code). For example, the source for this page ('index.html.epp') is


            [default_template:]
                title: epp - The Everything Pre-Processor
                pagetitle: epp - The Everything Pre-Processor
                keywords: epp
                content:
                    <p>
                        The Google Code Homepage:<br />
                        <a href="http://code.google.com/p/epp/">epp - The Everything Preprocessor</a>
                    </p>
                    <p>
                        epp is a pre-processor that uses python-like indentation - no escape
                        characters needed.  This website uses epp as a template system
                        (<a href="public_html_src.zip">download the source code</a>). For
                        example, the source for this page ('[filename i]') is
                        <pre><code>
                            ...
                        </code></pre>
                    </p>
                    ...
            

Building websites is easy:

epp is written in python, so it's easy to add more advanced functionality: for example, the code for the address bar under the page title is (in nav.eppd):


            [compile navlinks:]
                outname = '[filename]'
                basename = outname[:outname.rfind('.')]
                relpath = '[filename r]'
                relsplit = relpath.split('/')
                sep = ' / '
                outlinks = ['<a href="[home]">Alex Leone</a>']
                builtpath = ''
                for dname in relsplit:
                    if len(dname) == 0:
                        continue
                    builtpath += dname + '/'
                    outlinks.append('<a href="[base_address]%s">%s</a>' % (
                                builtpath, dname))
                if len('[ifdef addrpagename="1"]') > 0:
                    outlinks.append('[acurrent text="[addrpagename]"]')
                elif basename != 'index':
                    outlinks.append('[acurrent text="%s"]' % (basename))
                elif len(relpath) > 0:
                    outlinks[-1] = '[acurrent text="%s"]' % (relsplit[-1].capitalize())
                else:
                    outlinks = ['[acurrent text="Alex Leone"]']
                output += sep.join(outlinks)
            
            [define nav:]
                <h3 id="addr">
                    [navlinks]
                </h3>