Simplify reversion code (keeping the same output)

This commit is contained in:
José Matos 2020-09-21 14:36:52 +01:00
parent c4acb6c5b9
commit 4419f6e059

View File

@ -3506,16 +3506,13 @@ def revert_totalheight(document):
special = m.group(1)
mspecial = special.split(',')
for spc in mspecial:
if spc[:7] == "height=":
if spc.startswith("height="):
oldheight = spc.split('=')[1]
ms = rxx.search(oldheight)
if ms:
oldval = ms.group(1)
oldunit = ms.group(2)
if len(oldval) > 1 and oldval[1] == ".":
oldval = "0" + oldval
if oldunit in list(relative_heights.keys()):
oldval = str(float(oldval) * 100)
oldval = str(float(ms.group(1)) * 100)
oldunit = relative_heights[oldunit]
oldheight = oldval + oldunit
mspecial.remove(spc)