[pmwiki-users] Spacing Wiki Words

Petko Yotov 5ko at 5ko.fr
Sat Mar 12 15:07:59 CST 2011


On Friday 11 March 2011 11:11:17, Hans wrote :
> I went through some confusion about WikiWords in page titles,
> so can you confirm that I got the following right?
> 
> 1. Bare WikiWords are by default not used as links,
>    $EnableWikiWords = 1; will turn this feature on,
>    turning any CamelCase word into a link.

Yes.

> 
> 2. $LinkWikiWords = 1; will do the same as $EnableWikiWords = 1;

No. It controls if WikiWords are converted to links (1) or wrapped in a 
distinct CSS span without an active link (0). The span feature, IIRC, can be 
used to find those links in a wiki migrating to a non-wikiwords links. This 
variable only has effect if WikiWord links are enabled with $EnableWikiWords.

>    plus also honour directives (:linkwikiwords:) and (:nolinkwikiwords:)
>    in the content for the respective content.

Those directives allow sections of the page after them to have a different 
$LinkWikiWords setting (which only has effect if WikiWord links are enabled).


> 3. $SpaceWikiWords = 1; will space any bare WikiWord link enabled by
>    setting one or the other variables above. It will also honour
>    (:spacewikiwords:) and (:nospacewikiwords:) directives for
>    respective content.

Yes. Like with $LinkWikiWords, this will only have effect if WikiWord links 
are enabled with $EnableWikiWords. (Except for the Title.)


> 4. Since Wikiwords are by default off, the only effect of
>    $SpaceWikiWords = 1; is for the page variable {$Title}:
>    If no (:title ...:) is set in a page, $SpaceWikiWords = 1;
>    will space any WikiWord page name, same as {$Titlespaced}
>    does by default always.

Yes. The page variable {$Title}, the text produced by [[Link|+]], and the page 
title on top of the page.


> 5. $SpaceWikiWords = 1; will not space WikiWords in links
>    written as links like [[WikiWord]] or [[Main/WikiWord]].
>    Instead space the words in the link.

It doesn't space links in brackets, but it spaces WikiWord links if they are 
enabled.


> 6. If you don't use WikiWords, you may as well use {$Groupspaced} and
>    {$Titlespaced} in content or header navigation links or page title
>    or in the skin template, rather than $SpaceWikiWords = 1;

Yes.

 
> 7. I don't know how to set exemptions for some page and group names,
>    which I don't want to be spaced. $WikiWordCount['PmWiki'] = -1;
>    has no effect on {$Groupspaced} or {$Titlespaced} or
>    {$Title} plus setting $SpaceWikiWords = 1;
>    It only has an effect on bare WikiWords when WikiWords are enabled.

Correct.


> In the documentation PmWiki/BasicVariables does not mention all of
> this. $SpaceWikiWords does not mention the effect on {$Title},
> but this is the only effect it has in a default install.

I can confirm your observation. :-)


> Looking through the code of pmwiki.php:
> there are two instances of $AsSpacedFunction declared global in a
> function, without it being used:
> in functions PageVar() and FmtPageName()
> Those could probably be deleted.

No, they couldn't --there are a number of code evaluations via "eval()" or the 
regexp "/e" modifier, which may need a global declaration to work.


> Is there  a solution to point 7?

You can use a (:title...:) directive, there is also a GroupTitle and another 
GroupTitles recipes. 

But reading the instructions in the file wikiwords.php, one could think the 
setting $WikiWordCount['PmWiki'] = -1; was intended to disable the spacing of 
some words - currently it is not implemented this way.

Petko



More information about the pmwiki-users mailing list