[wiki-standards] WikiWyg --> interwiki markup translators for free
Sunir Shah
sunir at sunir.org
Tue Mar 28 18:36:15 CEST 2006
> Are you suggesting that html is an intermediate form?
The theory:
Since this is done in browser via the DOM, the
deformations to HTML are taken care of by the browser,
kind of. There are some gotchas with the rules XML. For
instance:
<body>
paragraph one
<p>
pargraph two
</body>
gets translated to
* <body>
* paragraph one (CDATA)
* <p>
* paragraph two (CDATA)
* </p>
* </body>
Which is correct from XML's point of view, as paragraph
one is the CDATA for <body>.
I'm sure the Safari is totally bs, just because it's
Safari.
The most important and common wiki syntax forms are
isomorphic to HTML entities.
Block:
paragraph <p/>
lists <ol/>, <ul/>, <dl/>
table <table><tr><td/></tr></table>
horizontal rule <hr/>
monospace <pre/>
Inline:
bold <strong/> <b/>
italic <em/> <i/>
The only problems are
* some/most wiki engines do not have error-free syntax
nor formatters.
* some wikis have other syntax that generates HTML
using the tags above.
In either case, it doesn't matter, since the formatter
needs to be recoded for wikiwyg. You can either fix
the formatting and/or ignore the untranslateable syntax.
Finally links are fairly easy to detect. From the
wiki syntax level, use the LinkPattern. From the
HTML level, the html must have a <base href/>, either
in the HTMl itself, or supplied by the user agent.
Scan for links that are have the base href at the root.
If the query string or last path segment (for mod_rewrite)
matches the LinkPattern, it's a link to the wiki.
Since this is magical, the wiki formatter should also
mark all wiki links with a CSS class, "wiki_link"
Similar classes can be added for interwiki_link. All
other URLs are assumed to be external.
Best,
Sunir
More information about the wiki-standards
mailing list