[Pmwiki-users] AsSpaced function (was pmwiki-2.0.devel9 released)

Patrick R. Michaud pmichaud
Thu Sep 30 20:20:15 CDT 2004


On Fri, Oct 01, 2004 at 10:00:58AM +1200, John Rankin wrote:
> 
> 1. Make spacing the default and in particular make $Name in
>    the template $SpacedName (change Wiki Help and Search Wiki too)

This is definitely worth considering, since the documentation now
tends to emphasize "[[page links]]" over "PageLinks".  OTOH, I think
we violate the principle of least surprise a bit when CamelCase words
automatically get spaces in them.  I'll have to think about this a bit more.

The variables I'm currently playing with:

   $PageName     -- a page's full Group.Name, no spaces
   $Group        -- a page's group, no spaces (i.e., for URLs/links)
   $Name         -- a page's name, no spaces (i.e., for URLs/links)
   $SpacedGroup  -- spaced version of $Group
   $SpacedName   -- spaced version of $Name
   $Title        -- a page's title, which defaults to $Name (or maybe
                    $SpacedName if $SpaceWikiWords is set), but can be
                    overridden by a [:title ... :] directive within a page,
                    or some other administrator-specified function.

The template would use $Title.  Indeed, this is exactly why I decided
to separate $Title from $Name -- $Title is how the page's name or identity
is displayed to a reader, while $Name is how we identify/locate the page
within the wiki.  ($Name is basically the equivalent of PmWiki 1's $Title_
variable.)

I haven't figured out what to do with spacing of the group name in the
default template.  

> 2. One directive ([:joinwikiwords:] perhaps) changes body text and 
>    the pagename display (ie $SpacedName is not spaced if the
>    [:joinwikiwords:] directive is set)

I've been considering [:wikiwords:], [:nowikiwords:], and [:spacedwikiwords:],
which could be entered multiple times on a page to allow different sections
to follow different rules.  Or, instead of separately named directives we 
could parameterize a single directive, as in [:wikiwords on:], 
[:wikiwords off:], and [:wikiwords spaced:].  (I welcome any suggestions
for better directive names here.)

> 3. At a minimum make the AsSpaced function a variable, so sites
>    can customise name spacing

Certainly -- I wouldn't dream of losing that capability.

> -- a list of words not to be capitalised if \sword\s is true
> -- a list of words not to be spaced (such as PmWiki)
> -- a special case of this is the 'mostly uppercase words'
> -- a list of words that start [:lower:][:upper:] 
> -- disabling wikiwords (which I think already exists)

There's likely to be a generalized "wikiword filter" where an administrator
can provide all sorts of custom filters to WikiWords.  For example,
an administrator will be able to disable or change the meaning of
individual wikiwords, as well as wikiwords that match a pattern 
(e.g., "Mc[:upper:]", "COM\\d+", etc.).  Same thing for setting 
counts of wikiwords and the like.

I may also come up with a per-word (or per-string) translation engine,
to allow any bare word to be translated to an appropriate link.  Technically
this already exists via the Markup() call.  For example, if someone
wants "iTunes" to work as a bareword link:

    Markup('iTunes','>wikilink','/\\biTunes\\b/e',
      "Keep(MakeLink(\$pagename,'iTunes'),'L')";

Given this, the best approach may simply be to provide a wrapper function
to Markup() that simplifies the registration of such barewords:

   BareWordLink('iTunes');     # treat 'iTunes' as [[iTunes]] (no space)
   BareWordLink('PmWiki');     # PmWiki is never a spaced Wiki Word

> 6. Alternatively, provide a mechanism for:
>    naming pages according to the creator's directions
> -- if I write [[iTunes]] or [[TEOs]] or [[A Place to Stand]]
>    that becomes the $Name of the page
> -- I imagine this being done by changing to space to a
>    (forgive me) '_' to name the file and translating the
>    (forgive me) '_' back to a space for display purposes

I've been thinking of perhaps another approach -- namely, to make 
pagenames case insensitive everywhere (as they often end up being in 
Windows/Mac environments anyway).  If this happens, then a page's name 
for display purposes would come from a field held inside the pagefile
itself; the field would be initialized with the case+spacing that was
used by whatever/whoever created the page initially.

> -- the drawback to this is with wikiwords enabled 
>       [[A Place to Stand]] is not the same as APlaceToStand
>       iTunes may or may not be the same as ITunes

I think this is a fairly significant drawback--at least it is for 
me.

Pm



More information about the pmwiki-users mailing list