[pmwiki-users] modifying wikish renaming pages/groups scripts to update links with spaces

Alex Eftimiades alexeftimiades at gmail.com
Fri Jul 20 12:55:28 CDT 2012


This gives me errors along the lines of:

Error cannot read "Group.Page"
when it should read Group.Page With Spaces
and I get:
Error cannot "Group.Page" does not exist when it tries to read Group  
With Spaces.Page With Spaces.

How do I get it to store a variable with spaces? I tried the quotation  
marks myself before. Does this mean I installed wikish wrong?
Alex

PS: I would actually use this enough that I would eventually consider  
turning it into a page action. The reason is that I structured my wiki  
around tagging pages like categories by providing links at the top of  
the page. Then I have config.php create a page footer of everything  
linking to that page separated by group. This becomes a very  
convenient way of automatically keeping track of relevant information.


On Jul 20, 2012, at 10:46 AM, Peter Bowers wrote:

> On Fri, Jul 20, 2012 at 4:28 PM, Alex Eftimiades
> <alexeftimiades at gmail.com> wrote:
>> Yes. An example might be:
>> [[Group With Spaces/Page With Spaces]]
>
> I'm afraid there's no nice, neat, elegant way to do this.  And the
> spaces would have to be exact in order for it to work.  But something
> like this would move you in the right direction:
>
> ===(snip)===
> //Rename Page
>
> set -s OldGroup = "Group With Spaces"
> set -s OldGroupPN = "GroupWithSpaces"
> set -s OldPage = "Page With Spaces"
> set -s OldPagePN = "PageWithSpaces"
> set -s NewGroup = "New Group With Spaces"
> set -s NewGroupPN = "NewGroupWithSpaces"
> set -s NewPage = "New Page With Spaces"
> set -s NewPagePN = "NewPageWithSpaces"
> sed -i 's|${OldGroup}([./]\)?)${OldPage}|${NewGroup}$1${NewPage}|gi'
> `pagelist link=${OldGroupPN}.${OldPagePN} sep=\n`
> mv ${OldGroupPN}.${OldPagePN} ${NewGroupPN}.${NewPagePN}
> ===(snip)===
>
> If you were going to be doing this often then it might be worthwhile
> scripting the initialization of the PN variables using sed, but
> probably that won't happen too often.
>
> I suppose you could use "Group *With *Spaces" and "Page *With *Spaces"
> (note the addition of an asterisk after each space) to come up with a
> more generalized approach.  (This would make the automated
> initialization of the PN variables more difficult, but I'm leaving
> that "out of scope" right now.)
>
> I haven't actually tried this, so there may be some minor debugging
> you would need to do...
>
> -Peter




More information about the pmwiki-users mailing list