AttentionBoxesForMoin
Purpose
In Wikipedia, it is an established practice to flag pages that need some kind of attention using visually styled "message boxes" located somewhere on the page. (An example of "some kind of needed attention" is a page that needs cleanup.)
This is (the beginning of) an endeavor to employ Attention Boxes in MoinMoin.
Installation / Setup
Download
Release 0.9, see #ChangeLog |
-- ZoranIsailovski 2007-08-28 07:42:01 |
Installing The Code
Simply unpack the archive into your wiki root directory. The archive allready contains the required directory layout and should add/create the appropriate files where they belong to.
Stylesheet Setup
To use the visual styles (CSS and images), @import the supplied stylesheet
wiki/htdocs/_css/MoinAttentionBoxes/MoinAttentionBoxes.css
into your theme's CSS. (Given the common directory layout for themes, simply include in the theme's common.css the line:
@import url(../../_css/MoinAttentionBoxes/MoinAttentionBoxes.css);
Better yet, include in the theme's common.css the line:
@import url(../../_css/global.css);
Create the file if necessary, then add to that file the line:
@import url(MoinAttentionBoxes/MoinAttentionBoxes.css);
Usage
To display an attention box, use:
[[XXX(message)]]
where XXX is one of the box macros (InfoBox, NeedsReview, NeedsCleanup, NeedsRewrite).
message may contain arbitrary text and wiki markup. In addition, the character sequence "\n" is expanded to two line breaks (hence effectively causing a single paragraph break).
To list pages needing attention, use:
[[FullSearch(text:regex:\[\[Needs(Review|Cleanup|Rewrite)(\(.*\))?\]\])]]
or (simpler, though less accurate):
[[FullSearch(text:[[Needs)]]
There are also custom boxes without an icon (as proposed by OliverSiemoneit): GreenBox, BlueBox, RedBox and YellowBox. In addition, I generalized this to:
[[ColoredBox(color::message)]] <= Note the double colon
Example
I suggest creating a page PagesNeedingAttention with the following content:
#format wiki #language en #pragma section-numbers off == Examples Of Attention Boxes == [[InfoBox(This is an informative message)]] [[NeedsReview(Please check consistency and completeness!)]] [[NeedsCleanup(This is a topic mix => Split into distinct articles and interlink!)]] [[NeedsRewrite(This page is a mess!)]] == Pages Needing Attention == [[FullSearch(text:[[Needs)]]
Copyright
Copyright (C) 2007 Zoran Isailovski
Images in the package borrowed from Wikipedia:
Image |
Image Source |
|
|
|
|
|
|
|
The images are meant as samples. Feel free to replace them with your own as you see fit.
History
- 0.9
-
- Fixed a bug related to non-ascii character encodings
- 0.8
- Several code cleanups
First steps towars configurable attention boxes As a first step towars configurable attention boxes, there must be a separation between moin macros and attention types. In other words, if I needed a new kind of attention box,
there should not be a need for a new moin macro. Adding new macros was, however, mandatory, because the macro name had the attention type "encoded" in it. Now, there is an alternative:
Attention(attention_type::attention_message)
encoded into a prefix to the attention message, separated by a double colon "::". For example:
[[Attention(InfoBox::Hi there)]]
[[Attention(ColoredBox::yellow::Hi there)]]
Old-style attention boxes like InfoBox(message) are considered obsolete. They are still included in the package, but will be removed (and support seased) with version 1.0.
- 0.7
Added macros GreenBox(message), RedBox(message), BlueBox(message), YellowBox(message)
Added macro ColoredBox(color::message)
- 0.6
- Code is now reloaded at each macro invocation (so I don't need to restart the moin server upon every code change)
Found a workaround - though not a perfect one - for visual style mess up on IE. It seems, width specifications in stylesheets mess up page appearence with IE under some circumstances (seen with the monobook theme). I've removed them. The second thing was that IE did not seem to reload all CSS files, not even after a "full reload". I had to delete the cache first for the styles to show up on screen. The third thing was and still is a known issue of IE that it does not handle PNG transparency properly. I tried converting the images to GIF, but they looked ugly on both IE and Firefox. For now, I'll keep the PNG's and live with it, just as wikipedia does. If you're lucky to find images that look good on both (all?) browsers, go ahead: Change them, and/or post them here.
- 0.5
- 0.4
- Unrestricted wiki formatting support in box messages, enabling stuff like:
[[InfoBox('''__New Feature__:''' ''see PagesNeedingAttention'')]]
- 0.3
- Fixed a security hole related to XSS attacks that allowed HTML - and hence javascript - to be passed verbatim as macro argument.
- 0.2
0.1 was missing the file msgbox.css => added
- 0.1
- initial release
ToDo
I'm still gathering ideas on what to do next...
Things on my mind:
(WORKAROUND FOUND) Visual styling does not work with IE, and I just don't know why!
- (Depending on IE version the appearence is either messy or there're no styles at all?!?)
I need some help with this! Any ideas???
- I'm no expert on that, but...
maybe paste the AttentionBox.css stuff in common.css or screen.css and look whether this works.. Maybe import? is a problem..
Try the latest Moin1.6dev version (You can get it from http://hg.moinmo.in/moin/1.6/. It's a destop edition). There new hacks for IE7 have been included. Maybe it works there..
Visit the Moin developper chat. Maybe the core team can help you. You can learn a lot there.. -- OliverSiemoneit 2007-08-23 16:27:01
Thanks, Oliver. -- ZoranIsailovski 2007-08-23 21:13:20
- (Depending on IE version the appearence is either messy or there're no styles at all?!?)
Provide for wiki formatting within the box message.
DONE: Support "\n" for line breaks in attention box messages.
- Use parsers instead of macros for the boxes, i.e. something like:
{ { {#!AttentionBox NeedsCleanup The reason for cleanup } } }
This would ease writing of long messages, but I'm not sure if I want those messages to be long. (Too long messages may have the counter-effect of detracting instead of drawing attention.)( I am actually close to dropping this idea.)
Discussion
Docbook already knows this kind of stuff, it calls it admonition.
The 1.6 docbook branch has extended the docbook formatter to support admonitions. The best way to proceed would be to extend the text_html formatter to also support them (in a very similar way).
Please be more specific. -- ZoranIsailovski
see text_docbook.py search for admonition. text_html formatter should be extended in a similiar way. -- ReimarBauer 2007-08-21 12:14:07
I like this very, very much, Zoran This is urgently needed for AccessibleMoin, too: Having an easy way for users to create attentionboxes so that they do not use tables anymore like this:
Please do also have a look at BieneAward2007 and help us to achieve that goal. Thanks! |
Maybe it is a good idea to add a also some blank boxes like RedBox, GreenBox, YellowBox without any icon so that users can use this create some kind of infoboxes and attentionboxes. As far as I know, Moin 1.6 wiki parser has now also a wa to provide div-wrappers around wikicode, see http://test.wikiwikiweb.de/CommentsAsCollapseableDivs. Maybe this could also be integrated there in some way. This could also be enhanced in a way like SectionParser so position things nicely. To make infoboxes based in div fully accessible (when css is turned of or for screenreader users), see MoinMoinBugs/1.6devCommentSectionsNotAccessibleByScreenreaderOrWithCssDisabled -- OliverSiemoneit 2007-08-21 12:28:01
Jee, thanks for your ample commenting, Oliver. I'm glad if I had contributed - or will contribute - a little bit to moin's accessibility with my efforts. I'll think about your interesting suggestions (but I'm new to moin - though not at all new to python or html - so it could take some time to dive into it and figure things out.) For now I think it's no use intergrating (the code) with SectionParser, since you should be able to simply embed the attention box macro in the section. (That's another reason why I should probably keep it a macro.) -- ZoranIsailovski 2007-08-22 02:37:13
For a newbie to Moin, you are doing pretty cool and advanced stuff yet. I like very much, that you have done the attention boxes as macros. For most (normal) users (which cannot programm) I think it's easier to handle it like this than as a parser... [[RedBox(My Text)]] [[GreenBox(Blabla)]] wouldn't be bad either to have. Cheers! -- OliverSiemoneit 2007-08-22 13:41:53
Hmm... I suppose, [[RedBox(My Text)]] [[GreenBox(Blabla)]] is an expression of a desire to have a way to create new attension boxes w/o programming. I am thinking about that already...
How about [[MessageBox(color, icon, text)]] ? -- LlubNek 2007-08-31 16:33:13
Thanks for you input, Llub. Of course, such a generalization seems to be an obvious option at first, but how shall we refer to an icon? By a symbolic name, just like the Windows MessageBox function? If yes, you need to consistently pre-define all your icon types, and do it in a way that is visually/stylistically consistent with their purpose in the context of your wiki - just like
is consistent with the purpose of alerting in the context of wikipedia. But then, what about the rest of the visual appearence? What about border color, text color, about font families, styles and weights? Don't they need to be in harmony with the specific type of attention-drawing purpose? If you feel that the answer is yes, you are basically recognizing that attention semantics (a.k.a. attention types) and visual appearence can only be defined together. This is why I designed Attention(attention_type::message) the way I did. -- ZoranIsailovski 2007-09-03 19:29:19