00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 import sys
00011 import re
00012 try:
00013 from MoinMoin import wikiutil
00014 except:
00015 sys.stderr.write("Cannot import MoinMoin, for testing only\n")
00016
00017 Dependencies = []
00018
00019
00020 from macroutils import distro_names as distros
00021
00022 if 'boxturtle' in distros:
00023 distros.remove('boxturtle')
00024 if 'unstable' in distros:
00025 distros.remove('unstable')
00026
00027 def execute(macro, args):
00028
00029 if args:
00030 version = str(args)
00031 if version.lower() in ['fuerte', 'groovy']:
00032 return '<span style="background-color:#FFFF00; font-weight:bold; padding: 3px;">Expected in Electric Turtle (unstable)</span>'
00033 else:
00034 return '<span style="background-color:#FFFF00; font-weight:bold; padding: 3px;">New in %s</span>'%version
00035
00036 def distro_html(distro, distros):
00037 active = [distro.encode("iso-8859-1")]
00038 inactive = [x.encode("iso-8859-1") for x in distros if not x == distro]
00039 sectionarg = '''{show:%s, hide:%s}''' %(active, inactive)
00040 html = '''<button id="%s" onClick="Version(%s);this.style.color='#e6e6e6';this.style.background='#3e4f6e';
00041 document.getElementById('%s').style.background='#e6e6e6';document.getElementById('%s').style.color='#3e4f6e';
00042 document.getElementById('%s').style.background='#e6e6e6';document.getElementById('%s').style.color='#3e4f6e';
00043 return false"> %s </button>'''%(distro, sectionarg, inactive[0], inactive[0], inactive[1], inactive[1], distro)
00044 return html
00045
00046 html = "\n".join([distro_html(distro, distros) for distro in distros])
00047 return macro.formatter.rawHTML(html)
00048