OpenOffice Export Filter for Genbooks

From CrossWire Bible Society

(Difference between revisions)
Jump to: navigation, search
(Comments and suggestions: Category:XSLT)
(Rewritten for version 1.4 of the filter)
 
Line 1: Line 1:
== Synopsis  ==
== Synopsis  ==
-
The OpenOffice to OSIS export filter uses an XSLT stylesheet, in conjunction with an OpenOffice Writer template, to export documents from OpenOffice to OSIS XML (OSIS version 2.1.1) which can be used to create Genbook modules for the Sword Library.
+
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  ==
== System requirements  ==
-
OpenOffice ([http://www.openoffice.org/ http://www.openoffice.org/]), version 1.1 onwards or NeoOffice ([http://www.neooffice.org/neojava/en/index.php http://www.neooffice.org/neojava/en/index.php]).
+
OpenOffice (http://www.openoffice.org/) or LibreOffice (http://www.libreoffice.org/), version 3.0 onwards.  
== Where to download  ==
== Where to download  ==
Line 9: Line 9:
== Installation instructions ==
== Installation instructions ==
-
To install the filter, follow these steps:
+
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.
-
 
+
-
# Extract the contents of the oowriter2osis.zip archive.
+
-
# Open OpenOffice Writer. In the File menu click on “Templates/Organize...” Right click on “My Templates” and click on “Import Template...” Navigate to the folder where you extracted the archive and double-click on OSISGenbook.ott. Click “Close” to close the “Template Management” window.
+
-
# In the Tools menu click on “XML Filter Settings...” Click on “New...”
+
-
#* Enter the information below in the “General” tab:
+
-
#** Filter Name: OSIS GenBook
+
-
#** Application: OpenOffice.org Writer (.odt)
+
-
#** Name of File Type: OSIS XML Version 2.1.1
+
-
#** File extension: xml
+
-
#* In the “Transformation” tab enter the following information:
+
-
#** DocType: OSIS
+
-
#** XSLT for Export: (the path to “oowriter2osis.xsl”; this could be in ~/.openoffice.org2/user/xslt/ or wherever you want it)
+
== How to create an OSIS Genbook from OpenOffice Writer ==
== How to create an OSIS Genbook from OpenOffice Writer ==
-
# In the OpenOffice Writer File menu click “New.../Templates and Documents/Templates/My Templates” and double-click on OSISGenbook. That will open an untitled document with the necessary styles.  
+
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.  
-
# Copy the text you want to be in the OSIS file and paste it into the new document and save it.  
+
2. #Copy the text you want to be in the OSIS file and paste it into the new document and save it.  
-
# 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.
+
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.
-
# 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 except for x-unit, which provides a level of division between book and chapter. 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.
+
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.
-
#* bookGroup (could be a collection of works by the same author)
+
5. ##bookGroup (could be a collection of works by the same author)
-
#* book
+
6. ##book
-
#* x-unit
+
7. ##majorSection
-
#* chapter
+
8. ##chapter
-
#* section
+
9. ##section
-
#* subSection
+
10. ##subSection
-
# 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:
+
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:
-
#* Bold text
+
##Bold text
-
#* Italic text
+
##Italic text
-
#* Superscript text
+
##Superscript text
-
#* Subscript text
+
##Subscript text
-
# In addition to text, the OSIS schema offers several features that are easily created in OpenOffice and exported with the proper OSIS elements. For images and Scripture references, follow the directions below to prepare your OpenOffice Document for export and your exported OSIS XML file for compiling.
+
#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.
-
#* Footnotes
+
##Footnotes
-
#* Endnotes
+
##Endnotes
-
#* Tables
+
##Tables
-
#* 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.
+
##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.
-
# <nowiki>osisRef: To designate a Scripture reference as such, in OpenOffice 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 9 below.</nowiki>
+
##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.
-
# When your document is ready to export from OpenOffice, in the File menu click on “Export...” and in the “File Format” combo box choose “” and click “Export.” Now your OpenOffice Document is exported as an xml file.  
+
#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.  
-
# 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.
+
#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.
-
# Now your file should be ready to compile using xml2gbs. Be sure to include the folder “images” with any image files with your module.
+
#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.
Note: Not all features listed above display correctly in all the Sword front-ends, but the basic fundamentals should work.
Line 56: Line 44:
== Current version number and date of release  ==
== Current version number and date of release  ==
-
Version 1.0, 2008-02-13
+
Version 1.4, 2011-08-06
== Comments and suggestions ==
== Comments and suggestions ==

Latest revision as of 14:17, 6 August 2011

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