Wikitools
From SpareMiNT Wiki
Contents |
[edit] Preface
The two awk-scripts w2u.awk and u2w.awk provide the possibility to convert documents written for udo from and to the wiki-language.
[edit] Installation
Copy the files listed below (except w2u.ui) into a directory in $PATH or your local directory. The include-file w2u.ui is first searched in the local directory, then in $HOME/wiki. Copy the Makefile to your local directory.
[edit] Files
- u2w.awk Convert from udo to wiki
- w2u.awk Convert from wiki to udo
- u2w Shell-script to call u2w.awk
- w2u Shell-script to call w2u.awk
- getxml Retrieve xml-source from the wiki
- makenodes Create nodes- and label-list
- Makefile see below
- w2u.ui Includefile needed for the udo-output by w2u.awk, contains some macros and
udo-specific settings.
[edit] Usage
[edit] retrieving wiki-source
Download the xml-file from the wiki using
getxml <Chapter>
To download the MiNT-usermanual for example enter:
getxml User_manual
This will produce the file
User_manual.xml
in your local directory.
[edit] Convert from wiki to udo
You get udo-source from wiki-xml by entering
awk -f w2u.awk <wiki-source>
or simply
w2u <wiki-source>
The output-filename will have the same base as the source with the extension .wu.
For example to convert the MiNT-usermanual to udo enter:
awk -f w2u.awk User_manual.xml
This will produce the file
User_manual.wu
Now you can convert this using udo to any format you need.
[edit] Convert from udo to wiki
You get wiki-source from udo-source by entering
awk -f u2w.awk <udo-source>
or simply
u2w <udo-source>
The output-filename will have the same base as the source with the extension .wik.
To convert the MiNT-usermanual to wiki enter:
awk -f u2w.awk User_manual.wu
This produces
User_manual.wik
which can be imported into the wiki by copy/paste.
If you want local links for nodes and labels in the wiki-output you need to create a file
<udo-source>.n
which contains a list of all nodes and labels.
You can create this file by running
egrep "(^!(sub)*node|^!label)" <udo-source> ><udo-source>.n
or run
makenodes <udo-source>
[edit] Using the Makefile
Type
make <name>.<ext>
to produce the output-format you want. Example:
make User_manual.html
will produce User_manual.html from User_manual.xml, User_manual.wu, or User_manual.u.
[edit] Environment
[edit] Coverage
Both tools only cover a small subset of their input-language, so it's up to the user to not use anything that's not supported.
[edit] Coverage of udo-syntax
[edit] udo-Comments
Lines that start with a '#' are comments. They are converted into
<!--# <text> -->
[edit] Coverage of wiki-syntax
[edit] Wiki-Comments
The html-commentmarks
<!--, -->
are removed from the wiki-source. If you want to add a comment to the wiki-source type:
<!--# <your comment> -->
so your comment will be a comment in udo-source and will not get lost or cause errors. Only one-line-comments are possible.
[edit] What should be avoided in wiki
- Using links as headlines is a ba idea, because udo places the link
itself in the TOC not the link-text.
- Using brackets in a link-text is not reccommended, because they may confuse udo and the converter.
- definition lists don't work because awk kills any leading ';' from the input-stream.
[edit] What should be avoided in udo
The converter emits a warning for any unknown udo-command it encounters.
[edit] External links
Both converters use the URL given in the base-statement, which is for wiki:
<base>URL</base>
and for udo:
#! base URL
at the start of the document.
[edit] Known bugs
- When repeatetly converting back and forth, the bold-environment may not always be correct (as well as other things).
[edit] Download
[edit] See also
awk, udo, egrep, wget
[edit] Conclusion
The combination udo/awk is too limited (or my skills are) to make a complete converter, so this is probably the last version.

