-
Notifications
You must be signed in to change notification settings - Fork 19
/
Version.py
62 lines (48 loc) · 1.67 KB
/
Version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# To change the set of active distros:
# 1) Change which distro is opened by default in custom/js/rosversion.js
#
# 2) Restart the server
# Still TODO:
# - Display which distro is active under the buttons so people know default,
# and know if their action took effect
# - Have better error-reporting somehow if rosversion sections have typos
# (maybe show all distros that aren't listed as hidden, so that a mistyped
# distro will always be visible?)
# - Automatically label the sections as "c-turtle only" so people see the
# changes?
"""
Example:
<<Version()>>
{{{#!wiki version fuerte_and_older
This is fuerte and older
}}}
{{{#!wiki version groovy
This is groovy
}}}
{{{#!wiki version hydro_and_newer
This is hydro and newer
}}}
"""
from headers import distro_html
Dependencies = []
# configure the active set of distros
from macroutils import distro_names as distros
if 'boxturtle' in distros:
distros.remove('boxturtle')
if 'unstable' in distros:
distros.remove('unstable')
def execute(macro, args):
if args:
version = str(args)
if version.lower() == 'lunar':
return ('<span style="background-color:#FFFF00; '
'font-weight:bold; padding: 3px;">'
'Expected in Lunar</span>')
else:
return ('<span style="background-color:#FFFF00; '
'font-weight:bold; padding: 3px;">'
'New in %s</span>' % version)
html = '<span id="rosversion_selector" class="btn-group">\n'
html += "\n".join([distro_html(distro, distros) for distro in distros])
html += '\n</span>'
return macro.formatter.rawHTML(html)