Summary: Make >><< behave identically with other block formatting when style= is used
Created: 2007-08-06 16:59
Status: Closed - replied
Category: Bug
Assigned:
Priority: 5
Version: 2.2.0beta
OS: n/a
Description:
To assist users (principle of least surprise) blocks (of the type >><<=) formatted with wiki styles should have the same syntax as other blocks (simple tables, table directives, (:div:)s).
style - single quotes
||style='color:purple;
background-color:silver;' width=*
||content ||
|
|
style - single quotes
(:table style='color:purple;
background-color:silver;':)
(:cellnr:)content
(:tableend:)
|
|
style - single quotes
(:div style='color:purple;
background-color:silver;':)
content
(:divend:)
|
|
The fix requested is to allow the following markup
style - single quotes
>> style='color:purple;
background-color:silver;' <<
content
>><<
| %div style='color:purple; background-color:silver;' apply=div%
content
|
The following markup will actually do what you want
no style=, no quotes, no semicolons
>> color:purple
background-color:silver <<
content
>><<
|
|
But the above markup does not work consistently
no style=, no quotes, no semicolons
||color:purple background-color:silver
width=*
||content ||
|
|
no style=, no quotes, no semicolons
(:table color:purple
background-color:silver:)
(:cellnr:)content
(:tableend:)
|
|
More examples
>>rfloat width:100<<
Consistency is one of the virtues of a good user interface, particularly
when naive users are involved.
>><<
|
Consistency is one of the virtues of a good user interface, particularly when naive users are involved.
|
>>rfloat style="width:100px";<<
Consistency is one of the virtues of a good user interface, particularly
when naive users are involved.
>><<
|
%div rfloat style="width:100px"; apply=div%
Consistency is one of the virtues of a good user interface, particularly when naive users are involved.
|
Not very consistent is it
>>rfloat width:100px<<
Consistency is one of the virtues of a good user interface, particularly
when naive users are involved.
>><<
|
Consistency is one of the virtues of a good user interface, particularly when naive users are involved.
|
Discussion
>><< is a shortcut not for "div X Y" but for "div class=X style=Y". Unfortunately, it is not easy to modify now, as many people are using it this way. If we remove support for >>frame color=red<< because ||frame color=red and (:div frame color=red:) don't work, this will break existing wikis, which is against our philosophy. If we add what you suggest for >><< without removing the shortcut support, people will start asking for shortcuts in all other block markups. Both are technically difficult to implement and support.
As always, there is a workaround if you absolutely require >><< to behave exactly like (:div:) on your own wikis. Add to config.php:
Markup('^>>', '<table', '/^>>(.+?)<</', '(:div $1:)');
See the above examples at Test.00962. --Petko February 03, 2010, at 11:47 PM
Thanks. I've never seen it documented that way before. I expected
>>one a=b two c:'d'<<
to have the effect
(:div class="one two" style="a:b;c:'d';" :)
While we should not break existing wikis, we should not perpetuate inconsistencies, that is to say we should make PmWiki easier and more consistent to use, so plan to phase corrections in over time and major releases.
One way to do this is to improve the markup, perhaps by making it more specific, while supporting the older more ad hoc code
simon February 06, 2010, at 01:33 AM
Once again, I don't think the shortcut markup is inconsistent -- it is what it is, a shortcut means shorter and different way to achieve something. And I'm sure it is easier to use >>frame red<< than what you consider more consistent >>class=frame style="color:red;"<<. If you think >><< is so inconsistent and hard that your users cannot learn it, then simply don't use it. :-) --Petko February 06, 2010, at 02:05 AM
References