Issue 48409 - [MWEx] Export to MediaWiki
Summary: [MWEx] Export to MediaWiki
Alias: None
Product: Writer
Classification: Application
Component: save-export (show other issues)
Version: OOo 1.1.2
Hardware: All Linux, all
: P3 Trivial with 11 votes (vote)
Target Milestone: ---
Assignee: eric.savary
QA Contact: issues@sw
: 61131 61572 83645 (view as issue list)
Depends on:
Reported: 2005-04-29 02:00 UTC by lukekendall
Modified: 2013-08-07 14:42 UTC (History)
7 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---

Bash script plus XSLT providing basic OpenDocument to MediaWiki conversion. (1.45 KB, application/x-compressed)
2006-01-25 19:44 UTC, haui
no flags Details
Style template to use with the already attached odt2txt transformation. (6.16 KB, application/vnd.oasis.opendocument.text-template)
2006-02-08 20:39 UTC, haui
no flags Details
Simple example document demonstrating wiki links and wiki math in (6.89 KB, application/vnd.oasis.opendocument.text)
2006-02-08 21:19 UTC, haui
no flags Details
Complex example for a real world wiki page using wiki syntax (source of (14.48 KB, application/vnd.oasis.opendocument.text)
2006-02-08 21:22 UTC, haui
no flags Details
Mediawiki (export) integration patch rev. 1 (10.25 KB, application/x-compressed)
2007-05-09 09:16 UTC, kami911
no flags Details
Corrected SCP2 file for file handling (631 bytes, patch)
2007-05-16 18:22 UTC, kami911
no flags Details | Diff
the corrected filter configuration (817 bytes, text/plain)
2007-05-16 22:39 UTC, Mathias_Bauer
no flags Details
Corrected typedetection file (820 bytes, text/xml)
2007-05-17 08:50 UTC, kami911
no flags Details
Improved transformation revision 339. (6.12 KB, text/xml)
2007-05-17 22:54 UTC, haui
no flags Details
Fixed disappearing of document internal references. (6.14 KB, text/xml)
2007-05-17 23:06 UTC, haui
no flags Details
Revision 342 adding basic support for tables. (7.70 KB, text/xml)
2007-05-17 23:21 UTC, haui
no flags Details
An crazy example (24.10 KB, application/vnd.oasis.opendocument.text)
2007-05-18 09:02 UTC, kami911
no flags Details
test document (32.08 KB, application/vnd.oasis.opendocument.text)
2007-05-18 09:39 UTC, Mathias_Bauer
no flags Details
Revisoin 2639 of the odt2wiki transformation (formerly known as odt2txt). (36.99 KB, text/xml)
2007-05-29 22:09 UTC, haui
no flags Details
Feature overview of the odt2wiki transformation. (31.54 KB, application/vnd.oasis.opendocument.text)
2007-05-29 22:11 UTC, haui
no flags Details
Mediawiki (export) integration patch rev. 2 - Updated xslt and diff files. (16.56 KB, application/x-compressed)
2007-06-07 19:34 UTC, kami911
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description lukekendall 2005-04-29 02:00:19 UTC
While it's possible to save documents to html, rtf, plain text, it would be
anice convenience to be able to save to one (maybe more) Wiki format - e.g. the
format used by Wikipedia, or Twiki.  It would be a great way to get lots of
information currently locked up in Word files into a really open and
collaborative format.

Should be quite simple, too - easier than HTML export, I reckon.

Comment 1 michael.ruess 2005-04-29 07:53:28 UTC
This is of course not a defect. Flagged to "Enhancement".
Comment 2 iannz 2005-11-01 21:34:09 UTC
I have written a Writer to DokuWiki macro. It is available from:

As the macro is LGPL anyone is free to modify it for any other wiki engine format.

Sometime soon I hope to make a MediaWiki version.
Comment 3 michael.ruess 2006-01-25 08:07:24 UTC
*** Issue 61131 has been marked as a duplicate of this issue. ***
Comment 4 richardeholder 2006-01-25 16:51:54 UTC
At work, we've moved exclusively to use OpenOffice.  And we're seeing a huge
growth in both our internal and external wiki.  Having an export from OOo would
make the transition from documents to online collaboration that much easier,
especially for the techno-phobics.  We have 6000 internal and 14,000 external
users of our MediaWiki.
Comment 5 haui 2006-01-25 19:44:47 UTC
Created attachment 33558 [details]
Bash script plus XSLT providing basic OpenDocument to MediaWiki conversion.
Comment 6 steve2005 2006-01-25 20:51:01 UTC
Word Processor should be able to export formated documents to wiki
style source code with appropriate syntax. WYSIWYG is needed for wiki entry
creation. It should be in the list under "Save as..." Choose "wiki" and then
under a sub menu choose the wiki program according to common wiki software as
listed at

This will generate a plain text file but formated with wiki style formating
tags. Then it can be copy & pasted into a wiki entry.

Another desired feature (of lessor importance) is the ability to import wiki
source code into the word processor. This is of lessor importance because you
can copy & paste the html generated by a wiki source code into the word
processor already. This is still a desirable feature so that there isn't an
extra reformating step to html that has the opportunity to introduce formatting

This feature is necessary as there is no WYSIWYG way of creating or editing an
entry in any wiki. Currently it is too difficult to enter a 100+ page formated
document into a wiki and create one or more wiki entries.
Comment 7 lohmaier 2006-02-04 17:00:14 UTC
*** Issue 61572 has been marked as a duplicate of this issue. ***
Comment 8 hans_werner67 2006-02-06 07:29:23 UTC
added fma to CC-list
Comment 9 simos.bugzilla 2006-02-08 14:45:50 UTC
I think the best way for this to be implemented is with an XSL transformation
(like "haui" posted above), along the lines of the DocBook XML support found at

Specifically, there is an import and an export transformation between the wiki
syntax and the format.

In addition, the use has to run a template (as in stw) that will limit the
available styles of the document to those that have relevance to the wikipedia
syntax. In this way, it will be easy to import/export.

Once having the import/export support as described in the
page, you can easily add, let's say, the .wiki format in the supported formats
that appear in File/Open/
Comment 10 haui 2006-02-08 20:39:35 UTC
Created attachment 33964 [details]
Style template to use with the already attached odt2txt transformation.
Comment 11 haui 2006-02-08 21:17:49 UTC
As simos proposes, my odt2txt transformation in deed relies on some "special"
(character) styles to generate special MediaWiki markup. Currently supported is
the math environment and all sorts of links and images. To insert a wiki link in
your text, you just type the target name say "" and apply the
character style "WikiLink" to it. In the transformed version of the text, this
is converted to "[[]]". The same applies to mathematical formulas.
If you want to insert the formula "E = m C²" into your text, just type it the
wiki-way and apply the character style "WikiMath" to it: "E = m C^2". During
export, this is converted to "<math>E = m C^2</math>". 

Creating more complex wiki links and references to images is also supported. The
text "my favorite office suite []" (with character style WikiLink)
is transformed to [[|my favorite office suite]] and therefore
refers to the same wiki page as the simple link above, but is displayed as "my
favorite office suite" in the text. You now can imagine, how to wiki-include images.

The attached style template "" also assigns two keyboard
shortcuts to the character styles, namely Ctrl-W to WikiLink and Ctrl-M to WikiMath.

I'll also attach two example files in OpenDocument format that show the
conversion at work. The first one "oopedia-example.odt" is a minimal example
that exactly demonstrates the link and math styles as described above. The
second one "rytzsche-achsenkonstruktion-herleitung.odt" is a real world example
showing "the source of" an article I wrote for using and the attached transformation.

Yes, I would also like an Wikipedia-auto-upload-on-save mechanism, a,
WYSIWIG-wiki-image-display with WikiMedia-Commons-auto-image-upload-on-save,
support for native styles for bold and italics, and of cause an
MediaWiki-import-mechanism. None of them are available yet, dreaming is still
Comment 12 haui 2006-02-08 21:19:47 UTC
Created attachment 33967 [details]
Simple example document demonstrating wiki links and wiki math in
Comment 13 haui 2006-02-08 21:22:23 UTC
Created attachment 33968 [details]
Complex example for a real world wiki page using wiki syntax (source of
Comment 14 richardeholder 2006-02-11 21:40:36 UTC
As a very non-technical OOo user, it would help me and others in a similar
situation if there were step by step instructions on how to use these solutions.  
Comment 15 fuzzyeric 2006-05-16 19:32:55 UTC
I might add the following refinement/request to support the usage pattern of
opening legacy format documents and pushing them to a MediaWiki...

In addition to the menu item File|Export as PDF..., we need File|Export to
Wiki..., (or Save to Wiki...) which
1) provides a list of wikis previously used as targets by this user (and a
facility to specify another one), and
2) provides a mechanism of specifying both an article and (optionally) a section.

