Content:

Home

HTMLTools

Overview

Using HTML frames is not a good way if you want to keep your pages very compatible. Also the browsers back button and history doesn't work in the right way then.

But embedding a menu without frames requires to put the menus code into every page. Also if one menu entry changes, the change has to be made for every page. This is very error prone.

So I wrote a tool that inserts text macros in multiple HTML files. Also this tool removes redundancies from the HTML code to decrease the download size.

The configuration can be done with a graphical user interface. The execution can be done via command line to allow the program to be executed in a batch file.

Usage

Graphical User Interface

Assumed Java 2 is installed on the PC, HTMLTools can be started by double clicking it in the windows environment, or calling it from the command line with:
java -jar HTMLTools.jar.

The following actions can be chosen from the tool bar:
Open Opens a configuration.
Save Saves a configuration.
Configuration Displays the configuration. This button is only needed, if the configuration window has become invisible because the execution log window is displayed.
Start Applies the selected tools to the HTML files. Please remember that the files will be changed, and some changes like removing comments, are decreasing the readability of the code. So only apply the tools to a copy of the original files.

Command Line

After an configuration has been saved in the graphical user interface mode, the tool can be started from the command line with appending the name of the config file as parameter. To start MyConfig.cfg automatically, call:
java -jar HTMLTools.jar MyConfig.cfg

Configuration

Exec What

Exec what?
Two different tools can be chosen. Macroinserter is the tool that inserts Textmacros in HTML files. Compressor removes redundancies from HTML files.

Some changes made by the Compressor like removing comments are irreversible. Please only activate it if the tools are applied to a copy of the original files. The compressor is in an early stage, so it can't be guaranteed that the HTML files are still working after the tool has been applied. Also it's not very efficient at the moment.

Directories

Directories
Here, you can choose the directory with the HTML files the tools should be applied. Please be aware that some configurations do irreversible changes to the files. So better only apply the tool to copies of the original files.

Macroinserter

Macroinserter
In this dialog, the macros can be selected.

A macro is a file with the suffix '.mac'. The name of the file without the suffix is the name of the macro. When the macro inserter is applied, it searches the HTML files for the two lines:

and

The lines are comment and are therfore ignored by the browser. Macroname has to be exchanged with the name of the macro.
The content between these two lines will be removed and replaced with the .mac file.

A HTML file can contain multiple macros with multiple names.

Compressor

Compressor
The compressor removes redundancies from the HTML files. The following actions can be selected:
Remove comments
Removes comments from the file. If a comment is part of a script like Javascript, it won't be removed. Be aware the the marker for the HTML macros are also comments. These will also be removed. The Macroinserter will therefore not work after the comments have been removed.
Remove unneeded quotation marks
Some parameters inside HTML tags can be written in two ways. E.g.: Width="100" and Width=100. Both versions are valid, so the latter version should be preferred, because it saves space. If these action should be applied, redundant quotation marks inside HTML-Tags are removed.

Download

Executable JAR file Sourcecode

Michael Habermann