This chapter has been largely superceded by the Policy manual
Document policy files are ordinary text files that list the "policies" that AscToHTM should implement when converting your document. The file can have added comment lines (starting with a "!" or "#" character) and headings for clarity.
A summary of the recognised policy lines is given in the Policy manual.
In most cases recognised policy lines are identical to those listed in the generated policy file (see 4.1). This is usually a good place to start when making your own policy.
Only those lines that are recognised policies will be acted upon.
To use a policy file, simply list it on the command line after the name of the file being converted (see 4.2.2.2).
Document policies have two main uses :
- To correct any failure of analysis that AscToHTM makes. Hopefully this won't be needed too much as the core analysis engine improves.
Examples include page width, whether or not underlined section headings are expected etc.
- To tell the program how to produce better HTML end product in ways that couldn't possibly be inferred from the original text.
Examples include adding colour and titles to the page, as well as requesting a large document is split into several pages, and a contents list created.
Change in version 3.2
The document sections in this chapter that described the policies in detail have been moved to a standalone document called The "Policy manual". That document describes the scope, effect, location and default values for all policies recognised by the program.
This documentation has itself been converted using AscToHTM. The files used were
- a2hdoco.txt. This is the text version of the documentation. The text version is kept as the master copy and updated as required. It's then converted to HTML.
- ia2hdoco.pol. This is the policy file used to create the HTML version of this document. Only those policies that differ from the defaults have been added.
This policy file "includes" the link dictionary a2hlinks.dat.
- a2hdocoh.inc. This is the header HTML added as the bottom of each generated HTML page.
- a2hdocos.inc. This is the JavaScript HTML added into the <HEAD>... </HEAD> portion of the generated HTML page. This particular example toggles the logo when the mouse is over it (only if you use Netscape 3.0 or above though).
- a2hlinks.dat. This is the link dictionary used for this document and is used to add hyperlinks to the main text file.
- a2hdocof.inc. This is the footer HTML added as the bottom of each generated HTML page.
These files are included in the distribution kit as an example set of documentation.
You can, of course, use AscToHTM to convert this doco into whatever format, colour etc that you wish.
Change in version 3.2
The policy descriptions previously in this section have been moved to the Policy manual
New in version 3.2
The following analysis policies help give you an overview of what the program is looking for, and to enable/disable what is being looked for.
"Attempt TABLE generation"
"Look for MAIL and USENET headers"
"Look for bullets"
"Look for hanging paragraphs"
"Look for horizontal rulers"
"Minimum ruler length"
"Look for indentation"
"Look for preformatted text"
"Look for quoted text"
"Look for short lines"
"Look for white space"
"Search for definitions"
The following analysis policies help control general layout parameters:-
"Definition Char"
"Expect blank lines between paras"
"Expect code samples"
"Hanging paragraph position(s)"
"Indent position(s)"
"Keep it simple"
"Min chapter size"
"New Paragraph Offset"
"Page width"
"Search for Definitions"
"Short line length"
"TAB size"
"Text Justification"
AscToHTM has the following bullet point policies that will normally be correctly calculated on the analysis pass :-
"Bullet char"
"Expect alphabetic bullets"
"Expect numbered bullets"
"Expect roman numeral bullets"New in version 3.2
"Recognise '-' as a bullet"
"Recognise 'o' as a bullet"AscToHTM tries hard not to get confused by the "1", "a" and "I" that happen to end up at the start of lines by random. These could get mistaken for bullet points.
AscToHTM has the following section heading policies that will normally be correctly calculated on the analysis pass :-
"First Section Number"
"Expect Numbered Headings"
"Expect Underlined Headings"
"Expect Capitalised Headings"
"Expect Second Word Headings"
"Smallest possible section number"
"Largest possible section number"New in version 3.2
"Preserve underlining of headings"Section headers are far and away the most complex things the analysis pass has to detect, and the most likely area for errors to occur.
AscToHTM will also document to a policy file the headings it finds. This is still to be finalised, but currently has the format
We have 4 recognised headings Heading level 0 = "" N at indent 0 Heading level 1 = "" N.N at indent 0 Contents level 0 = "" N at indent 0 Contents level 1 = "" N.N at indent 2
AscToHTM will read in such lines from a policy text file, but does not yet fully supported editing these via the Windows interface.
The syntax is explained below, but this will probably change in future releases. You can edit these lines in your policy file, and through the policy options in Windows.
The lines are currently structured as follows
Line component Value xxxx
Either "Heading" or "Contents" according
to the part of the policy being describedLevel n
Level number, starting at 0 for chapters
1 for level 1 headings etc."Some_word"
Any text that may be expected to occur before
the heading number. E.g. "Chapter" or "Section"
or "[". The case is unimportant.N.Nx
The style of the heading number. This will
ultimately (in later versions) be read
as a series of number/separator pairs.
The proposed format is
"N" = number
"i" / "I" = lower/upper case roman numeral
with an 'x' at the end signalling that trailing
letters may be expected (e.g. 5.6a, 5.6b)at indent n
The indentation that this heading is expected
at. This is important in helping to eliminate
false candidates.
AscToHTM has the following section heading policies that will normally be correctly calculated on the analysis pass :-
"Minimum automatic <PRE> size"
And for tables :-
"Attempt TABLE generation"
"Expect sparse tables"
"Minimum TABLE column separation"
There is only one analysis contents policy:-
This is described together with all the output contents list policies in 6.3.4. For more information on content list generation see 5.6.2.
Change in version 3.2
The policy descriptions previously in this section have been moved to the Policy manual
AscToHTM has the following HTML policies that will only ever take effect if supplied in a user policy file :-
"Active Link Colour"
"Background Image"
"Background Colour"
"Document title"
"Document keywords"
"Document description"
"HTML Script file"
"HTML header file"
"HTML footer file"
"Text Colour"
"Unvisited Link Colour"
"Use first heading as title"
"Use first line as title"
"Visited Link Colour"New in version 3.2
"Suppress all colour markup"These "polices" allow you to start "adding value" to the HTML generated. That is, they allow to specify things that cannot be inferred from the original text.
You can also add HTML to your files by using the HTML preprocessor command (see 7.1.4)
AscToHTM has the following hyperlink policies set as defaults :-
"Create hyperlinks"
"Create mailto links"
"Create NEWS links"
"Cross-refs at level"
"Only use known groups"
"Recognised USENET groups"Hyperlinks can also be added by using a link dictionary (see 4.3.2.2 and 4.4.2).
AscToHTM has the following HTML policies that will only ever take effect if supplied in a user policy file :-
"Add navigation bar"
"DOS filename root"
"Error reporting level"
"Generate diagnostics files"
"Input directory"
"Min HTML File size"
"Minimise HTML file size"
"Output directory"
"Output file extension"
"Output policy file"
"Output policy filename"
"Split level"
"Use DOS filenames"
"Use .HTM extension"New in version 3.2
"Break up long HTML lines"These policies specify how your document is divided into one or more HTML files, and how those files are to be named and linked together with hyperlinks.
AscToHTM has the following HTML policies that influence the detection and generation of contents lists :-
"Add contents list"
"Expect Contents List"
"External contents list filename"
"Generate external contents file"
"Hyperlinks on numbers"
"Use any existing contents list"See also the discussion in 5.6.2
AscToHTM has the following policies that can be used to influence the preprocessor (see Using the preprocessor), and hence the HTML output :-
"Include document section(s)"
"Use Preprocessor"
AscToHTM has the following "styling" that can be used to influence the HTML output :-
"Allow automatic centring"
"Allow definitions inside PRE"
"Automatic centring tolerance"
"Document Style Sheet"
"Headings colour"
"Highlight Definition Text"
"Ignore multiple blank lines"
"Largest allowed <Hn> tag"
"Smallest allowed <Hn> tag"
"Search for emphasis"
"Use <DL> markup for defn. paras"
"Use <CODE>..</CODE> markup"New in version 3.2
"Use <EM> and <STRONG> markup"
AscToHTM has the following policies that can be used to influence whether or not AscToHTM will attempt to detect and generate HTML tables, and the attributes of any tables generated.
Tables may be tailored individually by adding pre-processor commands to your source text (see 7.4)
"Attempt TABLE generation"
"Convert TABLE X-refs to links"
"Default TABLE border size"
"Default TABLE header rows"
"Default TABLE header cols"
"Default TABLE cell spacing"
"Default TABLE cell padding"
"Default TABLE colour"
"Default TABLE border colour"
"Default TABLE caption"New in version 3.2
"GOTO Colour data rows"
"Default TABLE even row colour"
"Default TABLE odd row colour"
"Default TABLE cell alignment"
Link definitions appear as follows :-
[Link Dictionary] Link definition : "a2hdoco.txt" = "Source text" + "/~jaf/A2HDOCO
That is, the text to be matched, the text to be used in its placed as the highlighted text, and the URL this link is to point to (in this case a relative URL).
AscToHTM has the following policies that can be used to influence whether or not AscToHTM will attempt to generate a Directory page for the files being converted. This is really only appropriate when converting more that one file at once (see 4.3.3)
The Directory Page will consist of entries for each file being converted (in order of conversion), and can have hyperlinks to the files, and to recognised headings in the files. This makes it suitable for use as a master index to a set of files converted in a single directory.
"Directory filename"
"Directory title"
"Directory keywords"
"Directory description"
"Directory return hyperlink text"
"Directory script file"
"Directory header file"
"Directory footer file"
"Indent headings in Directory"
"Show file titles in Directory"
This section has been copied into the Policy manual section on placing policies in a file
AscToHTM allows you to save policies to file so that you can later reload them. This allows you to easily define different ways of doing conversions, either for different types of files, or to produce different types of output.
The policy files have a .pol extension by default, and are simple text files, with one policy on each line. You can, if you wish, edit these policies in a text editor... this is sometimes easier that using all the dialogs in the Windows version.
When editing policies, it is important not to change the key phrase (the bit before the ":" character), as this needs to be matched exactly by AscToHTM.
For best results, it is advisable to put in your policy file only those policies you want to fix. This leaves AscToHTM to calculate document-by-document policies that suit the files being converted.
- Note:
- Avoid using "full" policy file for your conversions. Such files prevent the program from adjusting to each source file, often leading to unwanted results.
The normal way to create a policy file is by setting options and them saving them using the "save policy file" dialog. This will offer you the choice of creating a partial policy file or a full policy file (see 6.4.2.1 and 6.4.2.2).
Alternatively, you can set the "Output policy file" policy which will generate a full policy file resulting from the analysis of the converted document.
Once a file is generated you can either edit them in a text editor - deleting policies that are of little interest to you, and editing those that are - or reload them into the program, change them and save them again.
Partial policy files are files which have values for some, not all, policies.
These are recommended, because the unstated policies can be set by AscToHTM, allowing it to adapt to the details of the document being concerned.
For example, you should only set the indentation policy if you know what indents you are using, or if you want to override those calculated by AscToHTM. Normally it is best to omit this policy, and allow AscToHTM to work it out itself.
When you save a policy file from inside AscToHTM, a partial policy file will contain
- all policies loaded from the current policy file (if any)
- all policies changed in AscToHTM during the current session (if any)
A "full" policy file contains a value for every possible policy. Such files are usually only useful for documentation and analysis reasons, and should almost never be expected to be reloaded as input into a conversion, as this would totally fix the conversion details.
Whenever the "Output policy file" policy is set the generated "full" policy file is usually called
<filename>.pol
where <filename> is the name of the file being created. When this happens any existing file of that name will be overwritten.
For this reason we strongly advise you adopt a naming convention of the form
in_<filename>.pol or i<filename>.pol
or place your input policies in a different directory and ensure they are backed up.
![]() |
Converted from a single text file by AscToHTM © 1997-99 John A. Fotheringham | ![]() |