mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 16:04:16 +00:00
Merge pull request #23 from groggydice/rgb
append pango code to message about color spec requiring manual fix
This commit is contained in:
commit
ce8e60bdda
@ -782,8 +782,16 @@ def pangoize(message, filename, line):
|
||||
amper = message.find('&')
|
||||
if message[amper:amper+1].isspace():
|
||||
message = message[:amper] + "&" + message[amper+1:]
|
||||
if re.search("<[0-9]+,[0-9]+,[0-9]+>", message):
|
||||
print '"%s", line %d: color spec in line requires manual fix.' % (filename, line)
|
||||
rgb = re.search("(?:<|<)([0-9]+),([0-9]+),([0-9]+)(>|>)", message)
|
||||
if rgb:
|
||||
r = int(rgb.group(1))
|
||||
g = int(rgb.group(2))
|
||||
b = int(rgb.group(3))
|
||||
if ( r or g or b) > 255:
|
||||
print '"%s", line %d: RGB color value over 255 requires manual fix (%s).' % (filename, line, rgb.group())
|
||||
else:
|
||||
hexed = hex(r).replace('0x', '0')[-2:] + hex(g).replace('0x', '0')[-2:] + hex(b).replace('0x', '0')[-2:]
|
||||
print '"%s", line %d: color spec (%s) requires manual fix (<span color=\'#%s\'>, </span>).' % (filename, line, rgb.group(), hexed)
|
||||
# Hack old-style Wesnoth markup
|
||||
for (oldstyle, newstart, newend) in pango_conversions:
|
||||
if oldstyle not in message:
|
||||
|
Loading…
x
Reference in New Issue
Block a user