|Up: The Mighty Machine Unleashed||[Related] «^» «T»|
Sunday, October 14, 2001
By Paul Ford
An overview of all the scripts in the system
This is the variables file; it's loaded into nearly every script and includes all directory references and file names, as well as some utility functions.
This pulls in a flat XML links file (i.e. links arranged one record at a time) and creates 3 views of the links:
- By category, which it does by consulting a hierarchically structured XML file with each category name listed (this is called link_categories.xml in the main XML directory, and I edit it by hand) and turning every category into a section; it then figures out which links have categories that aren't in the categories XML file and lists those categories in the top-level of the hierarchical view. You can see an example of the output of this view at All the Links.
- Chronologically, which it does by doing a sort on all the links and organizing them by day. The example of this view is at [#links_in_chron_order_all_nice_like].
- In a table for the left navbar. This is similar to the chronological view, but it oscillates the table color and only picks the last 15 links or so for the left nav bar, so that everything looks swell (see left). It spits out an include file, recent_links.xml, which is then included whenever a regular file is created.
This is a very simple script that makes a “map” of the entire Ftrain structure - i.e. it grabs every <section> tag and the title, desc, and key data. It's much faster to work with this map than with the actual document.
Now we use the map we created and create a new map - this one is flat and lists all the sections in the order they appear in the document with a position number and a random number associated with them. This allows us to associate a random number with each section when we process it, which in turn allows us to choose to include certain parts of other XML files randomly. It's not proper randomness, really, but it'll do until math:random is widely implemented in XSLT processors.
This doesn't really do much for the time being; it's mostly here as a placeholder for some functionality I'd like to offer in the future.
This generates several XML files which are later included in the main XML document - this is a little tricky if you're new to XML, but basically what I do is use system entities, which refer to outside files, to include the output of XSLT transformations against the main Ftrain document in the document itself. This run creates a Reverse Chronological Order TOC, a Forward Chronological Order TOC, a (Not really) RDF (needs an update), and a "Last 10" view.
Utility functions for the two calendar scripts below; I got the code somewhere on the Web, but I can't find it now. It was on a mailing list, so I'll pretend it's more-or-less GNUish.
Generates an XML file which is included in the master XML file to become the ite_calendar.
Generates an XML file which is included with every output page to become the small calendar to your left.
The main processor. Now that we've put together all our maps and views, we go back to the map and with every section in the map, we run the processor again and it creates individual HTML pages, one per section, turning the files we created into new pages or including them in every page as nav elements.
This contains the month listing for the calendar.
Eventually, I'd like a thumbnail directory of all the links of Ftrain; this is a first draft and will grow in time. It's currently not run when I build the site.
A placeholder script.
A shell script that calls everything; pretty straightforward to anyone who has dealt with unix, and fairly straightforward in general.
Mirrors the /xml and /art directories and then runs the build script on a remote machine.
A perl CGI script that makes organizing sites into hierarchies practically fun! As I browse through the Infobahn, when I see a site I like, I click on a button on my browser - a bookmarklet - that calls the following code:
That code puts the title and the name of the link into the right fields; I fill in a category and a descriptions and submit. This then writes to a file in my xml/ directory called flog.xml, and that's what's turned into the links via the XSLT scripts described above.