| t | This describes an implementation of the Category feature for this wiki. | t | |
| <p> | | |
| <h2><a name="Design">Design</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/Category_Feature?action=edit§ion=Design">edit section</a>]</font></span> | | |
| </h2> | | |
| <ul><li>MacroCategory.py - show a list of pages in a particular category | | |
| <ul><li>implement category tags, like this: | | |
| <pre> | | |
| {{Category(Tasklist,2023)}} | | |
| {{Category(New Feature)}} | | |
| </pre> | | |
| </ul> | | |
| </ul> | | |
| <p> | | |
| This set of macros would render a single box at the bottom of the | | |
| page that looked like this: | | |
| <ul><div style="background-color:lightgrey; padding:5px; border-style: solid solid solid solid; border-width: 1px 1px 1px 1px;"> | | |
| <pre>Categories: Tasklist|2023|New Feature</pre></div></ul> | | |
| | | |
| Where each item was a link to a category page for that category of pages. | | |
| And 'Categories' was a link to the <a style="color:red;" href="/tbwiki/Categories">Categories</a> page. | | |
| (ie 'Tasklist' would be a link to <a style="color:red;" href="/tbwiki/Category:Tasklist">Category:Tasklist</a>.) | | |
| If no such page existed, the page is generated on demand using the | | |
| {<b></b>{Category(show:Tasklist)}} macro and some default text. | | |
| <p> | | |
| <ul><li>implement category reference, like this: | | |
| <pre> | | |
| {{Category(show:Tasklist)}} | | |
| </pre> | | |
| </ul> | | |
| <p> | | |
| This shows the pages in the Tasklist category. | | |
| This could be used inside a specific page: like the <a style="color:red;" href="/tbwiki/Category:Tasklist">Category:Tasklist</a> page, | | |
| after some custom text for that category. | | |
| <p> | | |
| <h2><a name="Implementation_(todo)">Implementation (todo)</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/Category_Feature?action=edit§ion=Implementation_(todo)">edit section</a>]</font></span> | | |
| </h2> | | |
| <ul><li>create MacroCategory.py script | | |
| <li>have main: | | |
| <ul><li>check if it's a 'show' or a tag instance | | |
| <li>if show, | | |
| <ul><li>parse all pages for references to the indicated category tag | | |
| <li>present them as a list (return html with a list of pages) | | |
| </ul><li>if tag, | | |
| <ul><li>scan page and find all categories | | |
| <li>add display at bottom of page | | |
| <ul><li>add to page footer display list | | |
| <ul><li>add code to tbwiki_engine to print lines from page footer display list | | |
| <ul><li>find existing categories line, if any, and and add new tag | | |
| </ul><li>maybe see add_to_msg for inspiration | | |
| </ul></ul><li>substitute category display for one of the macro instantiations | | |
| <ul><li>remove other macro instantiations (do this during page render) | | |
| </ul> | | |
| </ul> | | |
| </ul> | | |
| </ul> | | |
| <p> | | |
| <ul><li>create the "Categories" page | | |
| <li>create a default page for use when a category page is missing | | |
| <li>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?) | | |
| </ul> | | |
| <p> | | |