homepage.pyEverything 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:
jade, so “booksred.html” on Web could
be stale. It would be inefficient to both execute
jade and upload all HTML files each time a single
book is added to the “books” XML database./etc/ppp/ip-up.d does not contain
a file that would trigger the execution of “homepage.py”. That means
whenever a PPP connection is established to my Internet
service provider from my laptop, files are not
refreshed on the Web. I need to remember to execute
“homepage.py”
manually to get Web pages up-to-date with laptop
files. These three shell scripts are run each time a
connection is made (fetch mail, mail transfer agent, and
ISDN utilities):
-rwxr-xr-x 1 root root 873 Dec 31 1999 exim -rwxr-xr-x 1 root root 952 Jun 8 20:24 fetchmail -rwxr-xr-x 1 root root 822 Aug 3 1999 isdnutils
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.
ǵ) 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.pyA 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.”
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:
apt-get --install mhonarc
mhonarc -single lafn_block_20000714.eml lafn0714.html