<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--
Copyright 2003 Francis Franklin Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts A copy of the license is included in the section entitled "GNU Free Documentation License"
<p><span style="lang: en-GB">The are many ways of writing HTML and it is impossible to please everyone. The exporter has been extensively rewritten several times in order to provide HTML code as clean as possible and there are a number of options, described below, controlling document export.</span></p>
<p><span style="lang: en-GB">In addition to the XHTML exporter there is a `Multipart HTML' exporter which converts the XHTML output (possibly consisting of several files, i.e., images, style sheet) into a single MIME-encoded file (traditionally with the extension .mht). Some web browsers save web pages in this format.</span></p>
<li><span style="lang: en-GB"> Embed images in URLs (Base64-encoded)</span></li>
</ul>
<h3><span style="lang: en-GB">Export as HTML 4.01</span></h3>
<p><span style="lang: en-GB">AbiWord's HTML exporter has always given the user a choice between HTML and XHTML, the latter being XML and thus easier to handle (and ideally to re-import, although this has been an elusive goal). Some people still prefer the traditional HTML, since some browsers don't understand that XHTML is HTML and not just XML (which can almost anything), but increasingly XHTML is preferred and best-understood.</span></p>
<p><span style="lang: en-GB">If exporting as HTML then the document will not be declared as XML and markup in the AWML namespace will not be possible, since these options are specific to XHTML.</span></p>
<h3><span style="lang: en-GB">Export with PHP instructions</span></h3>
<p><span style="lang: en-GB">This option is seldom (if ever) used but may be of interest. Many websites these days use PHP to give webpages a `corporate look and feel' or to provide a dynamic element to layout. HTML documents have simple </span><span style="lang: en-GB" class="Code Plain_Text"><?php</span><span style="lang: en-GB"> (or the older </span><span style="lang: en-GB" class="Code Plain_Text"><?</span><span style="lang: en-GB"> ) instructions embedded at the top and bottom and these replace all the site-specific markup. (Often the resulting document is barely recognisable as HTML!)</span></p>
<p><span style="lang: en-GB">If this option is selected then AbiWord inserts </span><span style="lang: en-GB" class="Code Plain_Text"><?php include ...</span><span style="lang: en-GB"> statements in the head and at the beginning and end of the body of the HTML document. NOTE: Since some versions of PHP get confused by other processing instructions, such as </span><span style="lang: en-GB" class="Code Plain_Text"><?xml</span><span style="lang: en-GB"> , it may be necessary to uncheck the `Declare as XML' option.</span></p>
<p><span style="lang: en-GB">Unfortunately this is not very customisable and AbiWord's new XHTML template system, available only through command-line conversion of documents to XHTML, can be used to much greater effect.</span></p>
<h3><span style="lang: en-GB">Declare as XML</span></h3>
<p><span style="lang: en-GB">XML documents, including XHTML ones, normally start with a line declaring them to be XML. This line is something like:</span></p>
<p><span style="lang: en-GB">Some (old) web browsers see this and get confused, and some versions of PHP also get confused because </span><span style="lang: en-GB" class="Code Plain_Text"><?</span><span style="lang: en-GB"> used to be regarded as a PHP insertion point.</span></p>
<p><span style="lang: en-GB">If saving as HTML then this option is irrelevant; if as XHTML then uncheck this option to suppress the declaration.</span></p>
<h3><span style="lang: en-GB">Allow extra markup in AWML namespace</span></h3>
<p><span style="lang: en-GB">This option is specific to XHTML since it uses XML namespaces to add extra information to the HTML document. However, </span><span style="font-style: italic; lang: en-GB">this is </span><span style="font-style: italic; lang: en-GB; text-decoration: underline">not</span><span style="font-style: italic; lang: en-GB"> correctly functional at the moment and its use is </span><span style="font-style: italic; lang: en-GB; text-decoration: underline">not</span><span style="font-style: italic; lang: en-GB"> recommended</span><span style="lang: en-GB">.</span></p>
<p><span style="lang: en-GB">AbiWord generates a lot of style-sheet information related to document styles and this can be embedded within the HTML document in a </span><span style="lang: en-GB" class="Code Plain_Text"><style><!-- --></style></span><span style="lang: en-GB"> section or saved to an external style sheet (</span><span style="font-style: italic; lang: en-GB">filename</span><span style="lang: en-GB">.html_files/style.css). The former is generally more useful; if an external style sheet is used on the website then it may be best to use the PHP option or, if converting from the command line, an XHTML template.</span></p>
<h3><span style="lang: en-GB">Embed images in URLs (Base64-encoded)</span></h3>
<p><span style="lang: en-GB">Images in the AbiWord document are normally saved in a subdirectory (</span><span style="font-style: italic; lang: en-GB">filename</span><span style="lang: en-GB">.html_files/) and referenced by hyperlink (</span><span style="lang: en-GB" class="Code Plain_Text"><img src="filename.html_files/ ... </span><span style="lang: en-GB">) but there is a mechanism for saving images within the HTML file itself (although this is generally frowned upon).</span></p>
<p><span style="lang: en-GB">AbiWord-2.0 has a (still experimental) XHTML template mechanism that can be used when using AbiWord as a command-line tool to convert documents to HTML.</span></p>
<p><span style="lang: en-GB">The simplest way to convert a file to HTML using AbiWord, on Unix systems at least, is:</span></p>
<p>which will import <span style="font-style: italic">file.abw</span> and export as HTML to <span style="font-style: italic">file.html</span> using default options.</p>
<p>It is possible, however, to specify export options on the command line using <span class="Code Plain_Text">--exp-props</span>:</p>
<p>The above command specifies that the output is to be HTML 4.01 and not XHTML. All six export options can be specified in this manner: <span class="Code Plain_Text">html4</span>, <span class="Code Plain_Text">php-includes</span>, <span class="Code Plain_Text">declare-xml</span>, <span class="Code Plain_Text">use-awml</span>, <span class="Code Plain_Text">embed-css</span> and <span class="Code Plain_Text">embed-images</span>. Each takes a <span class="Code Plain_Text">yes</span> or <span class="Code Plain_Text">no</span>, and multiple options can specified, e.g.:</p>
<p>The <span class="Code Plain_Text">--exp-props</span> argument can be used to define an arbitrary number of property name-value pairs. The above six options are <span style="font-style: italic; text-decoration: underline">reserved</span> property names; there are two other reserved property names associated with XHTML templates: <span class="Code Plain_Text">html-template</span> and <span class="Code Plain_Text">href-prefix</span>.</p>
<h3>XHTML Templates (EXPERIMENTAL)</h3>
<p>The XHTML template is a skeleton XHTML document which the exporter first imports and then exports again with modifications. The template contains <span style="font-style: italic">Processing Instructions</span> which instruct the exporter to insert, e.g., the document title or the document text.</p>
<p>All of the exporter's processing instructions have the form <span class="Code Plain_Text"><?abi-xhtml- ... ?></span>, e.g.:</p>
<p>In the output, these instructions are replaced with, respectively, the document's title (from the document properties, as text), the document's metadata (document properties, etc., as HTML <span class="Code Plain_Text"><meta ... /></span>), and the document's content (as HTML, inside of the usual <span class="Code Plain_Text"><body>...</body></span>).</p>
<p>The template system was written primarily for the AbiWord documentation. The goal was to provide a navigation menu for the AbiWord bundled help documentation. This consists of about 100 AbiWord documents, in several folders, which need to be converted to HTML. The navigation menu needed submenus, and the menu item corresponding to the current webpage needed to be highlighted, etc., and all using only HTML, CSS and relative links between webpages, images and style sheets.</p>
<p>To achieve this with a single template an element of flow control is necessary, and this is achieved by defining variables in the <span class="Code Plain_Text">--exp-props</span> argument, e.g.:</p>
<p>since the <span class="Code Plain_Text">$$</span> in the processing instruction comment text is replaced by he value (<span class="Code Plain_Text">howto</span>) of the specified property (<span class="Code Plain_Text">active-menu</span>).</p>
<p>The principal flow-control mechanism, however, is the use of <span class="Code Plain_Text"><?abi-xhtml-if </span><span style="font-style: italic" class="Code Plain_Text">condition</span><span class="Code Plain_Text">?> ... <?abi-xhtml-fi ?></span> where everything between the two processing instructions is ignored if <span style="font-style: italic" class="Code Plain_Text">condition</span> is false. Unfortunately, the condition syntax is currently very limited (e.g., <span class="Code Plain_Text"><?abi-xhtml-if active-menu==howto?></span>) and is likely to be rewritten. (These should be nestable.)</p>
<p>Another processing instruction is <span class="Code Plain_Text"><?abi-xhtml-menuitem ...?></span> which creates a table cell of one sort or another with the specified label text.</p>
<p>Finally, to make relative links between resources possible, link addresses which start with a <span class="Code Plain_Text">$</span> (e.g., <span class="Code Plain_Text"><a href="$/about.html"></span> and <span class="Code Plain_Text"><img src="$/images/logo.jpg" /></span>) will have the <span class="Code Plain_Text">$</span> substituted with the value of property <span class="Code Plain_Text">href-prefix</span>, e.g.:</p>
<p>This tells Abiword to use the template <span style="font-style: italic">normal.html</span> in the current directory and to prefix all links (marked with an initial <span class="Code Plain_Text">$</span>) with the path <span class="Code Plain_Text">..</span> so <span class="Code Plain_Text"><a href="$/about.html"></span> will change to <span class="Code Plain_Text"><a href="../about.html"></span>, and so on.</p>
<p>The best example of XHTML template usage is in AbiWord's abiword-docs CVS module in the directory abiword-docs/ABW/en-US/template/.</p>