Commit 9c79cde0 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Sven Franck

erp5_corporate_identity: make sure header list has element before access

parent c3304c6f
......@@ -9,11 +9,13 @@ def pushDown(level):
return ''.join(["h", str(level), ">"])
for header in re.findall("<h[1-6].*</h[1-6]>", content or ""):
tag = re.findall("<(h[1-6]>)", header)[0] #h2>
key = tag[1]
content = content.replace(
header,
header.replace(tag, pushDown(int(key) + (downgrade or 1)))
)
header_list = re.findall("<(h[1-6]>)", header)
if len(header_list):
tag = header_list[0] #h2>
key = tag[1]
content = content.replace(
header,
header.replace(tag, pushDown(int(key) + (downgrade or 1)))
)
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