For section selection, I suggest a tree view, most straightforwardly implemented
by hacking the header markup on the target page.  But there may be a better way.

Also, we need File|Open from Wiki..., providing a mechanism for specifying both
an article and (optionally) a section.

It would be preferable to use MediaWiki's "Show Preview" button to perform
WYSIWYG refreshes, so that templates and whatnot will be expanded in the context
of the target wiki.

For extra credit, have an option to show the Edit History of the wiki page as
Recorded Changes and/or extend the Edit|Compare Document... to take a historical
edit of the page as the "other" document.
Comment 16 haui 2006-08-31 22:39:09 UTC
For all of you who are not fans of Unix command line tools, a page has been set
up that demonstrates the odt2txt conversion utility online:

Comment 17 kami911 2007-04-12 12:19:15 UTC

Are we interested to integrate it somehow into I might able to
help with installation related things.
Comment 18 kami911 2007-05-09 09:14:26 UTC
Hello! Are there any updated version of this filter?
I have created an integration patchset for this filter. So if you wish you can
integrate it. I didn't tested it (with build) - but I will do it later.
Comment 19 kami911 2007-05-09 09:16:25 UTC
Created attachment 44964 [details]
Mediawiki (export)  integration patch rev. 1
Comment 20 Martin Hollmichel 2007-05-09 09:36:13 UTC
set issue type to patch and reassign to project lead for review.
Comment 21 Mathias_Bauer 2007-05-14 19:14:34 UTC
Thanks for the patch; I'm currently a "little" bit busy but will try to review
the patch and do some testing as soon as possible. I also will assign a target
as soon as I will know more about it.
Comment 22 Martin Hollmichel 2007-05-15 07:48:01 UTC
@kami: did I miss to apply one patch: I get message:
Making: ../
guw.exe /usr/bin/perl /home/martin/OpenOffice-build/OOF680_m14/solenv/bin/par2sc -i ../,/home/martin/OpenOffice-build/OOF680_m14/solver/
680/ @@/tmp/mkrUGyED -o ../

