[pmwiki-users] Wikiwords and style identifiers bug and workaround
Pico
pmwiki at ben-amotz.com
Wed Aug 9 19:07:59 CDT 2006
John Rankin wrote:
> On Thursday, 10 August 2006 4:18 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>> On Wed, Aug 09, 2006 at 01:19:18AM -0400, Pico wrote:
>>> John Rankin wrote:
>>>> On Wednesday, 9 August 2006 1:43 PM, Pico <pmwiki at ben-amotz.com> wrote:
>>>>> Dominique Faure wrote:
>>>>>> Developing a new cookbook recipe involving divs, my kindly beta-tester
>>>>>> found that using a Wikiword as a style identifier breaks the page
>>>>>> output.
>> Yes, this is arguably a bug. I don't have a simple fix at the moment.
>> One possibility would be to say that '=' (for ids) and '#' (for colors)
>> prevent the following sequence of characters from being treated as
>> wikiwords.
>>
>>>> What happens if you "escape" the wikiword?
>>>>
>>>>>> id='`MyDiv'<<
>>>> Fromm memory, the `MyDiv will be put in a Keep and restored in time
>>>> for style processing.
>>> It breaks every way that I have tested it:
>>> >>id='`Mydiv'<<
>>> >>id=`'Mydiv'<<
>>> >>id=`Mydiv<<
>>> >>`Mydiv<<
>>>
>>> I'm not sure how it works.
>> The ` does escape the wikiword, but unfortunately the escape characters
>> embedded in the string prevent the id from being recognized as a valid
>> wikistyle.
>
> I think I have another possible solution.
>
> First, in the above examples, it has to be MyDiv as Mydiv is not a
> wikiword, so ` has no effect.
Right, my mistake. See below for new examples.
>
> Second, >>`MyDiv<< indeed does not work as one might have expected,
> producing %div MyDiv apply=div%
>
Correct.
> However, the markup extensions recipe lets you escape a wikiword in
> the middle: >>My`Div<< simply removes the ` after link processing,
> so style processing then "just works". The above produces
> <div class='MyDiv' >, which is correct.
For completeness, here is a list of 6 examples, showing the underlying
markup, the displayed results, and the html source:
Markup entered:
>>id='`MyDiv'<<
1
>><<
>>id='My`Div'<<
2
>><<
>>id=`'MyDiv'<<
3
>><<
>>id=`MyDiv<<
4
>><<
>>`MyDiv<<
5
>><<
>> `MyDiv<<
6
>><<
Displayed results:
%div id='MyDiv' apply=div%
1
%div id='My`Div' apply=div%
2
%div id=`'MyDiv' apply=div%
3
%div id=MyDiv apply=div%
4
%div MyDiv apply=div%
5
%div MyDiv apply=div%
6
html source:
<div >%div id='MyDiv' apply=div%
<p>1
</p></div>
<div >%div id='My`Div' apply=div%
<p>2
</p></div>
<div >%div id=`'<span class='wikiword'>MyDiv</span>' apply=div%
<p>3
</p></div>
<div >%div id=MyDiv apply=div%
<p>4
</p></div>
<div >%div MyDiv apply=div%
<p>5
</p></div>
<div >%div MyDiv apply=div%
<p>6
</p></div>
>> Which leaves us with the bug. I'm still thinking that perhaps the
>> best solution would be to say that a wikiword cannot immediately
>> follow a '#' or '=' (and perhaps ':' as well).
>
> Do you mean "and perhaps ';' as well"? Presumably, the following
> should be valid: >>MyDiv<<, which will be >>MyDiv<<.
>
> I don't really understand why the >>`MyDiv<< trick doesn't work.
> The >>...<< markup is clearly being translated correctly and
> according to wikistyles.php, it will "restore links before
> applying styles". So by the time it reaches wikistyles, the
> above should read %div MyDiv apply=div% and it should work as
> expected. Clearly I am missing something obvious.
>
> So in my view, the bug is that >>`MyDiv<< doesn't work the way
> one might reasonably expect from the specification of `WikiWord
> markup.
>
Pico
More information about the pmwiki-users
mailing list