_bug011 >> TestMacroSiteStatus >> _bug018 >> _bug008 >> _bug004 

TB Wiki

Login

Category Feature in 'raw' format

This describes an implementation of the Category feature for this wiki.

== Design ==
 * MacroCategory.py - show a list of pages in a particular category
   * implement category tags, like this:
{{{
 {{Category(Tasklist,2023)}}
 {{Category(New Feature)}}
}}}

This set of macros would render a single box at the bottom of the
page that looked like this:
{{{#!YellowBox
color=lightgrey
Categories: Tasklist|2023|New Feature
}}}
Where each item was a link to a category page for that category of pages.
And 'Categories' was a link to the [[Categories]] page.
(ie 'Tasklist' would be a link to [[Category:Tasklist]].)
If no such page existed, the page is generated on demand using the
{''''''{Category(show:Tasklist)}} macro and some default text.

   * implement category reference, like this:
{{{
 {{Category(show:Tasklist)}}
}}}

This shows the pages in the Tasklist category.
This could be used inside a specific page: like the [[Category:Tasklist]] page,
after some custom text for that category.

== Implementation (todo) ==
 * create MacroCategory.py script
 * have main:
   - check if it's a 'show' or a tag instance
   - if show,
      * parse all pages for references to the indicated category tag
      * present them as a list (return html with a list of pages)
   - if tag,
      * scan page and find all categories
      * add display at bottom of page
        * add to page footer display list
          * add code to tbwiki_engine to print lines from page footer display list
            * find existing categories line, if any, and and add new tag
          * maybe see add_to_msg for inspiration
      * substitute category display for one of the macro instantiations
        * remove other macro instantiations (do this during page render)

 * create the "Categories" page
 * create a default page for use when a category page is missing
 * modify tbwiki_engine.py to convert a reference to a missing category page
   into the default category page body content (use a macro action for this?)


TBWiki engine 1.9.3 by Tim Bird