par2script -i ..\\par,C:\cygwin\home\martin\OpenOffice-build\OOF680
_m14\solver\680\\par @@C:\cygwin\tmp\mkrUGyED -o ..\\b
Checking directories ... Done
ERROR: No directory defined for file: gid_File_Stw_MediaWikiTemplate!
Checking File ... dmake:  Error code 255, while making '../
---* *---
Comment 23 kami911 2007-05-15 09:46:38 UTC
I am not sure If you applied mediawiki-scp2-directory.diff patch.
Please check for "gid_Dir_Share_Xslt_Wiki" at scp2/source/ooo/directory_ooo.scp
if you found - you are right and I did something wrong elso please patch this
file :o)
Comment 24 Martin Hollmichel 2007-05-16 12:53:01 UTC
>I am not sure If you applied mediawiki-scp2-directory.diff patch.
it has been applied.
>Please check for "gid_Dir_Share_Xslt_Wiki" at scp2/source/ooo/directory_ooo.scp
>if you found - you are right and I did something wrong elso please patch this
>file :o)
yes, it has been found.
Comment 25 kami911 2007-05-16 18:17:42 UTC
I am so sorry mh. I missed two semmicolon from
mediawiki-scp2-xsltfilter-file.diff. Those caused the problem. I am going to
attach it now. I am only posting the affected diff file.
Sorry again!
Comment 26 kami911 2007-05-16 18:22:21 UTC
Created attachment 45149 [details]
Corrected SCP2 file for file handling
Comment 27 Martin Hollmichel 2007-05-16 20:33:15 UTC
@kami: no problem, I should have seen the missing semikolon myself. Now it
compiles like a charme but crashes if I try to export in this format.
Comment 28 Mathias_Bauer 2007-05-16 22:01:40 UTC
The crash is caused by the fact that the user data contains 5 elements but the
adaptor code expects 6. Of course the adaptor shouldn't crash (easy to fix) but
probably the code won't work correctly. I'm currently trying.
Comment 29 Mathias_Bauer 2007-05-16 22:39:21 UTC
Created attachment 45157 [details]
the corrected filter configuration
Comment 30 Mathias_Bauer 2007-05-16 22:40:03 UTC
Here's the obvious meaning of the userdata elements:

