AttentionBoxesForMoin

screenshot

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

MoinAttentionBoxes.zip

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

into your theme's CSS. (Given the common directory layout for themes, simply include in the theme's common.css the line:

Better yet, include in the theme's common.css the line:

Create the file if necessary, then add to that file the line:

Usage

To display an attention box, use:

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:

or (simpler, though less accurate):

There are also custom boxes without an icon (as proposed by OliverSiemoneit): GreenBox, BlueBox, RedBox and YellowBox. In addition, I generalized this to:

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 (C) 2007 Zoran Isailovski

Images in the package borrowed from Wikipedia:

Image

Image Source

icon-InfoBox.png

http://en.wikipedia.org/wiki/Image:Information.svg

icon-NeedsCleanup.png

http://en.wikipedia.org/wiki/Image:Broom_icon.svg

icon-NeedsRewrite.png

http://en.wikipedia.org/wiki/Image:Nuvola_apps_kwrite.png

icon-NeedsReview.png

http://en.wikipedia.org/wiki/Image:Face-glasses.svg

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)

    Just one macro for all (implemented) kinds of attention boxes - the attention type is now

    encoded into a prefix to the attention message, separated by a double colon "::". For example:

    • [[Attention(InfoBox::Hi there)]]

    This works with boxes that take extra double-color-spearated prefixes, too:
    • [[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
  • Added support for line breaks via "\n" in box messages
  • Fixed bug that caused macro calls of the form Macro (as oposed to Macro()) to fail

  • Fixed bug that showed a wrong macro name in case of an exception
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:

{ { {#!AttentionBox NeedsCleanup
The reason for cleanup
} } }

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

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

MoinMoin: AttentionBoxesForMoin (last edited 2007-10-29 19:14:32 by localhost)