[pmwiki-users] File names with spaces in variables

Dominique Faure dominique.faure at gmail.com
Tue Apr 5 03:06:52 PDT 2022


In fact, a name-spaced image attachment doesn't render as such when
the name comes from a variable because those are evaluated in the
context of the current page which is the only one available in PmWiki.
So, when the Attach:... markup is handled, the variable content has
already been processed into the page content and the inserted spaces
are seen as an "end of markup" separation.

When dealing with the following page content:

  ptv: aaa bbb.txt
  ...
  Attach:{$:ptv}

The markup rules apply one after the other on it, transforming the page to:

  ptv: aaa bbb.txt
  ...
  Attach:aaa bbb.txt

Which results to:

  ptv: aaa bbb.txt
  ...
  <Resulting HTML of handling of Attach:aaa> bbb.txt

The solution here would be to provide a protected/encapsulated
variable content such as:

  Attach:[=aaa bbb.txt=]

But since the regular PmWiki's content protection markup is acting
before the variable evaluation while rendering the page, the
encapsulation should occur earlier, therefore:

  ptv: [=aaa bbb.txt=]
  ...
  Attach:{$:ptv}

Should do the trick.

On Tue, Apr 5, 2022 at 6:26 AM Simon <nzskiwi at gmail.com> wrote:
>
> Thanks for the examples
>
> Attach:{$:gifPTVspaced}
>
>
> is the problem.
>
>
> But longer story:
>
> the problem arose because the Site.ImageTemplate page I created stopped working (I haven't got to the bottom of that yet).
>
>
> It turns out I was debugging the default-default image page template generated by thumblist2-actions.php (after searching for the strong "Back to Gallery")
>
>
> there is a line in there -
>
> %p center% {*$PrevLink} [[{*$FullName}?action=browse | $[Back to gallery] ]] {*$NextLink}\\\\
>
> Attach:{*$UpDirUpFile}
>
>
> but my ImageTemplate also has the same problem
>
>
> ngā mihi
>
>
> Simon
>
>
>
> On Mon, 4 Apr 2022 at 22:46, Dominique Faure <dominique.faure at gmail.com> wrote:
>>
>> Cf. https://www.pmwiki.org/wiki/Test/AttachWithSpaces
>>
>> What is the exact challenge?
>>
>> On Mon, Apr 4, 2022 at 11:26 AM Simon <nzskiwi at gmail.com> wrote:
>> >
>> > We now have the cool markup Attach:[=some file name with spaces=]
>> > but I have a challenge when the file name is already in a variable, e,g,
>> >
>> >     [[Attach:{*$UpDirUpFile} | download]]
>> >
>> > Does anyone have any suggestions for how I can solve this?
>> >
>> > ngā mihi
>> >
>> > Simon
>> > _______________________________________________
>> > pmwiki-users mailing list
>> > pmwiki-users at pmichaud.com
>> > http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list