00962: Make >><< behave identically with other block formatting when style= is used

Summary: Make >><< behave identically with other block formatting when style= is used
Created: 2007-08-06 16:59
Status: Closed, not a bug
Category: Bug
From: simon
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  ||
content
style - single quotes
(:table style='color:purple; background-color:silver;':)
(:cellnr:)content 
(:tableend:)
content
style - single quotes
(:div style='color:purple; background-color:silver;':)
content
(:divend:)

content

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
>><<

content

But the above markup does not work consistently

no style=, no quotes, no semicolons
||color:purple background-color:silver width=*
||content  ||
content
no style=, no quotes, no semicolons
(:table color:purple background-color:silver:)
(:cellnr:)content
(:tableend:)
content

More examples

missing units, e.g. px
>>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.

>>rfloat class="tabtable frame"<<
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

>>X Y Z W<< is a shortcut not for "div X Y Z W" but for "div class=X style=Y" (:div:)%div X Y Z W apply=div%.
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', '/^&gt;&gt;(.+?)&lt;&lt;/', '(: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

I'm still tripping over this.

Question, what does >>Y Y Z<< result in, div class=X style=Y ?=Z

But its now clear how >><< could work consistently while retaining legacy shortcut >><< markup (and I'm not suggesting deimplementing support for anything)

Implement in addition
any markup within >><< of form a=b or c:d (where b or d may be quoted) to be a style, and of the form one to be a class
>>one a=b two c:'d'<<
to have the effect
(:div class="one two" style="a:b;c:'d';" :)
and also implement
class="" and style="" within >><<
>>class="" style=""<<

Note that I don't support the more formal div@ having the X Y Z shortcuts of >><<@@.

simon March 22, 2012, at 05:37 PM

I've corrected the shortcut line with the actual replacement done by stdmarkup.php. The "div class=X style=Y" only applies to the exact example markups above. --Petko

References