Mercurial > moin > 1.9
view MoinMoin/i18n/tools/markup15to16.py @ 3051:b1e7d968330d
i18n tools: fix small bugs (ported from 1.6)
author | Reimar Bauer <rb.proj AT googlemail DOT com> |
---|---|
date | Tue, 19 Feb 2008 23:30:04 +0100 |
parents | b551fc405222 |
children |
line wrap: on
line source
#!/usr/bin/python """ convert some markup contained in po files to new link/macro markup """ DOMAIN = "MoinMoin" import re import sys import codecs def run(): sys.path.insert(0, '../..') lang = sys.argv[1] f = codecs.open("%s.%s.po" % (lang, DOMAIN), "r", "utf-8") text = f.read() f.close() # replace [[Macro(...)]] by <<Macro(...)>> macro_rule = r"\[\[(?P<macro>.*?)\]\]" macro_repl = r"<<\g<macro>>>" macro_re = re.compile(macro_rule, re.U|re.M|re.S) text = macro_re.sub(macro_repl, text) #print repr(text) f = codecs.open("%s.%s.po" % (lang, DOMAIN), "w", "utf-8") f.write(text) f.close() if __name__ == "__main__": run()