Abstract
Describes a Python-language module for the generation of static and dynamic Web pages in the New Mexico Tech Computer Center's style.
This publication is available in Web form and also as a PDF document.
Please forward any comments to tcc-doc@nmt.edu.
Table of Contents
tccpage2test: A small test driverXHTML_DOCTYPE: Document type
declaration for XHTMLXHTML_NS: The XHTML namespace URICSS_URL: Stylesheet locationTOP_NAV_SEP: Separator string
for the top navigational barTCC_MAIN_URL: TCC mainpage URLTCC_LOGO_URL: TCC logo URLBOT_NAV_SEP: Separator for
page-bottom linksaddTextMixed(): Generating mixed
content with lxmlclass TCCPage: The page instance
interfaceTCCPage.__init__():
ConstructorTCCPage.__createHead():
Set up page headingTCCPage.__createBody():
Set up page bodyTCCPage.__topNav(): Set up top
nav barTCCPage.__topNavItem(): Add
one top navigational itemTCCPage.__titleBlock(): Set up
page title blockTCCPage.__botNav(): Set up
page-bottom navigational linksTCCPage.__botNavItem():
Generate page-bottom navigational linkTCCPage.__botNavShort(): Generate a
short-form bottom nav linkTCCPage.__botNavGeneral(): Generate a
general bottom nav linkTCCPage.__colophon(): Add
colophon sectionTCCPage.write(): Output the
finished pageclass NavLink: Describes
one navigational featureThe PyStyler application is used to maintain the bulk of the pages in the Tech Computer Center page structure and the TCC Help System. This application is rather antiquated, the design substantially stable since 1996; see Building informational webs with PyStyler (PDF format) for user-level documentation.
One major limitation of this system is that it treats its web pages as static structure, to be maintained with an ordinary text editor.
A number of TCC scripts generate Web pages outside the PyStyler system. Some scripts generate one or more static pages; other scripts are CGI scripts that generate pages dynamically in response to user requests. Ideally, PyStyler should be rewritten so that its content template can be applied easily to dynamically generate pages as well as to static pages inside a PyStyler document tree. This is a fairly sizeable project, however.
Here, we describe a Python module named tccpage2.py that
is intended for use by Python scripts that generate web
pages. Its purpose is to mimic the appearance of pages
generated by PyStyler so that they blend visually with
static pages.
Here's why this is a short-term solution. The PyStyler
system uses a template file named
Template to describe the overall
layout of a TCC page. The templates used in the TCC web and
TCC help web haven't changed much lately, so they're the
basis of the style imitated by the tccpage2.py module. But
if in the future we want to modify these templates, we'll
have to modify the logic in the tccpage2.py module in
parallel. The best long-term solution is to do a whole
new version of PyStyler that has a single source for
template information that can drive both static and
dynamic page generation.
This package is called tccpage2.py because it is a rewrite of
an earlier package, described in tccpage.py: Dynamic generation of TCC-style web
pages.
Files generated from this document:
tccpage2.py: The module itself.
tccpage2test: The test
driver.