Index


RISC World

Impression to HTML

Dave Holden explains how to use our RISCWorld HTML converter

Editing a Mapping file

This is actually the most complex part of the program.

If you click ADJUST on the icon bar icon or select Mappings from the menu the Style mapping window will open.

There's a lot going on in this window. You will see that it's divided into two areas, a 'fixed' area at the top with a scrollable section below it.

On the left if the fixed area you can set the HTML codes that will be used for Bold and Italic and, in the centre, Tab.

To the right is the section which enables you to load existing Mappings files for modification and to save files.

The main part of the window is where Impression Styles are given the characteristics that will be used in HTML documents.

Altering the definitions

You could create a completely new Mapping file but it will be easier to begin by looking at a completed one. Click on the menu icon labelled Edit file and a menu will appear with the names of all the available Mapping files. At present this will just show DefaultMap and Manual. Select Manual and the file will be loaded and its definitions will appear in the window and its name will be shown in the icon under the Edit file label.

Editing the Effects

The items, Bold and Italic each have a writable icon where the HTML code used to switch the effect on and off is shown. You can enter these affects either by typing them in directly or by selecting from the menu that will appear if you click on the corresponding menu icon.

The third item, Tab, needs only one writable icons as, unlike all the other styles and effects, it doesn't require a pair of on/off codes. Again there is a menu icon, this time just above the writable icon. As there's no direct equivalent to the Tab character in HTML and multiple spaces are concatenated to a single space the simplest option if you require some sort of Tab is multiple   codes (non-breaking spaces).

Two items on this menu require explanation. The top item Tab [09] will insert a tab character (ASCII 9). This will be ignored by the browser so it will appear to have no effect. However, it can be useful as if you load the resulting HTML file into a text editor you will be able to see where these characters were inserted. This is not just a visual aid but it enables you to use the editor's 'Search and Replace' function to replace the tab characters with other codes, for example, when creating tables.

The final item is Add nbsp. This, as its name suggests, adds a   code to any other codes already present. You can use this, for example, to substitute multiple   codes for a tab character.

Editing the Styles

The Styles section of the window is shown below.

The column labelled Style name shows the name of the Style as it appears on the Impression Style menu. The other two (white) writable icons show the HTML codes that will be substituted for the on and off commands for these codes. These icons, like those for the effects, are writable, so their codes can be entered (or added to) manually or selected from a menu. If you click on the menu icon to the right of these fields the menu shown will appear, and selecting anything from this menu adds the appropriate on and off codes to the contents of the icons.

Instead of describing the actions of all the icons I'll describe each Style in the example above and explain how it is used and what effect the various buttons have on it.

First there is Main Heading. In the original Impression document this is centred 28pt. Bold, and is used at the start of each main section or 'chapter'. So, <H2> has been chosen, and it is also centred. Because the use of this Style signifies the start of a new chapter the icon on the extreme right, labelled 'NC' (for New Chapter) is ticked. When creating multi-chapter HTML this will begin a new chapter file whenever this Style is found. Styles where 'NC' is ticked will also automatically appear in the Index file so there's no need to tick this as well.

Sub Heading' is used in the original document for the headings to each section, so I've chosen <H4> as an appropriate tag.

The three buttons labelled 'none', 'p' and 'br' define what (if any) tags are used at the end of each line, or, more accurately, each time a linefeed (ascii 10) character is found. As Impression exports text unformatted this will only appear if you pressed RETURN when writing the text, such as at the end of a paragraph.

'p' means that each paragraph is wrapped in <P> and </P> tags. This is what you would use for the main body of your text. This is 'on' by default, so it will be applied to the one Style not shown on the menu but which exists in all Impression documents, namely 'Normal'. As with Impression, this is simply the default text used in the browser. As it happens, since this is a fairly simple Mappings file, all the other styles don't use <P> and </P>, so none of them have this option set.

