Writing PubTal content using OpenOffice.
PubTal supports the use of OpenOffice word processing files (.sxw) for authoring web page content. An author does not need to know any HTML to use OpenOffice, and can take advantage of features such as spell checking.
PubTal supports enough of OpenOffice's features to allow web page content to be authored, but not enough to act as a generic OpenOffice to HTML converter (a function that OpenOffice already has).
The following subset of OpenOffice document features are supported:
There are several tricks to making the best use of OpenOffice for editing PubTal content. Bear these in mind and OpenOffice can provide an excellent environment for writing web content, certainly superior to writing pages in a text editor.
PubTal supports styles, such as bold and italic, by generating HTML that contains Cascading Style Sheet (CSS) code. PubTal does not reproduce the styling of the original OpenOffice document. Styling, for example on tables, should be done in CSS files that are linked from the template. This allows a common styling to be used across all produced web pages, regardless of the styling used in the individual documents.
Note that advanced techniques like multiple columns, precise positioning of images, etc. are not supported.
Tables in OpenOffice provide optional support for a heading row. PubTal will convert these into <th> HTML tags, which allows a different style to be applied to the heading cells and the body cells. To instruct OpenOffice to use a heading row select the "Header" option in the Insert Table dialog. If a table is generating only <td> tags then its headers have become disabled - highlight the whole table and select "Split Table" to enable them.
To use a URL to link to another document on the same website (a relative link), the OpenOffice "Document" hyperlink option must be used, not the "Internet" option. This is because OpenOffice treats all links entered using the "Internet" panel of the Hyperlink dialog as being absolute addresses (fine for external links). To check that the correct type of link has been created, enable the Hyperlink Bar using "View -> Toolbars -> Hyperlink Bar". If the hyperlink you have entered begins with "file://" then it is a relative link, otherwise it is an absolute link.
OpenOffice supports two kinds of images: linked and embedded.
To add a linked image to a document select the "Insert -> Graphics -> From File..." menu option. Select the "Link" option so that OpenOffice will create a relative link to the image; this is equivalent to using <img src="filename.ext"> in HTML. It is best to keep the image files in the content directory, and use the Binary content-type to copy them into the destination directory (this is configured by default for .jpg, .png, and .gif files). This ensures that the relative links generated in the resulting HTML are correct.
It is also possible to link to an image on an external system. To do this use the "Link" option described above and select any image file on your system. Once this has been inserted into your document, double click on the image to bring up the Graphics dialogue box. Select the "Graphics" tab, and then put the URL of the image into the File name box. Select the "Type" tab, and then press the "Original Size" button to make OpenOffice take the correct image size.
If the "Link" option is not selected when an image is inserted, then OpenOffice will take a copy of it and embed it into the document. When PubTal finds such an image it will extract it, and place it into a directory called "Pictures" in the destination directory. The HTML output page will contain a <img> tag that links to the file inside the Pictures directory.
PubTal names the individual image files using a combination of the generated HTML page name, and the internal OpenOffice names. This is to avoid embedded images from several documents over-writing each other in the Pictures directory.
Images can also be turned into Hyperlinks. To do this, double click on the image, and select the "Hyperlink" tab. The "alt" text for the image can be specified in the "Options" tab.
PubTal does not support any attempt to align images; they are always created inline in the HTML document. If an image is in a paragraph with the "Preformatted Text" style then PubTal will not produce a corresponding <img> tag in the output HTML. In HTML it is forbidden to have images inside preformatted text.
When publishing OpenOffice documents PubTal provides additional context to the template used:
Both of these properties are lists, and so need to be iterated over to be useful. The following template snippet demonstrates how this can be done:
<div>
<span tal:repeat="keyword page/headers/keywords">Keyword: <b tal:replace="keyword"></b></span>
</div>
<div>
<div tal:repeat="footnote page/footnotes" tal:replace="structure footnote">Foonotes go here.</div>
</div>
Note that the footnotes in the list contain HTML, and so the "structure" keyword must be used in the tal:replace command.
To specify which files are treated as OpenOffice documents please refer to the Configuration section.
The full list of my published Software
Made with PubTal 3.5
Copyright 2021 Colin StewartEmail: colin at owlfish.com