OpenOffice Export Filter for Genbooks

From CrossWire Bible Society

Revision as of 14:17, 6 August 2011 by Dowens (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Synopsis

The ODT2OSIS export filter uses an XSLT stylesheet, in conjunction with an OpenOffice/LibreOffice Writer template, to export documents to OSIS XML (OSIS version 2.1.1) that can be used to create Genbook modules for the SWORD Library.

System requirements

OpenOffice (http://www.openoffice.org/) or LibreOffice (http://www.libreoffice.org/), version 3.0 onwards.

Where to download

http://sites.google.com/site/danielowensstuff/

Installation instructions

Open Writer. In the Tools menu click on “XML Filter Settings...” and select “Open Package...” and select the extracted *.jar file” and click OK. The program should indicate that the filter has been installed correctly. A template is also installed in its own folder called “OSIS Genbook.”# Extract the contents of the oowriter2osis.zip archive.

How to create an OSIS Genbook from OpenOffice Writer

1. #In the Writer File menu click “New.../Templates and Documents/Templates/OSIS Genbook” and double-click on OSISGenbook. That will open an untitled document with the necessary styles. 2. #Copy the text you want to be in the OSIS file and paste it into the new document and save it. 3. #Before you start formatting, in the File menu click on “Properties.” In the “Description” tab enter the title of the module as the “Title” and the module name as the “Subject.” Click on the “User Defined” tab and enter the xml:lang code under “1: Info 1.” If you don't enter one the filter will designate English as the language of the module. 4. #Now you can begin formatting. It is important to use the template provided because it is set up to work with the XSLT filter to create a properly formed OSIS document. The first thing you should do is apply paragraph styles for the major divisions in the module, such the book's title, chapters, etc. The hierarchy of divisions is defined in the Outline Numbering menu (Tools/Outline Numbering...) already in the template. These all correspond to OSIS div types. To apply a style, just click on the line to which you want to apply the style and double-click on the style in the Styles and Formatting window. 5. ##bookGroup (could be a collection of works by the same author) 6. ##book 7. ##majorSection 8. ##chapter 9. ##section 10. ##subSection 11. #The rest of the paragraphs of the work should be the Default paragraph style. However, you can define certain character styles within all paragraph styles which will be exported with the appropriate OSIS elements. Supported character styles include:

    1. Bold text
    2. Italic text
    3. Superscript text
    4. Subscript text
  1. In addition to text, the OSIS schema offers several features that are easily created in OpenOffice/LibreOffice and exported with the proper OSIS elements. For images and Scripture references, follow the directions below to prepare your document for export and your exported OSIS XML file for compiling.
    1. Footnotes
    2. Endnotes
    3. Tables
    4. Images: When you insert an image, right click on that image and click on “Picture...” Change the Name of the image to the filename, including the file extension. The template has an image named “crosswire.jpg”. Then copy the image to a folder named “images” and include that folder with the module.
    5. osisRef: To designate a Scripture reference as such, in Writer you have to apply the character style “osisRef” to the whole reference, including the book name, chapter, and verse. The export filter creates the <reference> element and copies that reference to the osisRef attribute as it is written in the document. You have to run a Perl script on the exported xml file to achieve a valid osisRef. See step 8 below.
  2. When your document is ready to export, in the File menu click on “Export...” and in the “File Format” combo box choose “” and click “Export.” Now your document is exported as an xml file.
  3. If there are scripture references in the book, you should use the script “addosisrefs.pl” to make sure that osisRef's are handled correctly. Input reference formats that this script handles include the following: “Genesis 1,” “Genesis 1:1,” “Genesis 1-2,” and “Genesis 1:1-2:1.” References spanning multiple books need to be manually corrected. Also, Bible book names and abbreviations that are converted to OSIS abbreviations include only a select set of English names and abbreviations (see “Supported Bible Book Names.txt” for a list of supported names and abbreviations). To get command-line syntax and the output filename, simply open an terminal, navigate to the folder where the script is stored, type ./addosisrefs.pl, and press enter. If this doesn't work, make sure that Perl is installed.
  4. Now your file should be ready to compile using xml2gbs. Be sure to include the folder “images” with any image files with your module.

Note: Not all features listed above display correctly in all the Sword front-ends, but the basic fundamentals should work.

Features requested but not yet supported

  1. <foreign> element
  2. <index> element

Current version number and date of release

Version 1.4, 2011-08-06

Comments and suggestions

If you have any comments or suggestions for improving these tools, send an email to the Sword Developer's Collaboration Forum at sword-devel@crosswire.org.

Personal tools
Namespaces
Variants
Actions
Navigation
Miscellaneous
Toolbox