This is the new page
<html> <body> blah </body> </html>
Another test. The following content was created by an OpenOffice macro:
Iannz DokuWiki macro
The demo will:
Click this button .
Bold, italics, underline, strike-through, mono spaced fonts, superscript and subscript all get mapped to DokuWiki equivalents. Any other character formatting is lost. The conversion is not as elegant as it could be as it will produce for “bold bold & italic”:
**bold **//**bold & italic**// rather than **bold //bold & italic//**.
Outline levels 1-5 get mapped the DokuWiki equivalents. Higher outline levels are ignored although if the style uses the above character formats they should get transferred across. Any formatting within an outline level 1-5 paragraph is ignored.
Bulleted and numbered lists get transferred to the DokuWiki equivalent, with the level of the list determining the amount of indentation. As there is no choice of bullets or numbering schemes in DokuWiki the lists are very simple indeed.
I suspect that breaks in numbered lists will simply restart at 1 in DokuWiki.
If a paragraph is formatted with a bottom border then a DokuWiki horizontal line will be inserted.
All other paragraph formatting is ignored.
The name of the frame will be inserted into the DokuWiki command: {{wiki:FrameName}}
, where FrameName is the name of the frame as shown in the navigator. If the frame has no name then it is ignored. You will need to upload the graphic file manually, using your browser. See http://software.newsforge.com/article.pl?sid=05/01/06/1511255&tid=130&tid=93&tid=13.
Simple tables should transfer OK. Where there is more than one paragraph in the cell, it is the alignment of the last paragraph that determines the alignment for the cell. Horizontally merged cells should work ok. The tables do not look pretty in the DokuWiki format but seem to render ok in DokuWiki itself.
Cells with paragraph style “Table Heading” will get prefixed with “^” so that they get rendered as headings.
Heading One | Heading Two |
This too is a heading. | But this is not. |
Hyperlinks should get transferred - this probably needs improving. Currently any formatting within a hyperlink will cause the hyperlink to be repeated in the DokuWiki document.
So that it is possible to copy a rendered page from a DokuWiki site, any hyperlinks that have “doku.php?id=” in them will be treated as internal links. I don't check to convert double square brackets to literals so anything in double square brackets should simply go into the DokuWiki document - beware if you don't have your double square brackets matched the rendering will not work as expected.
Smart quotes get converted to ordinary quotes.
Anything else is simply ignored.
I have tried to check for formatting commands within the document so that they get converted to literals. One that I haven't checked for is spaces at the start of a paragraph, so paragraphs with spaces at the start should be rendered literally. Nor have I checked for the literals themseleves the double percentage signs.
Any paragraphs with a style name that includes the text “code” will be enclosed with ”<code xxx> … </code>” tags. Where xxx can correspond to one of, if the corresponding string appears in the style name after the text “code” : “actionscript”, “ada”, “apache”, “asm”, “asp”, “bash”, “caddcl”, “cadlisp”, “c_mac”, “cpp”, “csharp”, “css”, “delphi”, “html4strict”, “javascript”, “java”, “lisp”, “lua”, “nsis”, “objc”, “oobas”, “pascal”, “perl”, “php-brief”, “php”, “python”, “qbasic”, “smarty”, “sql”, “vbnet”, “vb”, “visualfoxpro”, “xml”, or “c”.
E.g. Paragraph style name = “code_oobas” will produce the tags ”<code oobas> … </code>”.
sub HelloWorld msgbox "Hello World" end sub
So that text can be copied from DokuWiki rendered web pages into Writer and then the macro run, the paragraph style name “Preformatted Text” will also assign the tags ”<code oobas> … </code>”. I chose “oobas” as the default as that is what I mostly use .
There is also a sub called Folders, that converts all ”.html” files in the specified directory tree to DokuWiki txt files. I suggest only running this on a copy of your files, and to check it for your needs first. The files that I was converting had very few graphics so I haven't worried about automating them other than the process mentioned above.
This is so that the macro will be available for use when required
This is so that the macro integrates with OpenOffice.org Writer so that it appears seamlessly a part of it.
Thanks to Dmitri Popov for requesting this macro and being patient with me while I worked on other things. And Andreas Gohr for writing DokuWiki in the first place.
Copyright © 2004 Ian Laurenson
Anyone may run the code associated with this document. If you wish to modify or distribute this document and or its code, then you are granted a license to do so under the terms of the Gnu Lesser General Public License. See: http://www.gnu.org/licenses/lgpl.html.
Send comments, bug fixes, change requests etc to hillview@paradise.net.nz