userdata[0] ConvertClass
userdata[2] Import
userdata[3] Export
userdata[4] ImportStyleSheet
userdata[5] ExportStyleSheet
userdata[6] PrettyPrinting (optional)

So I added a comma before the export style sheet. The crash is gone but I only
get an empty file. Obviously the still filter needs some work.
Comment 31 kami911 2007-05-16 22:41:48 UTC
Just for learning:
Was the problem here:
<prop oor:name="UserData"><value

Comment 32 Mathias_Bauer 2007-05-16 22:41:51 UTC
Svante, the filter does not produce any output though it doesn't throw an
exception or returns an error. Can you find out why?

And BTW: shouldn't we change the filteradaptor code so that it complains if
msUserData has less than 5 elements? Currently it crashes in this case.
Comment 33 Mathias_Bauer 2007-05-16 22:43:03 UTC
@KAMI: yes, please see the attached xcu file
Comment 34 kami911 2007-05-16 22:44:37 UTC
Thanks, I saw :o)
Comment 35 kami911 2007-05-17 08:47:24 UTC
I specified the xsl file wrongly. Here is the updated file.
Comment 36 kami911 2007-05-17 08:50:59 UTC
Created attachment 45180 [details]
Corrected typedetection file
Comment 37 kami911 2007-05-17 13:14:57 UTC
this latest file does not solve the problem.
Comment 38 kami911 2007-05-17 13:21:09 UTC
Just for learning: what is the difference between and ?
Comment 39 kami911 2007-05-17 13:27:56 UTC
Also we might try this:
Has anyone experience how this filter perform on complex documents?
Comment 40 Mathias_Bauer 2007-05-17 19:11:43 UTC
assignment got confused...
Comment 41 Mathias_Bauer 2007-05-17 19:20:12 UTC
Fine, now I get a file.
AFAIK "XMLOasisExporter" exports to ODF, "XMLExporter" exports to the old OOo
file format.

I will check how good the export is.
Comment 42 Mathias_Bauer 2007-05-17 19:27:26 UTC
Well, a first test didn't take very long. And the results are not very attractive.

I took a simple document that consists of text, lists, some hyperlinks and a table. 

Result of the conversion:

many of the list didn't make it, the table is gone and all(!) hyperlinks. Also
non-ascii characters (like custom quotes) didn't convert correctly. That was
what I spotted in two minutes of review.

All in all the transformation doesn't look usable to me. Especially losing all
hyperlinks is a disaster.

I don't know if anyone is willing to fix the transformation. In case not we
should set the issue type back to "FEATURE".
Comment 43 Mathias_Bauer 2007-05-17 19:39:40 UTC
Svante, it seems that we don't need your help. Sorry for bothering. :-)
Comment 44 haui 2007-05-17 22:54:40 UTC
Created attachment 45200 [details]
Improved transformation revision 339.
Comment 45 haui 2007-05-17 22:58:33 UTC
Just to increase confusion: I updated my transformation (odt2txt). It is now
able to transform paragraphs, headings, bold and italics character styles,
native OpenDocument links, and ordered and unordered lists. Additionally, it
respects the special styles WikiMath and WikiLink. Tables are currently not
Comment 46 haui 2007-05-17 23:06:43 UTC
Created attachment 45201 [details]
Fixed disappearing of document internal references.
Comment 47 haui 2007-05-17 23:21:56 UTC
Created attachment 45202 [details]
Revision 342 adding basic support for tables.
Comment 48 Mathias_Bauer 2007-05-17 23:52:57 UTC
Wow! I didn't expect to see improvements happening so fast. :-)
I will give it a try soon.

