Impression to HTML
Dave Holden explains how to use our RISCWorld HTML converter
Using the program
Before you can convert an Impression file to HTML you need an appropriate Mappings file. A 'basic' file named 'DefaultMap' is provided and there is also one called 'Manual' which was designed to work with the format used to write this manual. As this TextStory is provided with the program you can use it with this mapping file to make an HTML version of the manual to demonstrate how the program works.
Load Imp-HTML by double-clicking on the application icon and it will install itself on the icon bar. If you click MENU on this icon a menu will appear with the usual Info and Quit items at top and bottom and three others, Process, Mappings and Save Choices. More about the others later, but for the moment select Process and the window below will open. You can also open this window by clicking SELECT on the iconbar icon.
At this stage there is a 'greyed out' directory icon on the right hand side. Drag the Impression TextStory to the icon at the top of the window labelled Source file. Its name will appear there, the directory icon will become 'active' and the instruction 'Enter name and drag dir. icon to convert file' will appear at the bottom.
Output file options
The 'box' at the bottom left of the window defines the form the HTML file(s) will take. There are three options;
- Chapters + Index will divide the HTML into chapters at predetermined points with a separate index file.
- Chapters, no Index divide the document into chapters but without creating an index.
- Single file with Index will create just one long HTML file with an index at the beginning of the file.
- Single file, no Index again makes a single HTML file but this time without an index.
The first two methods create a directory in which the files are placed. The name shown in the Save as icon is the name of this directory. If there are any graphics files to be included these can then be placed in this directory or a sub-directory.
The second two methods create a single file so there's no need for a directory. In this case the name in the Save as icon will be the name of the HTML file and the icon will change from a directory to an HTML file icon.
Chapter numbers
When you split your file up into separate chapters they are given names with a numeric suffix. These would normally be in the form Chap01, Chap02, Chap03 etc. If the original file also has chapter numbers and you want to arrange for the file names to correspond with them they might be out of step if there is something such as a Preface or Introduction before 'Chapter 1'.
This option enables you to adjust the numbers given to the HTML 'chapter' files. By clicking on the 'bump' icons you can make the numbers begin with '00' or even negative numbers, so that if your document does have a Preface that would be Chap00 so that Chapter 1 of the document would correspond with Chap01.
Naming options
On the right hand side you can choose the format of the output file names.
The three option buttons under the heading Name Case let you choose how you want the names to appear. This can be all lower case, lower case with a capital first letter, or all upper case.
The second set of option buttons, labelled Extension, let you choose what 'file extension' you with to apply. This can be either htm or hrml, either of which may be used to indicate an HTML file on other systems. You can also choose None, but if you select this option your files will only be readable on RISC OS as other operating systems require a file extension in order to recognise the file type.
If either of the first two Name case options are selected the any extension chosen will be in lower case, htm or html, if the third option is selected it will be in upper case, HTM or HTML.
Pre-process
Some aspects of the way Impression formats files can cause problems when translated into HTML. For example, if you want to embolden a word you might double-click on it to select it and then click on the 'Bold' button. However, when you select a word in this way the space following the word is also selected. This means that the HTML 'tag' which cancels the effect will be preceded by the space. In many browsers spaces preceding a tag which cancels an effect or following a tag which enables an effect are ignored, which results in the emboldened word not being separated from the preceding or following word, or both.
If Pre-process is selected then these irregularities will be corrected, as will certain other effects created by Impression which could cause problems when translated into HTML. You are therefore advised to always have this option enabled. The only reason for offering it as an option rather than always applying pre-processing is because under some circumstances with unusually constructed Impression files it could cause formatting problems.
Auto UL will be dealt with later in the section Creating structured lists.
Choosing a Mapping file
If you click on the menu icon to the right of the icon labelled Mapping a menu will open listing all the Mapping files available. With the basic program there will be only two, DefaultMap and Manual, which is provided to enable you to experiment with the text of this manual. To choose a Mapping file just select it from the menu and it will be loaded and its name will appear in the icon.
A demonstration
Open the Process window and drag the TextStory file supplied with this program, which is the text of this manual, to the icon at the top of the window. Select the Manual Mapping file and set Pre-process and Auto UL so they are ticked. Select Chapters + Index and set 1st chapter to '1'.
Now drag the directory icon to a suitable filer window.
The icon at the bottom of the window will inform you as the program creates each chapter, and will say Finished when it is done. At this point the directory icon will once again be 'greyed out'.
Unless you have changed the name in the Save as field a directory called HTML will have been created and inside it will be several HTML files. Their exact names will depend on the sate of the Name case and Extension icons, but there will be an Index file and a file for each chapter.
If you load the Index file into a browser you should find that it contains a series of HTML links. The 'major' ones will be to each individual chapter. The start of each 'chapter' has nothing to do with Chapters in Impression. They are defined (in this case) by the chapter headings, such as the Using the program heading at the start of this section. The 'minor' links are to the sub headings, such as A demonstration above.
If you click on any of these links the browser will load the appropriate file and, in the case of the minor links, scroll to the sub-heading.
You could experiment with the other options. If you select Single file with Index you will find that the program creates a single, long, HTML file with the index at the beginning.
Saving Choices
If you select Save choices from the iconbar menu then the settings in the lower part of the window will be saved in a Choices file. The next time you run Imp-HTML they will then be set they way you have chosen.
Dave Holden
|