Automatic Web Page Updates

 

homepage.py

Everything on my Web site is a copy of original files stored on my notebook's hard drive. Obviously this means I don't have to be concerned with making back-ups of what's on my Web site (I back-up my hard drive instead).

Content from files on notebook are uploaded to the Internet using a custom script called “homepage.py”. It was written with the Python scripting language.

Script “homepage.py” basically does two things:

Actually, two things are not automated so there may be differences between original files on notebook and the ones on the Web:

 

num_ents.py

A supporting module called “num_ents” converts general entities to numeric character references.

Why? It performs a conversion that would otherwise happen when jade converts XML to HTML. But jade is large and is for doing a whole lot more that simply putting stuff on the Internet as an HTML file. Module num_ents simply converts a general entity (for example, ““”) into a numeric character reference (““” converts to ““”). General entities are easier to read (““” is short for left double-quote) and can appear in DocBook documents. They also multiply in one's brain easily. All you need to remember is the single form or syntax of "left/right" + "single/double" + "quo;"

Once the form is known it's a trivial matter to type the needed quote: ldquo/lsquo/rsquo/rdquo. Another example is the acute accent mark: "letter" + "acute;" =

For some reason, Gacute is not in /usr/lib/sgml/entities/iso-lat2.ent. And it's not in HTML Presentation of ST.32 US Patent grant V1.9 2000-03-07. However it is in Apple glyph PostScript names where U+01F4=Gacute and U+01F5=gacute. And why does IE 5.5 display U+01F5 (a.k.a. &#x01F5) as a square?

Anyhow, they (general entities) can't (shouldn't) appear in Web pages because not all browsers can display all the glyphs represented by general entities. All browsers (?) understand numeric character references regardless of whether they can properly display the intended glyph.

 

lpy.py

A Python script called “lpy.py” was used to transform Python scripts into the HTML pages seen by clicking on the above hyperlinks. It was written by someone at Danbala Software. To learn about “lpy” and the concept literate programming, click here.

Lpy didn't work at first (Debian GNU/Linux 2.1 or “slink”). Modules “token” and “tokenize” were not installed by that particular version of Debian (that's strange, since both are listed in the Python Library Reference under “3. Python Services”). Also, there's one 8KB version of “tokenize.py” on the Web that does not work with lpy (name error “NL”) and a 9KB version that does.

It was a lot easier to get lpy working compared with py2html — the later depends upon mxTextTools, a collection of text tools that needs compiling with “make.”

 

Programs That Automate HTML Generation

Above mention was made of lpy, a script used to automatically translate a Python script to HTML format suitable for presentation on the Internet.

Other scripts used to construct this site include:

mhonarc MHonArc
MHonArc is a Perl mail-to-HTML converter. To install this utility onto my laptop required one simple step.
  1. apt-get --install mhonarc
Example of usage:
mhonarc -single lafn_block_20000714.eml lafn0714.html