[pmwiki-users] What the @!$&? is that?

Joachim Durchholz jo at durchholz.org
Sun May 7 02:22:58 CDT 2006

Pico schrieb:
> Doing something more with source action
 > Source action is a great tool that could be expanded upon and promoted
 > as yet another way to explore and learn more about PmWiki.

Nice idea.

However, I'd recommend sticking with the "first things first" approach. 
First, you to be able to spit out a useful page given a markup. The 
original idea (building a MarkupCharacters page) is an excellent start 
for that.

Once that is in place, we can still automate the lookup in the source 

> 1. Markup hints
> One thing that could probably be done without too much trouble would be 
> to display a condensed version of MarkupCharacters (2-4 lines) that 
> displays characters that link to the relevant documentation page. 
> Perhaps this could be accomplished by having the source be displayed 
> withing some sort of a frame, or...

action=source would have to rewritten. Currently, it's working in the 
cheapest possible manner: it spits the page out as-is, and tells the 
browser that it's of the text/plain MIME type. So it's currently 
impossible to add the usual PmWiki decorations around the action=source 

Things that would need to be done would be:
1) HTML-escaping the page contents. (That's a predefined function in 
PHP, so this is easy.)
2) Provide hooks for other transformations. (E.g. the mail address 
hiding recipes would want to be able to mangle mail addresses in the 
3) Read a template and place the page contents in it.

I don't have expertise for (3), so if anybody has suggestions here. (Oh, 
and somebody would have to code the stuff. I'm tempted, but I'm in too 
many other projects at this time.)

> 2. Markup phrase translation links
> A more ambitious idea would be to supercharge the ?action=source to 
> display markup characters as links, where the underlying source markup 
> characters would display, but those characters would be links to 
> documentation pages.  This may not work, but here is one way I thought 
> that it could be implemented:  use a special phrase translations page, 
> like the internationalizations XL page, that was only used by 
> ?action=source to translate specified sequences of markup characters 
> into a link to a documentation page, like this:
> '<<|' => 'WikiTrails',

The MarkupCharacters page could serve as a starting point for this. 
However, I don't think this is a very good idea. Such a page would have 
to be constantly updated kept consistent, which means it won't be done.

However, we could leverage the MarkupTable. By replacing the "repl" 
field in each entry, we could already do this:

> PmWiki would then replace <<| in the source display <<| as the alias for 
> a link that pointed to WikiTrails

and the the links could go directly to "PmWiki.MarkupCharacter$1" (where 
$1 stands for the markup character).
Um... we'd have to do a bit of trickery here though. Many markup 
characters are not valid filename characters (particularly on Windows, 
which prohibits a whole slew of them). We might have to extend the 
Markup() function to accept an additional parameter that gives the 
documentation page for the markup. (As a side effect, this would nudge 
the developers towards actually writing the documentation *g*).
The downside of that approach is that most Markup() calls would have to 
be rewritten, so this isn't a fast-and-simple solution. Since many 
Markup() calls are in core, this also means this solution would need 
core support.

PM, any ideas how best to proceed with that? (Assuming somebody is 
really going to do that...)

> If we get even more ambitious, the ?action=source could also supply a 
> bit of javascript to support mouseover and could use the translated 
> documentation page, e.g. WikiTrails, as the on mouseover text.  Or, 
> perhaps even better, allow the phrase translation page to include a 
> separate field or item for the mouseover text.

That would take too long to download. Assume a page that uses two dozen 
markups, then you'd have to download two dozen tooltip texts. The texts 
could quickly become too large.


More information about the pmwiki-users mailing list