Commit a20ab6d3 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Cédric Le Ninivin

erp5_corporate_identity: make sure header list has element before access

parent a4141769
...@@ -9,11 +9,13 @@ def pushDown(level): ...@@ -9,11 +9,13 @@ def pushDown(level):
return ''.join(["h", str(level), ">"]) return ''.join(["h", str(level), ">"])
for header in re.findall("<h[1-6].*</h[1-6]>", content or ""): for header in re.findall("<h[1-6].*</h[1-6]>", content or ""):
tag = re.findall("<(h[1-6]>)", header)[0] #h2> header_list = re.findall("<(h[1-6]>)", header)
key = tag[1] if len(header_list):
content = content.replace( tag = header_list[0] #h2>
header, key = tag[1]
header.replace(tag, pushDown(int(key) + (downgrade or 1))) content = content.replace(
) header,
header.replace(tag, pushDown(int(key) + (downgrade or 1)))
)
return content return content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment