annotate MoinMoin/macro/WikiConfigHelp.py @ 4468:fad2936d33a7 1.8.1

added dummy mig script for 1.8.1, bumped version number
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 24 Dec 2008 16:32:46 +0100
parents 5ee5b69eefdc
children 5155ed62a9c5
rev   line source
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
2 """
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
3 MoinMoin - Wiki Configuration Help
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
4 """
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
5 from MoinMoin.config import multiconfig
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
6
4464
5ee5b69eefdc fix Dependencies of WikiConfig/WikiConfigHelp macro
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3791
diff changeset
7 Dependencies = ['user'] # table headings are translated to user language
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
8 generates_headings = True
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
9
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
10 def macro_WikiConfigHelp(macro):
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
11 request = macro.request
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
12 _ = request.getText
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
13 f = macro.request.formatter
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
14 ret = []
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
15
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
16 groups = []
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
17 for groupname in multiconfig.options:
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
18 groups.append((groupname, True, multiconfig.options))
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
19 for groupname in multiconfig.options_no_group_name:
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
20 groups.append((groupname, False, multiconfig.options_no_group_name))
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
21 groups.sort()
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
22
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
23 for groupname, addgroup, optsdict in groups:
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
24 heading, desc, opts = optsdict[groupname]
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
25 ret.extend([
3745
08dd5b1a1f1c wiki config help macro: add id to headings so TOC can pick them up
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3744
diff changeset
26 f.heading(1, 1, id=groupname),
3743
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
27 ## XXX: translate description?
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
28 f.text(heading),
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
29 f.heading(0, 1),
3744
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
30 ])
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
31 if desc:
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
32 ret.extend([
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
33 f.paragraph(1),
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
34 f.text(desc),
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
35 f.paragraph(0)
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
36 ])
1eabe89b773b add longer group help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3743
diff changeset
37 ret.extend([
3743
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
38 f.table(1),
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
39 f.table_row(1),
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
40 f.table_cell(1), f.strong(1), f.text(_('Variable name')), f.strong(0), f.table_cell(0),
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
41 f.table_cell(1), f.strong(1), f.text(_('Default')), f.strong(0), f.table_cell(0),
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
42 f.table_cell(1), f.strong(1), f.text(_('Description')), f.strong(0), f.table_cell(0),
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
43 f.table_row(0),
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
44 ])
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
45 opts = list(opts)
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
46 opts.sort()
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
47 for name, default, description in opts:
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
48 if addgroup:
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
49 name = groupname + '_' + name
3748
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3745
diff changeset
50 if isinstance(default, multiconfig.DefaultExpression):
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3745
diff changeset
51 default_txt = default.text
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3745
diff changeset
52 else:
dc917a577d38 add multiconfig.DefaultExpression for documentation
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3745
diff changeset
53 default_txt = '%r' % (default, )
3791
7f43f5c38310 WikiConfigHelp macro: hide default already at 30 characters, use span to show on mouse hover
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3788
diff changeset
54 if len(default_txt) <= 30:
7f43f5c38310 WikiConfigHelp macro: hide default already at 30 characters, use span to show on mouse hover
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3788
diff changeset
55 default_txt = f.text(default_txt)
7f43f5c38310 WikiConfigHelp macro: hide default already at 30 characters, use span to show on mouse hover
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3788
diff changeset
56 else:
7f43f5c38310 WikiConfigHelp macro: hide default already at 30 characters, use span to show on mouse hover
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3788
diff changeset
57 default_txt = f.span(1, title=default_txt) + f.text('...') + f.span(0)
3788
8ddd2b1c49b4 WikiConfigHelp: translate and mark up descriptions
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3765
diff changeset
58 description = _(description or '', wiki=True)
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
59 ret.extend([
3743
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
60 f.table_row(1),
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
61 f.table_cell(1), f.text(name), f.table_cell(0),
3791
7f43f5c38310 WikiConfigHelp macro: hide default already at 30 characters, use span to show on mouse hover
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3788
diff changeset
62 f.table_cell(1), f.code(1, css="backtick"), default_txt, f.code(0), f.table_cell(0),
3788
8ddd2b1c49b4 WikiConfigHelp: translate and mark up descriptions
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3765
diff changeset
63 f.table_cell(1), description, f.table_cell(0),
3743
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
64 f.table_row(0),
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
65 ])
3743
49144c908411 wiki config help: table-view like HelpOnConfiguration has
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 3742
diff changeset
66 ret.append(f.table(0))
3742
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
67
9f60d7f5487a add example macro to print out all settings + help text
Johannes Berg <johannes AT sipsolutions DOT net>
parents:
diff changeset
68 return ''.join(ret)