Thanks for your work.
Comment 49 kami911 2007-05-18 09:01:15 UTC
Yes it is much better. Are you planning to improve it more?
I created a Crazy Wiki Page
( where we can test the
filter capability...
I am attaching the odt file here

Comment 50 kami911 2007-05-18 09:02:52 UTC
Created attachment 45213 [details]
An crazy example
Comment 51 kami911 2007-05-18 09:22:54 UTC
Crazy example works well but not perfect.
* Tables with header - the header row lost
* Underlined/Smallcaps/striketrough text not supported
* Preformatted text not supported
* Centered/Right/Justified paragraph not supported
* Mo horizontal rules
* Footnotes not supported
* Images not supported
* No border around the table

Bit things better than before :o) Thank you...
Comment 52 Mathias_Bauer 2007-05-18 09:32:20 UTC
Yes, the transformation is much better now. It sometimes adds some brackets
around text that irritate me. And it still has problems with non-ascii
characters. I will upload an example document showing this later.
Comment 53 kami911 2007-05-18 09:36:24 UTC
We should create a consistent testing document, where all (or lofs of) features
can be tested: Features / special characters.
Comment 54 Mathias_Bauer 2007-05-18 09:39:26 UTC
Created attachment 45214 [details]
test document
Comment 55 Mathias_Bauer 2007-05-18 09:40:07 UTC
You can see the result of the export of the attached test document at
Comment 56 haui 2007-05-20 21:39:05 UTC
Hi, I'm willing to further improve the transformation. Test documents are a
really great help, thanks.
Comment 57 Mathias_Bauer 2007-05-21 09:09:24 UTC
Great! Looking forward to the improvements. 
We should define which of the known issues or missing features we might need for
an integration as a filter. My choice is:

- fix problems with non-ASCII characters
- remove superfluous brackets around text
- paragraph alignment should be supported

As a developer I also would like to have a way to export source code properly,
could be as preformatted text. But I'm not sure if this is something we need for

Images surely are a problem as this can't be solved by a filter producing a
file. A tedious manual procedure won't help a lot so perhaps we should leave
images out for the moment.
Comment 58 haui 2007-05-29 22:09:23 UTC
Created attachment 45498 [details]
Revisoin 2639 of the odt2wiki transformation (formerly known as odt2txt).
Comment 59 haui 2007-05-29 22:11:04 UTC
Created attachment 45499 [details]
Feature overview of the odt2wiki transformation.
Comment 60 haui 2007-05-29 22:34:30 UTC
Hi there, 

I'm happy to present an extremely improved version (r2639) of the
transformation. The attached odt2wiki-features.odt document gives an overview of
the implemented features. The tranformation result of the features document can
be viewed online at

The transformation regarding character styles has been completely rewritten.
Special care has been taken to keep the runtime complexity of the transformation
linear in the document size (assuming a small fixed number of formattings per
paragraph). On a medium range PC, the Apache Xalan engine is still able to
output 8 pages/second with even large documents (> 100 pages), resulting in a
speed advantage of factor 68 over the alternative transformation mentioned above
on a 64 pages document (while now producing really superior results...). This
enables transforming even mid-sized documents in an environment-friendly way. :-)
Comment 61 haui 2007-05-29 22:37:36 UTC
Regarding the problem with "special characters" mentioned above: The
transformation always creates UTF-8 output, which might be non-standard on some
platforms. In that case, it helps viewing the result in e.g. Firefox and
switching the encoding to UTF-8 before cutting and pasting the text.
Comment 62 Mathias_Bauer 2007-06-01 09:56:32 UTC
Thanks for the work, I'll give it a try on the weekend.
Comment 63 Mathias_Bauer 2007-06-07 19:03:17 UTC
Sorry, I still couldn't get a running filter. Maybe I'm confused. 

Is the final xslt file (revision 2639) thought to be incorporated into the patch
from KAMI or should it be installed via "Tools - XML Filter Settings"?

