AutoHTML Manual

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Index & NewsWritingWebcomicsProgrammingArtworkAll ElseLinks & Mail

  1. Overview
    1. Why AutoHTML?
    2. Warnings
    3. The Story
  2. Operation
    1. Command Line
    2. List Files
    3. Parsed Commands
      1. Control Commands
      2. Insert Commands
      3. Flow Commands
      4. Variable Commands
    4. Tips & Examples
  3. Errors & Suggestions

1. Overview
AutoHTML is a script designed to simplify the creation of HTML pages sharing a common design without resorting to high-level HTML editors. AutoHTML has very little ability to write and alter the HTML files it works on, thus any errors that develop can most likely be tracked down and repaired in the original code (rather than trying to trick the HTML editor into doing what you want).

1.1 Why AutoHTML?
So why use AutoHTML? It's trivial to just use PHP's include to perform the same tasks on the server. <?php include "header.html" ?> doesn't require brilliant computer skills. Well, there are a few hosting services which are still back in the HTML-only age. If you want to be really anal, PHP takes a few milliseconds longer to load than a straight HTML file. More important though, documentation and other off-line files can't be distributed in PHP, and unless you have PHP installed you can't test pages written with it. Also a PHP file uses the access time as its last modified date, rather than the last time it actually changed.

1.2 Warnings
AutoHTML is nothing more than a Perl script. Perl scripts can easily be used for malicious code. It is advisable to back up your files and to only give AutoHTML write-access to the directory it is using for output. Do not use versions of this code from questionable sources. AutoHTML leaves a lot open for the user without guards. It is quite possible to build an HTML input file that can execute malicious code. (Just off hand, I can think of two ways to make bad things happen using the input files)

Just remember: Back up your files and make sure all your files are from a trustworthy source.

1.3 The Story
Back when I started working with HTML, I built a simple personal website using frames. But then as I grew more experienced, I learned that framesets are terrible, they commiserate with the devil, they drink the blood of innocent programmers and above all, they make sites harder to use.

But I wanted to have nifty navigation bars on the sides of my pages that were the same through out. And it was such hard work going to every page and changing the nav bar every time I decided to add another segment.

"Wouldn't it be nice if there was a program, which took bits of HTML and combined them together into one large HTML file?" I thought, "It could have simple conditional evaluation so that the currently viewed file was removed from the navigation bar and there could be flags to adjust the content." So I began programming.

The first version contained about 180 lines of C-code and had seven commands that could be embedded into a file. And it was good. It pulled together header.htm and navbar.htm and footer.htm along with many content files to create a nifty-looking site. But C leaves much to be desired in the ways of string processing, so it was difficult to update and relied on many cheating tricks.

But there was yet hope! One year after autohtml.c was created, I knew Perl. and so was born ahtml.pl. Filling nearly 400 lines of code, it contained 16 commands along with a number of command-line switches and the ability to seek out the files it was to parse on its own. And it was even better. PHP files are created and navbars were generated which had links to the most recently updated file! And thanks to the power of Perl's built-in regex operators, modifications were easy, and the tags could have readable names like LINEIF rather than IFU

But towards the end of September, a new problem developed. ahtml.pl was fond of inserting whitespace. Commands turned into space characters and blank lines were everywhere. Ordinarily, HTML ignores whitespace, but in MSIE the whitespace caused images to be incorrected separated. And that caused me to rewrite the parsing engine into a character-by-character parser. After several sodas, much "WHEN DID THAT CHARACTER BECOME A STRING?"s and general bafflement at the mysterious and arcane workings of Perl, it was finished.

...all that work just so I wouldn't have to copy & paste a few lines whenever I started a new html page.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The BEST Text Editor Ever