Description
Add to WikiConfigHelp macro some functionality to customize its look. It is needed for example for HelpOnXapian, HelpOnOpenIDProvider, HelpOnConfiguration, and HelpOnAccessControlLists where first level headers break page structure.
The macro currently generates silly output for HelpOnXapian, HelpOnOpenIDProvider, and HelpOnAccessControlLists. For example, the first line generated by the macro on the HelpOnXapian page says: Configuration of the Xapian based indexed search, see HelpOnXapian. Using show_descriptions=False on the above 3 pages will eliminate this.
Since Moin 1.5, a better default heading_level would be 2 rather than 1. The 4 pages above are the only pages that use the macro on 1.9 moin master and moinmo.in and all 4 require H2 headings. I changed the default from 1 to 2 on the patch below. If you disagree, change it back. Modified patch tested on my moin 1.9.2 test system -- works fine. -- RogerHaase 2010-04-02 15:11:46
While I still feel the default level should be h2, it doesn't matter. After fixing the 4 pages in 1.9 moin master, I found HelpOnConfiguration needs h3 headings, the other 3 pages work better with show_heading=False. -- RogerHaase 2010-04-02 16:57:30
Patch
This patch add ability to configure displaying and level of headers and displaying of descriptions.
1 --- /data/programs/moin-1.9.0rc2/MoinMoin/macro/WikiConfigHelp.old.py 2009-11-29 21:39:40.000000000 +0300
2 +++ /data/programs/moin-1.9.0rc2/MoinMoin/macro/WikiConfigHelp.py 2009-11-29 21:43:10.000000000 +0300
3 @@ -7,7 +7,7 @@
4 Dependencies = ['user'] # table headings are translated to user language
5 generates_headings = True
6
7 -def macro_WikiConfigHelp(macro, section=None):
8 +def macro_WikiConfigHelp(macro, section=None, show_heading=True, show_descriptions=True, heading_level=2):
9 request = macro.request
10 _ = request.getText
11 f = macro.request.formatter
12 @@ -25,13 +25,15 @@
13
14 for groupname, addgroup, optsdict in groups:
15 heading, desc, opts = optsdict[groupname]
16 - ret.extend([
17 - f.heading(1, 1, id=groupname),
18 - ## XXX: translate description?
19 - f.text(heading),
20 - f.heading(0, 1),
21 - ])
22 - if desc:
23 + if show_heading:
24 + ret.extend([
25 + f.heading(1, heading_level, id=groupname),
26 + ## XXX: translate description?
27 + f.text(heading),
28 + f.heading(0, heading_level),
29 + ])
30 +
31 + if desc and show_descriptions:
32 ret.extend([
33 f.paragraph(1),
34 f.text(desc),
Implemented in [http://hg.moinmo.in/moin/1.9/rev/516d165c4bbf].