Comment 64 kami911 2007-06-07 19:34:32 UTC
Created attachment 45737 [details]
Mediawiki (export) integration patch rev. 2 - Updated xslt and diff files.
Comment 65 kami911 2007-06-07 19:38:55 UTC
I just created a patchset with latest files. I will test it tomorrow.
Comment 66 Mathias_Bauer 2007-06-07 21:47:23 UTC
Thanks KAMI, but you did the same error again: we must use the XMLOasisExporter. ;-)
I changed that and the patch runs fine. I will check the result tomorrow.
Comment 67 Mathias_Bauer 2007-06-07 22:55:29 UTC
Just a first comment: my first tests are very promising. Great work, haui!
Please give me some more days for testing. If no bigger problems show up I will
add your patch to a Child Workspace.

Thanks for your contribution!
Comment 68 kami911 2007-06-08 06:20:03 UTC
Thanks ;o)

In relation above I would like to know why other filters (XHTML, DocBook) use
XMLExporter and XMLImporter ant not the Oasis version?
Comment 69 Mathias_Bauer 2007-06-08 10:05:11 UTC
If the transformation transform from or to our old OOo1.x file format ("sxw")
you have to use the XMLExporter, if the transformation uses ODF you have to use
the XMLOasisExporter. The wiki transformation obviously uses the latter, and it
is strongly recommended to do so. Some old transformations from the time before
ODF was ready are still available so the XMLExporter is still supported.
Comment 70 Mathias_Bauer 2007-06-08 14:49:30 UTC
Question to haui: would it be possible to extend your transformation to embed
HTML code for elements not available in Wiki format? Of course it must be
defined when and what but my question is only a general one about the basic
Comment 71 haui 2007-06-10 09:13:28 UTC
Regarding HTML embedding: Technically speaking, the output method of the
transformation is "text", therefore, XML in the result document must be
explicitly quoted by the transformation. But there is no principal restriction
that makes it impossible to embedd HTML into the generated wiki text - even if
this would reduce its readability.
Comment 72 Mathias_Bauer 2007-06-12 19:59:39 UTC
I tried some exports and I'm impressed. This is a great addition to Thanks for this contribution.

I will add the patch to a CWS planned to be integrated into 2.3.
Comment 73 Mathias_Bauer 2007-06-14 11:00:41 UTC
committed to CWS
Comment 74 kami911 2007-06-18 10:17:28 UTC
Great, thanks all
Comment 75 eric.savary 2007-06-29 15:41:31 UTC

I'm QA representative for the CWS which will introduce the "File - Export -
MediaWiki (.txt)" export filter.

I am currently writing an specification (see:
about it because we MUST have a specification for i.

I corrected the summary of this issue.


PS: though issue reports should always remain technical and facts orientated:
@haui: your contribution is great!!! I'm amazed about what you've done! It's a
great Writer-Wiki transformation! Thanx! :)
Comment 76 Mathias_Bauer 2007-07-02 22:40:18 UTC
Thanks Èric; you are right. I removed all occurences of "WikiPedia" from all
files and also registered the filter for Writer/Web.

Please verify.
Comment 77 Mathias_Bauer 2007-07-02 22:42:45 UTC
oops :-)
Comment 78 Mathias_Bauer 2007-07-02 22:43:12 UTC
wrong button clicked. :-)
Comment 79 Mathias_Bauer 2007-07-02 22:43:36 UTC
*now* please verify.
Comment 80 matthias.mueller-prove 2007-07-03 14:53:06 UTC
add link to spec:
Comment 81 jack.warchold 2007-07-10 11:59:27 UTC
seen good in cws mba32issues03 -> verified
Comment 82 eric.savary 2007-08-09 13:16:42 UTC
Ok in m225
Comment 83 Mathias_Bauer 2007-11-15 07:33:39 UTC
*** Issue 83645 has been marked as a duplicate of this issue. ***
Comment 84 aexl 2007-12-19 18:54:02 UTC
hello dear other wiki filter hackers,
you might want to support issue 40504: User defined Parameters for XSLT Filter
this would make it possible to pass parameters to an xslt export filter, like this:

select type of wiki
[ ] mediawiki
[ ] dokuwiki
Comment 85 aexl 2007-12-19 19:00:19 UTC
you might also want to support good olde issue 7760: Option to force users to
adhere to style sheets
so we could guarantee that everything the user does is exportable to wiki...
Comment 86 eric.savary 2008-02-07 08:54:19 UTC
Added keyword [MWEx] to the summary to be tracked by the query