[pmwiki-users] Understanding PmWiki

Patrick R. Michaud pmichaud at pobox.com
Wed Sep 27 12:19:46 CDT 2006


On Wed, Sep 27, 2006 at 05:56:15PM +0200, Mike wrote:
>    Hi all,
>    sorry for the bunch of questions in recent days. I'm trying to more fully
>    understand the syntax of advanced PmWiki markup.
> 
>    However, I don't find what I need in the documentation. E.g., I'm trying
>    to *understand* (not just slightly modify) the markup of Site.PageActions:
> 
>    * %item              class=browse    accesskey='$[ak_view]'%[[{*$FullName}
>    | $[View] ]]
>    * %item rel=nofollow class=edit     
>    accesskey='$[ak_edit]'%[[{*$FullName}?action=edit | $[Edit] ]]
>    * %item rel=nofollow class=diff     
>    accesskey='$[ak_history]'%[[{*$FullName}?action=diff | $[History] ]]
>    (:if auth upload:)
>    * %item rel=nofollow class=upload   
>    accesskey='$[ak_attach]'%[[{*$FullName}?action=upload | $[Attach] ]]
>    (:if:)
>    * %item rel=nofollow class=print    
>    accesskey='$[ak_print]'%[[{*$FullName}?action=print | $[Print] ]]
> 
>    Some of my questions:
>    * What does "%item" stand for?

It's really %item ...% (a WikiStyle), and it says to apply the given
style to the entire list item as opposed to just the text that follows.
In particular, it causes PmWiki to generate HTML of

    <li class='edit'>...</li>

instead of

    <li><span class='edit'>...</span></li>


>    * What is this "class=" for?

It allows CSS properties to be applied to the item that corresponds
to the current action.  For example, to have the current action display
with a background color of blue, a wiki administrator can do:

    $HTMLStylesFmt[] = ' .{$Action} { background-color: blue; }';

Then if the current action is 'edit' (as in "?action=edit"), the list
item corresponding to the edit action will be drawn with a blue background.

>    * Where are accesskeys defined?

They can come from a number of locations, but essentially they are phrase
translations following the model used for internationalizations.  PmWiki's
accesskey defaults are defined in scripts/prefs.php, but can be overridden
in lots of different places, including skins, language translation
pages (XLPage), and even per-browser preferences (see PmWiki.SitePreferences).

More documentation on access keys is available from
http://www.pmwiki.org/wiki/PmWiki/AccessKeys .

>    * Why are the brackets around the "clean text" like around "[Attach]"?
>    * Why is the $ sign before that like in $[Attach]?

The $[...] markup defines phrase translations, used for internationalizations
(and access keys, as noted above).  Essentially "$[Attach]" tells PmWiki
to substitute the current translation of "Attach".  If no translation is
defined for "Attach", then PmWiki just uses the phrase inside the brackets.

You can most easily see this working in the other languages sections of
PmWiki.  For example, at http://www.pmwiki.org/wiki/PmWikiDe/PmWikiDe you'll
notice that the default "View", "Edit", "History", and "Print" actions
are displayed as "Artikel", "Bearbeiten", "Historie", and "Druckansicht".
This is because the PmWikiDe group is loading in a set of translations
from PmWikiDe.XLPage (http://www.pmwiki.org/wiki/PmWikiDe/XLPage).
That page defines things like

  'View' => 'Artikel',
  'Edit' => 'Bearbeiten',
  'History' => 'Historie',
  'Print' => 'Druckansicht',

which says that things like "$[View]" and "$[Edit]" should be replaced by 
"Artikel" and "Bearbeiten".

This makes it very easy for us to support multiple languages, since
a recipe author can simply put any translatable prompts or
phrases inside of $[...], and leave it to others to actually build
the translation tables (either locally or on pmwiki.org for others
to use).

More information about $[...] is available at 
http://www.pmwiki.org/wiki/PmWiki/Internationalizations .

Hope this helps -- please feel free to ask more questions!
If you have any suggestions about where this information could be
better placed in the documentation, we'll be glad to have them too.

Pm




More information about the pmwiki-users mailing list