Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.macro.WikiConfigHelp Namespace Reference

Functions

def macro_WikiConfigHelp

Variables

list Dependencies = ['user']
 generates_headings = True

Function Documentation

def MoinMoin.macro.WikiConfigHelp.macro_WikiConfigHelp (   macro,
  section = None 
)

Definition at line 10 of file WikiConfigHelp.py.

00010 
00011 def macro_WikiConfigHelp(macro, section=None):
00012     request = macro.request
00013     _ = request.getText
00014     f = macro.request.formatter
00015     ret = []
00016 
00017     groups = []
00018     if section and section in multiconfig.options:
00019         groups.append((section, True, multiconfig.options))
00020     else:
00021         for groupname in multiconfig.options:
00022             groups.append((groupname, True, multiconfig.options))
00023         for groupname in multiconfig.options_no_group_name:
00024             groups.append((groupname, False, multiconfig.options_no_group_name))
00025     groups.sort()
00026 
00027     for groupname, addgroup, optsdict in groups:
00028         heading, desc, opts = optsdict[groupname]
00029         ret.extend([
00030             f.heading(1, 1, id=groupname),
00031             ## XXX: translate description?
00032             f.text(heading),
00033             f.heading(0, 1),
00034         ])
00035         if desc:
00036             ret.extend([
00037                 f.paragraph(1),
00038                 f.text(desc),
00039                 f.paragraph(0)
00040             ])
00041         ret.extend([
00042             f.table(1),
00043             f.table_row(1, style="background-color: #ffffcc"),
00044             f.table_cell(1), f.strong(1), f.text(_('Variable name')), f.strong(0), f.table_cell(0),
00045             f.table_cell(1), f.strong(1), f.text(_('Default')), f.strong(0), f.table_cell(0),
00046             f.table_cell(1), f.strong(1), f.text(_('Description')), f.strong(0), f.table_cell(0),
00047             f.table_row(0),
00048         ])
00049         opts = list(opts)
00050         opts.sort()
00051         for name, default, description in opts:
00052             if addgroup:
00053                 name = groupname + '_' + name
00054             if isinstance(default, multiconfig.DefaultExpression):
00055                 default_txt = default.text
00056             else:
00057                 default_txt = '%r' % (default, )
00058                 if len(default_txt) <= 30:
00059                     default_txt = f.text(default_txt)
00060                 else:
00061                     default_txt = f.span(1, title=default_txt) + f.text('...') + f.span(0)
00062                 description = _(description or '', wiki=True)
00063             ret.extend([
00064                 f.table_row(1),
00065                 f.table_cell(1), f.text(name), f.table_cell(0),
00066                 f.table_cell(1), f.code(1, css="backtick"), default_txt, f.code(0), f.table_cell(0),
00067                 f.table_cell(1), description, f.table_cell(0),
00068                 f.table_row(0),
00069             ])
00070         ret.append(f.table(0))
00071 
00072     return ''.join(ret)

Variable Documentation

Definition at line 7 of file WikiConfigHelp.py.

Definition at line 8 of file WikiConfigHelp.py.