'br' means use <BR> at the end of a line instead of <P> and </P> so there will be no gap between paragraphs as is otherwise the case. This is used for the Style NoGap. In the original Impression document there is normally a 3pt gap between paragraphs to separate them. NoGap is the same as the main body text but without this gap and is used where I don't want a gap between lines when I press RETURN. In the HTML mapping it has no definition other than having 'br' selected, so it's the same as the main body text but will have <BR> at the ends of lines so there won't be a gap between paragraphs, just as in the original document.

'none' means exactly that . There is no <BR> or </P> tag at the ends of lines. This is applied to the two Heading Styles because these are used only for single lines (Main and Sub headings) and in HTML an <H?> tag always begins a new line and a new line is begun after an </H?> tag so there's no need.

The Style Code would be used in the original document where I wanted to enter something like example code and is defined with a monospaced font (actually Corpus) and no gap between lines. This is therefore converted to <PRE> tags in HTML with no tags at the end of lines as all browsers will being a new line in <PRE> mode when they find a linefeed but many will add another when they find <BR>, so if <BR> was used the text would all be double-spaced.

Creating structured lists

The other two radio buttons in this section are labelled 'ul' and 'ol'. These are used to create Unordered Lists (UL) and Ordered Lists (OL).

There is a button labelled Auto UL on the processing window and this is a simple way to turn a series of lines, each beginning with a 'bullet point' character (ASCII 143) into a UL in HTML. This is fine for simple lists line the one near the start of the chapter Using the Program. However, there are a couple of disadvantages with this method if the list is not just a series of simple one-line bullet points. It can't produce a list within a list, that is, one bullet point can't contain within it a sub-list, and as soon as it finds a line that doesn't begin with a bullet point the list will terminate. You therefore can't have a paragraph break within any item in the list.

To overcome these restrictions, and also to allow the creation of ordered lists, where each line begins with a sequential number, you can assign UL or OL to a Style in Impression. You can therefore define a style with appropriate indent and line wrap and the 'ul' or 'ol' option for that style. This method works rather differently from the 'simple' system described previously.

The list will begin as soon as the converter finds the start of the style and continue until the style ends. With an unordered list each new bullet point will begin when it finds a line beginning with a bullet character. You can therefore have 'forced' line breaks in an item without terminating the list. You can also have a list within a list. If you define a second style with a greater indent and set the 'ul' or 'ul' option for this style as well then this style can be used to create double-indented lists such as on the Contents page of this HTML manual.

Ordered lists work in exactly the same way except that the defining point for starting a new item is a line beginning with a numerical digit (0-9) rather than a bullet point. Note that the original number in the Impression document will be removed and replaced with a number beginning with 1 and incrementing with each new number found.

More on the Styles menu

This menu is 'user configurable' (see later) so you can have whatever codes you prefer on it and omit those you don't use to make it more manageable if you like.

The 'Fontsize +1' and 'Fontsize +2' items can be used, often in combination with a Bold tag, to give larger than normal text where you don't want to use an <H?> tag. As the tags can be edited after you've selected them it's easy to alter this to '+3' or even '-1' after you've selected them so you don't need a menu entry for everything you might want to use.

'nbsp' inserts a &nbsp; tag but only in the 'on' section. This is a simply way of indenting a sub heading a little.

'Line' inserts a <HR> tag into the 'on' section. This is useful in long HTML documents, especially if you are not breaking it up into chapters as it can be used above a heading to provide a 'visual' break between sections.

Saving a Mappings file

To save a mappings file just click on 'Save'. Unless this is a new file (see next section' you may want to change its name first. If you try to save a file and one of the same name already exists you will be warned first.

When you save a Mappings file only those Styles where the icon at the extreme left is ticked will be included. This lets you omit styles which have no appropriate HTML equivalent. Imp-HTML will simply ignore any styles that aren't included in the Mappings file so they'll appear in the base style.

Dave Holden

 Index