Commit b9beb439 authored by Sven Franck's avatar Sven Franck Committed by Xiaowu Zhang

erp5_corporate_identity: only images with alt attribute specified will be...

erp5_corporate_identity: only images with alt attribute specified will be added to the table with images
parent 83f367b0
Pipeline #9677 passed with stage
in 0 seconds
...@@ -31,13 +31,17 @@ match_content = 'alt="(.*?)"' ...@@ -31,13 +31,17 @@ match_content = 'alt="(.*?)"'
figure_list = [] figure_list = []
figure_count = 0 figure_count = 0
figure_doubles = {} figure_doubles = {}
blank = ""
for figure in re.findall('(<img.*?/>)', document_content or ''): for figure in re.findall('(<img.*?/>)', document_content or ''):
figure_dict = {} figure_dict = {}
figure_count = figure_count + 1
# XXX swallow missing alts # no alt attribute = skip an image from being included
figure_title = re.findall(match_content, figure) or ["XXX"] figure_title = re.findall(match_content, figure) or blank
if figure_title[0] == blank:
continue
figure_count = figure_count + 1
figure_href = re.findall(match_href, figure) or [""] figure_href = re.findall(match_href, figure) or [""]
figure_id = figure_abbreviation + "-" + str(figure_count) figure_id = figure_abbreviation + "-" + str(figure_count)
figure_dict["input"] = figure figure_dict["input"] = figure
......
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