[pmwiki-users] Wikified action lists

Bronwyn Boltwood arndis at gmail.com
Tue Aug 2 18:32:52 CDT 2005


I experimented a little with putting skin action lists into wiki pages
today, and here are my thoughts.  I'm hoping that others will have
useful suggestions, or make some use of mine.

Here's the original HTML that we want to duplicate:

<ul class="navlist">
<li><a id="browse" href="$PageUrl">$[Read Page]</a></li>
<li><a id="edit" href="$PageUrl?action=edit">$[Edit Page]</a></li>
<li><a id="diff" href="$PageUrl?action=diff">$[Page History]</a></li>
<li class="upload"><a id="upload" href="$PageUrl?action=upload"
target="_blank">$[Attach file]</a></li>
<li class="attr"><a id="attr" href="$PageUrl?action=attr">$[Change
Attributes]</a></li>
</ul>

Here's my best shot at the above in wiki markup:

* %list class=navlist% %item class=browse% [[{$Name}?action=browse |
$[Read Page]]]
* %item class=edit% [[{$Name}?action=edit | $[Edit Page]]]
* %item class=diff% [[{$Name}?action=diff | $[Page History]]]
* %item class=upload% %newwin% [[{$Name}?action=upload | $[Attach file]]]
* %item class=attr% [[{$Name}?action=attr | $[Change Attributes]]]

HTML generated from the wiki markup above:

<ul class='navlist' >
<li class='browse' >  <a class='wikilink'
href='http://localhost/pmwiki-latest/testing/field.php/Site/CommandTabs?action=browse'>Read
Page</a></li>
<li class='edit' > <a class='wikilink'
href='http://localhost/pmwiki-latest/testing/field.php/Site/CommandTabs?action=edit'>Edit
Page</a></li>
<li class='diff' > <a class='wikilink'
href='http://localhost/pmwiki-latest/testing/field.php/Site/CommandTabs?action=diff'>Page
History</a></li>
<li class='upload' >  <a target='_blank'  class='wikilink'
href='http://localhost/pmwiki-latest/testing/field.php/Site/CommandTabs?action=upload'>Attach
file</a></li>
<li class='attr' > <a class='wikilink'
href='http://localhost/pmwiki-latest/testing/field.php/Site/CommandTabs?action=attr'>Change
Attributes</a></li>
</ul>

The HTML from PmWiki is close, but doesn't function just the same as
the hand-coded stuff.  I can't find a way to apply a class or id to
the <a> tag through wiki markup, for instance.  This is bad because
putting it on the <li> doesn't work the same as putting it on the <a>,
for styling purposes.

Another thought is that the wiki markup is not much shorter, neater,
or easier to understand than the HTML.  That, of course, was one of
the main reasons to wikify the action lists: make it easier for new
admins to understand.  On the good side, though, the admin can still
easily find and edit a specific chunk of the skin without facing the
rest, and (more importantly) can easily roll back the changes.

Now that I've tried to implement it, I have to say that the
cost-benefit ratio of wikifying the action list is not that good so
far.  After all, I can easily add comments to the template source and
readme about how to find and change specific chunks, and why they
should copy the original and enclose it in a comment tag before making
their changes.

Here's what I'm doing and how the original code helps me achieve it:
- accessible, semantic markup: these are lists, after all, and lists
can be styled to look like tabs, buttons, or other things.
- mark the current action: the ids on the <a> tags let me use a CSS
rule to mark the current action.  For many list treatments, using the
<a> tag for this works better than using the <li> tag.
- mark the list as a navigation list: also aids in styling.
- hide certain items when they're inappropriate: putting classes on
certain <li> tags lets me hide them with display: none; when the admin
wants to hide those features of PmWiki.
- translation-friendly: text that needs internationalization is enclosed in $[].

The most problematic goals to achieve in wiki markup are:
- provide the necessary hooks for marking the current action
-correctly markup text that has variables AND needs to be translated. 
I was trying to do this for a Site.FeedSnippet page, and just could
not figure out how to make something as versatile as

<ul class="navlist">
<li><a href="$ScriptUrl/$[$Group/RecentChanges]?action=rss">$[XML Feed
for $Group]</a></li>
<li><a href="$ScriptUrl/$[$SiteGroup/AllRecentChanges]?action=rss">$[XML
Feed of All Recent Changes]</a></li>
<li><a href="$ScriptUrl/$[PmWiki.AboutFeeds]">$[What's an XML feed?]</a></li>
</ul>

Thoughts?

Bronwyn




More information about the pmwiki-users mailing list