PDF tables: fix mix tags/Platypus markup

This commit is contained in:
Emmanuel Viennet 2022-03-10 19:36:30 +01:00
parent 462c084bf4
commit 5a56138e55

View File

@ -63,12 +63,15 @@ from app.scodoc.sco_pdf import SU
from app import log
def mark_paras(L, tags):
"""Put each (string) element of L between <b>"""
def mark_paras(L, tags) -> list[str]:
"""Put each (string) element of L between <tag>...</tag>,
for each supplied tag.
Leave non string elements untouched.
"""
for tag in tags:
b = "<" + tag + ">"
c = "</" + tag.split()[0] + ">"
L = [b + (x or "") + c for x in L]
start = "<" + tag + ">"
end = "</" + tag.split()[0] + ">"
L = [(start + (x or "") + end) if isinstance(x, str) else x for x in L]
return L