[Moin-user] how can I use Categories for quality assurance?

Robert Schumann robert at cantab.net
Wed Jul 12 08:23:08 EDT 2006


On Wed, 2006-07-12 at 13:53 +0200, Thomas Waldmann wrote:
> >>> So, what I'd like to see is:
> >>>
> >>> 1. User marks page as CategoryVersion1.0
> >>> 2. Page then automatically contains a little box at the top which says
> >>> something like "This page applies to Version 1.0 of SoftwareName"
> >>>   
> >>>       
> >> Category links are usually rendered as standard links, so they neither 
> >> have special styling (just like other links), nor auto-generated content.
> >>
> >> A thing that maybe could be of general use is some configurable page 
> >> name pattern matching and deriving a CSS class attribute depending on 
> >> what pattern matched the target page name.
> >>
> >> By defining CSS for that class, you could make your boxes, style and 
> >> alignment.
> >> I guess you could even define some content using :after or :before (of 
> >> course that won't work with IE6).
> >>     
> >
> > I have to say that I didn't understand much about this, but it sounds
> > like it would require the page name being the trigger for the
> > auto-generated content, rather than the category that a page is tagged
> > with... Did I misunderstand?
> >   
> Yes, you misunderstood. I meant hacking that part of the wiki parser and 
> then match the link target page against some patterns influencing the 
> CSS class it will get.
> > Would it be impossible for the Category feature to be extended so as to
> > include auto-generated content?
> Currently, there is no such thing as a "category feature" as far as the 
> page content or links are concerned - they are just links to other pages.
> 
> The only special thing we have about categories is maybe this dropdown 
> menu, but this only adds those links to the end of the page, you also 
> could type them in manually.
> 
> > Or perhaps I am looking at this problem
> > from the wrong direction, and should think about some way for a macro to
> > be used which would include the relevant text on the page, and
> > automatically add the category... and maybe hope that such a macro could
> > be included on the page via a drop down menu.
> >   
> This also would be a special hack.
> 
> I guess the first method (matching link targets and generating css 
> class) would be a more generically useful thing. We even already do 
> something in that area, e.g. ftp link targets get a different icon than 
> http link targets. But this is not yet configurable enough for your needs.

The parsers in Moin are responsible for any magic you see happening -
the translation of markdown and other special syntax to whatever format
you want it in.  So what Thomas is saying, I think, is that you add a
function in your parser that gets triggered by the word Category, in the
same way that the parser treats http:// differently from ftp://. 

So you would have a predefined mapping in your parser like
categoryparser = { 'Version1.0':'This doc applies to version 1.0',
   'NeedsWork':'This page needs work'}
and then perhaps your page formatter could do something like replace
CategoryVersion1.0 with the text "CategoryVersion1.0 This doc applies to
version 1.0'.

(Please excuse; this is my rough understanding of the moin engine...)

How about the following proposal, which may be against the spirit of
simplicity in MoinMoin:
Any Category page may contain some special markup on it, perhaps a
preformatted piece of text, like
{{{This doc applies to version 1.0.}}}
Then while processing page ExamplePage, if the parser finds
CategoryVersion1.0 on it, the formatter pulls this marked up text out of
the CategoryVersion1.0 page and inserts it wherever you want it.

That way, you get descriptive category headings for pages but are not
limited to using a predefined set of categories.  This is similar in
spirit to the idea of using group pages for access control.

Robert.





More information about the Moin-user mailing list