I wasn't too happy with the Pascal to HTML converters I found on the web, so I decided to try and write my own converter. The basic principle is that it's CSS based. The program inserts “<span>” tags with class properties for each type of string: keywords, strings, numbers, comments and compiler directives. The program uses an HTML template file where it inserts the code, and which has default CSS definitions for the different classes.
The version number indicates that this is the first release version. I wrote the initial version in about a day and a half, and this means the following:
Despite these incompletenesses I hope this tool will prove useful for anyone who wants his or her Pascal or Delphi code on a website.
Steven's Pascal to HTML converter can be downloaded here.
The program comes without an installer. Just unzip the files to the folder you prefer. Note that all files must go to the same folder.
Usage should be straightforward.
Included is a keywords.txt file, listing the keywords of the Pascal language. Code highlighting is based on this file. That means that you can add or delete keywords if you like. I already added Delphi keywords not found in the Pascal language, like “private” and “public”.
The file template.htm contains the code to create a valid HTML5 document, and in which the converted Pascal code is inserted. The marker for this is the string “***insert***”. As you can see in the supplied template there may be other text on the same line, which is important for the use of the “<pre>” tag.
Template.htm also contains some sample CSS, which you can change at will, or move to an external file.
Version 1.20 dd. 2014-07-24
Version 1.10 dd. 2014-07-23
Version 1.0 dd. 2014-07-18
Steven's Pascal to HTML converter is free software. However, if you're satisfied with the program and want to show your appreciation you can donate a small amount via Paypal.
Steven's Pascal to HTML converter may not be sold, but you're free to distribute it as long as the contents of the ZIP file remains unchanged.
I welcome your comments, bug reports, suggestions, and general feedback here.