Changeset 2297f7d
- Timestamp:
- 08/13/10 12:32:34 (3 years ago)
- Branches:
- master
- Children:
- ffb7bf9
- Parents:
- 9fccc49
- git-author:
- Aurélien Bompard <aurelien@…> (08/13/10 12:32:34)
- git-committer:
- Aurélien Bompard <aurelien@…> (08/13/10 12:32:34)
- File:
-
- 1 edited
-
README.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
README.txt
r95c8501 r2297f7d 1 1 XHTML to ODT XML transformation 2 ------------------------------- 2 =============================== 3 3 4 These stylesheets convert namespaced XHTML to [ODT][].4 These stylesheets convert namespaced XHTML to ODT_. 5 5 6 You can [download them][download] from the project's [website].6 You can download_ them from the project's website_. 7 7 8 The HTML must be well-formed and valid, so I recommand running it through [Tidy][] before sending it to the stylesheets. 8 The HTML must be well-formed and valid, so I recommand running it through Tidy_ 9 before sending it to the stylesheets. 9 10 10 Those stylesheets do not build a whole ODT file, they only convert the XHTML to the equivalent OpenDocument XML. The result can then be inserted in a template ODT file. The HTML may be included in an ODT document, the ODT will be left untouched. 11 Those stylesheets do not build a whole ODT file, they only convert the XHTML to 12 the equivalent OpenDocument XML. The result can then be inserted in a template 13 ODT file. The HTML may be included in an ODT document, the ODT will be left 14 untouched. 11 15 12 This is based on the work on [docbook2odt][], by Roman Fordinal. Many thanks to him. 13 14 [ODT]: http://en.wikipedia.org/wiki/OpenDocument 15 [Tidy]: http://tidy.sourceforge.net/ 16 [docbook2odt]: http://open.comsultia.com/docbook2odf/ 17 [download]: http://xhtml2odt.org/dl/ 18 [website]: http://xhtml2odt.org 16 .. _website: http://xhtml2odt.org/ 17 .. _download: http://xhtml2odt.org/dl/ 18 .. _ODT: http://en.wikipedia.org/wiki/OpenDocument 19 .. _Tidy: http://tidy.sourceforge.net/ 19 20 20 21 … … 22 23 ------- 23 24 24 **Styles** : some default styles will be added to the document, but not on the first pass. After converting to ODT, you must run the `content.xml` and the `styles.xml` files (in the ODT file) through the `xsl/styles.xsl` stylesheet to add the styles. When the default styles are added, the stylesheet checks that the style is not already present, so customizations to the template ODT file will be preserved. It will however add styles that are not used in the text, but that's harmless. 25 Styles: 26 Some default styles will be added to the document, but not on the first 27 pass. After converting to ODT, you must run the ``content.xml`` and the 28 ``styles.xml`` files (in the ODT file) through the ``xsl/styles.xsl`` 29 stylesheet to add the styles. When the default styles are added, the 30 stylesheet checks that the style is not already present, so customizations 31 to the template ODT file will be preserved. It will however add styles that 32 are not used in the text, but that's harmless. 25 33 26 **Images** : images are not added, you must manually go trough the draw:image elements in the converted ODT text and use the xlink:href attribute to download or copy the image. While you're at it, you should update the image dimensions if the were not provided in the img tag. 34 Images: 35 Images are not added, you must manually go trough the ``draw:image`` 36 elements in the converted ODT text and use the ``xlink:href`` attribute to 37 download or copy the image. While you're at it, you should update the image 38 dimensions if the were not provided in the ``img`` tag. 27 39 28 40 … … 30 42 -------------------- 31 43 32 Three command-line scripts to run the stylesheets are provided, one is Python-based, the other is PHP-based, the last one is shell-based. The first two do import the styles and the images, so they can also be used as a code example for these two steps in other languages and actual export plugins. The shell script is more of a minimalist approach to demonstrate the simplest possible use of the stylesheets. 44 Three command-line scripts to run the stylesheets are provided, one is 45 Python-based, the other is PHP-based, the last one is shell-based. The first 46 two do import the styles and the images, so they can also be used as a code 47 example for these two steps in other languages and actual export plugins. The 48 shell script is more of a minimalist approach to demonstrate the simplest 49 possible use of the stylesheets. 33 50 34 Documentation for the PHP and Python scripts can be generated using the "`make doc`" command. This will require [sphinx][] for Python and [phpDocumentor][] for PHP. 51 Documentation for the PHP and Python scripts can be generated using the ``make 52 doc`` command. This will require Sphinx_ for Python and phpDocumentor_ for PHP. 35 53 36 [sphinx]: http://sphinx.pocoo.org/37 [phpDocumentor]: http://www.phpdoc.org/54 .. _sphinx: http://sphinx.pocoo.org/ 55 .. _phpDocumentor: http://www.phpdoc.org/ 38 56 39 ### The python script 57 The python script 58 ^^^^^^^^^^^^^^^^^ 40 59 41 The python script is the preferred command-line script, because it currently is a little more complete than the PHP script. It depends on the following Python modules: 60 The python script is the preferred command-line script, because it currently is 61 a little more complete than the PHP script. It depends on the following Python 62 modules: 42 63 43 * [uTidylib][] 44 * [lxml][] 45 * [PIL][] 64 * uTidylib_ 65 * lxml_ 66 * PIL_ 46 67 47 To get information on the script's options, run it with ` --help`:68 To get information on the script's options, run it with ``--help``:: 48 69 49 70 ./xhtml2odt.py --help 50 71 51 The script can be installed on the system with the ` make install` command.72 The script can be installed on the system with the ``make install`` command. 52 73 53 [uTidylib]: http://pypi.python.org/pypi/uTidylib54 [lxml]: http://pypi.python.org/pypi/lxml55 [PIL]: http://pypi.python.org/pypi/PIL74 .. _uTidylib: http://pypi.python.org/pypi/uTidylib 75 .. _lxml: http://pypi.python.org/pypi/lxml 76 .. _PIL: http://pypi.python.org/pypi/PIL 56 77 57 ### The PHP script 78 The PHP script 79 ^^^^^^^^^^^^^^ 58 80 59 The PHP script can be used as an example to create an ODT export plugin for a PHP-based application. It contains comments on what you should do differently in a web-based application. If you want a real PHP-based export plugin, you can look at the code of the [Dotclear ODT export plugin][]. 81 The PHP script can be used as an example to create an ODT export plugin for a 82 PHP-based application. It contains comments on what you should do differently 83 in a web-based application. If you want a real PHP-based export plugin, you can 84 look at the code of the `Dotclear ODT export plugin`_. 60 85 61 The PHP script requires the [zip][] module, and will work better with the [tidy][] extension. 86 The PHP script requires the zip_ module, and will work better with the `tidy 87 extension`_. 62 88 63 To get information on the script's options, run it with ` --help`:89 To get information on the script's options, run it with ``--help``:: 64 90 65 91 ./xhtml2odt.php --help 66 92 67 [Dotclear ODT export plugin]: http://lab.dotclear.org/wiki/plugin/odt68 [zip]: http://php.net/manual/en/zip.installation.php69 [tidy]: http://php.net/manual/en/book.tidy.php93 .. _Dotclear ODT export plugin: http://lab.dotclear.org/wiki/plugin/odt 94 .. _zip: http://php.net/manual/en/zip.installation.php 95 .. _tidy extension: http://php.net/manual/en/book.tidy.php 70 96 71 97 … … 73 99 ----- 74 100 75 The unit tests are python-based, you need to install the [nose][] python module availble from PyPI (or your distribution). 101 The unit tests are python-based, you need to install the nose_ python module 102 availble from PyPI (or your distribution). 76 103 77 Then, just run "`nosetests tests`".104 Then, just run ``nosetests tests``. 78 105 79 [nose]: http://pypi.python.org/pypi/nose/106 .. _nose: http://pypi.python.org/pypi/nose/ 80 107 81 108 … … 83 110 ---------- 84 111 85 * [ODT export for Dotclear](http://lab.dotclear.org/wiki/plugin/odt) 86 * [ODT export for Trac](http://trac-hacks.org/wiki/OdtExportPlugin) 87 * [ODT export for Dokuwiki](http://www.dokuwiki.org/plugin:odt) (not using this project, but similar and by the same author) 112 * `ODT export for Dotclear <http://lab.dotclear.org/wiki/plugin/odt>`_ 113 * `ODT export for Trac <http://trac-hacks.org/wiki/OdtExportPlugin>`_ 114 * `ODT export for Dokuwiki <http://www.dokuwiki.org/plugin:odt>`_ 115 (not using this project, but similar and by the same author) 88 116 89 117 … … 91 119 ------- 92 120 93 Copyright (C) 2009-2010 [Aurelien Bompard][].121 Copyright (C) 2009-2010 `Aurelien Bompard`_. 94 122 95 Inspired by the work on [docbook2odt][], by Roman Fordinal.123 Inspired by the work on docbook2odt_, by Roman Fordinal. Many thanks to him. 96 124 97 [Aurelien Bompard]: http://aurelien.bompard.org/98 [docbook2odt]: http://open.comsultia.com/docbook2odf/125 .. _Aurelien Bompard: http://aurelien.bompard.org/ 126 .. _docbook2odt: http://open.comsultia.com/docbook2odf/ 99 127 100 128 License is LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html … … 113 141 License along with this library; if not, write to the Free Software 114 142 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 143 144 .. vim:syntax=rst
Note: See TracChangeset
for help on using the changeset viewer.
