00962: Make >><< behave identically with other block formatting when style= is used
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).
- see Test.StyleClass
||style='color:purple; background-color:silver;' width=* ||content || |
|
(:table style='color:purple; background-color:silver;':) (:cellnr:)content (:tableend:) |
|
(:div style='color:purple; background-color:silver;':) content (:divend:) | content |
The fix requested is to allow the following markup
>> 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
>> color:purple background-color:silver << content >><< | content |
But the above markup does not work consistently
||color:purple background-color:silver width=* ||content || |
|
(: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. |
>>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', '/^>>(.+?)<</', '(: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
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.
>>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)
>><<
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'<<
(:div class="one two" style="a:b;c:'d';" :)
class=""
and style=""
within >><<
Note that I don't support the more formal div@ having the
X Y Z shortcuts of
>><<@@.
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
- PmWiki.Wiki Styles - Modifying the style of page contents
- PmWiki.Page Directives - Directives to specify page titles, descriptions, keywords, and display
- Table Directives - Directives for table processing
- PmWiki.Tables - Simple tables with double pipe markup, one row per line
- 00860 - Add min and max width and height, clear; to table, div, block, and style directives