A Trac plugin for export of wiki pages to MS Word
Hi Mark here.
As Lucas is moving on - I would like to thank him for this plugin. I have some ideas for change - but for now will restrict myself to trying to fix the issues already logged.
Mark
Description
The aim of the plugin is to transform a wiki page so that it can be imported using the HTML import capability of MS Word. After that, a format template can be applied, and the text might be copied into a document template.
The plugin works as follows:
- Cleanup and validation using HTML Tidy.
- Transformation using a XSLT stylesheet
- Offering a zip file with wiki page and images for downloading.
Installation:
- Install HTML Tidy.
- Make sure xsltproc is available. If not, install from http://xmlsoft.org/XSLT/xsltproc2.html
- From the linked page Click Downloads and download iconv, libxslt, libxml2, zlib
- On windows - the binaries for all either need to be in one directory or on your path (PageToDocIntegration expects the folder that contains libxslt to be on your path)
- test that it has been installed correctly by running xsltproc (if it cannot be found - make sure it is on the path)
- Save the XSLT stylesheet onto your disk.
- Create the following section in your trac.ini (modify path):
[pagetodoc] xsltfile = /path/to/your/xsltfile
- Install plugin.
- The same can be done by adding the following line to the [components] section of your trac.ini file e.g.
[components] PageToDoc.* = enabled
- The same can be done by adding the following line to the [components] section of your trac.ini file e.g.
The plugin is in a alpha state. There are a couple of things to be enhanced. Please try and give feedback.
Configuration
Configuration options are made in trac\environment\path\conf\trac.ini and the parameters are in the [pagetodoc] section (which you will need to add as documented in the installation instructions).
| xsltfile | (Required) The path to the XSLT file to use for transforming the wiki HTML output. Specify the filepath of html_filtered.xslt shipped with PageToDocIntegration |
| tidypath | (Optional) Path to tidy. If left empty then the executable search path is used. Added in [5406] hoping it helps to resolve issues like #4396 |
| xsltprocpath | (Optional) Path to xlstproc. If left empty then the executable search path is used. Added in [5406] hoping it helps to resolve issues like #4396 |
| replace_host | (Optional) Two strings separated by a comma. A replace operation is performed on the image URL finding the first part and replacing with the 2nd part. Added in [5401] hoping it fixes #3507 |
| img_max_x | (Optional) max image width? Used to calculate if image needs to be resized. Default is 0 |
| img_max_y | (Optional) max image height? Used to calculate if image needs to be resized. Default is 0 |
| dpi | (Optional) dots per inch? Used to calculate if image needs to be resized. Default is 96 |
[pagetodoc] xsltfile = /path/to/your/xsltfile replace_host = man-wwl-sw, localhost xsltprocpath = path/to/xsltproc tidypath = /path/to/tidy img_max_x = 500 img_max_y = 200 dpi = 96
Bugs/Feature Requests
Existing bugs and feature requests for PageToDocIntegration are here.
If you have any issues, create a new ticket.
Download
Download the zipped source from here.
Source
You can check out PageToDocIntegration from here using Subversion, or browse the source with Trac.
Example
Once installed, a new entry shows up below the Download in other formats section at the end of the page. Click and save to disk. Extract and open with Word.
Recent Changes
[5406] by markm on 03/26/09 00:21:22
- Added checks for the dependencies (xslt file, tidy, xsltproc)
- Added option to get the path to xsltproc and tidy from the config file.
- Added a module level doc string.
- Removed whitespace from 'empty' lines.
[5401] by markm on 03/25/09 20:44:21
- Allow administrator to specify a value for 'replace_host' in trac.ini. This can be used to replace full URL's with localhost for example.
- Fixes ticket:3507
[5400] by markm on 03/25/09 19:58:13
- Some minimal cleanups to imports and other areas making PyLint? and pychecker happier
[5399] by markm on 03/24/09 23:40:21
- Remove reference to close_fds in subprocess.call and explicitly close the file handles.
- Ensure that other file handles are closed by the time the temporary files and folder is being removed
- fixes ticket:3963
Author/Contributors
Author: lei
Contributors:

