Home > Implementation > Scripting

Scripting

The python scripts have been tested under

trwnavs.py

Functionality

Looks for a file body.htm in current working directory and generates a file trWNav.xml in the same directory. trWNav.xml contains meta data about body.htm, e.g. the relative path to the home page and information about "related nodes". More…

Prerequisites

trwnavs.py traverses up the directory tree until a body.htm file is found, which is marked with the element

<meta name="htHom" content="y"/>

This is the home page.

trwnvall.py

Functionality

Generates all trWNav.xml files for a whole branch. It recursively processes the current working directory and all its sub-directories and generates a structure file trWNav.xml from each body.htm by using its meta data.

Prerequisites

Imports trwnavs.py

trwups.py

Functionality

Generates one index.htm file. It looks for the file trWNav.xml and body.htm in the current working directory plus a style sheet trWSite.xsl in the parent directory of the home directory and generates a file index.htm in the same directory.

Prerequisites

trwupall.py

Functionality

Generates all index.htm files for a whole branch. It recursively processes the current working directory and all its subdirectories and generates each index.htm from the related body.htm and trWNav.xml.

Prerequisites

trwsmap.py

Functionality

This file is an optional part of the trgensit package. It helps to generate a "site map" web page.

The script recursively processes the parent of the current working directory and all its sub-directories and generates a file body.htm in the current working directory. The assumption is that the site map directory is a direct child of home.

That special generated file body.htm contains links in a tree like fashion to all index.htm, i.e. to all pages of the site.

That body.htm file shall also be included in the navigation, like all other body.htm files. Hence ‑ after generating that site map body.htm file ‑ the script need to be run twice on the whole site, to get a consistent state.

Prerequisites

Must have files trWNav.xml in each directory. Hence trwnvall.py must have been run on the complete site to generate all trWNav.xml files.

trwlib.py

This is a central library to be included into the other python scripts. It defines names for all the files the package trgensit uses.

Optional Scripts

This distribution of trgensit contains the additional script trwupds_de.py. This script supports using another language ‑ in my case German ‑ next to the default language. The approach is


Last change: 2024-09-24
© 2002-2024 Dr. Thomas Redelberger redetho(at)gmx.de