HTMLGen


I write all my own HTML pages, I don't use a special tool or a website publisher. When I was starting in early 2003, I looked around at some Beeb-interest websites for ideas and picked up the basics of embedding images in pages, creating and laying out tables, and adding hyperlinks. Still to this day, that's pretty much all that I use in my own HTML. Nothing fancy at all.

Over the years, I made up a document of useful bits of HTML which I called my "HTML Library", which also had certain hard-to-generate character codes in it, like fraction symbols and the micro prefix.

The first 16 years of BeebMaster webpages were written in a simple text editor - GEdit since November 2008. I also had one or two template files, but generally, to make a new picture set, I would pick one existing set in the right section and save it then find and replace the set name with the new name, then take the first picture page in the set, replace and save that, and go through the whole picture set updating the link for each HTML page and adding a new caption.

It was very time consuming and pretty boring, and had no spell check, no grammar check, and no syntax check.

One benefit to it, at least as I saw it, was that I was writing the captions off the cuff, so they are very natural and unrehearsed, but as this process was often several years after I made the sets, it didn't always make for the most illuminating explanations - if you've ever followed a picture set and felt I didn't know what I was doing, you were probably right! I'm sure I did at the time, but years later perhaps not!

During 2013, I started to make an accompanying caption text file at the time I made the picture sets. Initially this was a brief overview, but over time became a caption for each picture. This served as a very helpful aide-memoire when writing up the picture sets.

What I wanted for a long time was a way to auto-generate the HTML pages from captions I'd already written. I did try a couple of things on occasion. I had a spreadsheet which would make up the main index page table, but it didn't get much use.

In July 2019, I set to work on an HTML Generator written in BBC BASIC, called "HTMLGen". I would have liked to run it on a BBC Micro, but it runs on my RISC PC, which is connected via Sunfish to my shared network storage drive, so that I don't have to worry about truncating filenames or anything like that. It takes a simple plain text file of various variables, index page caption and individual picture captions, which I devised through several iterations, and outputs the information into the index table HTML page and then all the individual picture HTML pages. It does in a few seconds what it used to take me days to do manually.

The first HTMLGen sets were uploaded in August 2019. Even referring to the caption files I'd already written, I was still able to keep the spontaneous feel of the set captions. From August 2019 onwards, every new picture set I make has a captions file written in the HTMLGen format ready for generation at the time the set is uploaded, so when that filters through things might start to make more sense!

In April 2020, I used one of my existing captions text files for the first time in my HTMLGen source file, by applying some regex find and replaces to convert the captions into the right format for my HTMLGen template.

If you look at the HTML source for any new pages, you'll see the HTMLGen credit applied near the top:

< !-- Generated with HTMLGen 4.5 using RISC OS 3.70 on Fri,10 Apr 2020.13:31:25 -- >

This also helps me with another thing I've wanted to do, but been able to figure out how - date-stamp the HTML pages within the source. I thought of using a batch regex find and replace to insert the date, but trying to do that with a date other than now, such as using the file modification time, was very difficult. Being able to search to the right point in the file to insert a hidden date stamp also presented a problem owing to the unstandardised state of many of my existing HTML pages which had developed organically over time. Also it meant that I would have to remember to update the date stamp manually if I ever edited the page.

It was all too much trouble, but the time stamp added by HTMLGen is definitely a step in the direction of knowing when each new page was created. A further bonus is that the pages are now all in a standard format, so if I ever did want to insert something extra at a specific point, it should be possible - at least with pages made by HTMLGen.

By May 2020 I had generated over 3,000 HTML pages in 80 picture sets, and this natty little tool of mine has enabled me to make the May 2020 update one of the biggest ever. Soon I'm hoping to be able to bring you a picture set on HTMLGen generated by HTMLGen!



Click here to return to All About BeebMaster