Fix: <br> pour ReportrLab pdf

This commit is contained in:
Emmanuel Viennet 2022-10-03 08:37:29 +02:00
parent 37a8b3bb0b
commit 036ce650c6
4 changed files with 19 additions and 18 deletions

View File

@ -517,18 +517,19 @@ def _make_table_notes(
hh += "s"
hh += ", %d en attente." % (nb_att)
pdf_title = "<br> BORDEREAU DE SIGNATURES"
pdf_title += "<br><br>%(titre)s" % sem
pdf_title += "<br>(%(mois_debut)s - %(mois_fin)s)" % sem
# Attention: ReportLab supporte seulement '<br/>', pas '<br>' !
pdf_title = "<br/> BORDEREAU DE SIGNATURES"
pdf_title += "<br/><br/>%(titre)s" % sem
pdf_title += "<br/>(%(mois_debut)s - %(mois_fin)s)" % sem
pdf_title += " semestre %s %s" % (
sem["semestre_id"],
sem.get("modalite", ""),
)
pdf_title += f"<br>Notes du module {module.code} - {module.titre}"
pdf_title += "<br>Evaluation : %(description)s " % e
pdf_title += f"<br/>Notes du module {module.code} - {module.titre}"
pdf_title += "<br/>Évaluation : %(description)s " % e
if len(e["jour"]) > 0:
pdf_title += " (%(jour)s)" % e
pdf_title += "(noté sur %(note_max)s )<br><br>" % e
pdf_title += "(noté sur %(note_max)s )<br/><br/>" % e
else:
hh = " %s, %s (%d étudiants)" % (
E["description"],

View File

@ -1008,7 +1008,7 @@ class BasePreferences(object):
(
"PV_LETTER_DIPLOMA_SIGNATURE",
{
"initvalue": """Le %(DirectorTitle)s, <br>%(DirectorName)s""",
"initvalue": """Le %(DirectorTitle)s, <br/>%(DirectorName)s""",
"title": """Signature des lettres individuelles de diplôme""",
"explanation": """%(DirectorName)s et %(DirectorTitle)s remplacés""",
"input_type": "textarea",
@ -1020,8 +1020,8 @@ class BasePreferences(object):
(
"PV_LETTER_PASSAGE_SIGNATURE",
{
"initvalue": """Pour le Directeur de l'IUT<br>
et par délégation<br>
"initvalue": """Pour le Directeur de l'IUT<br/>
et par délégation<br/>
Le Chef du département""",
"title": """Signature des lettres individuelles de passage d'un semestre à l'autre""",
"explanation": """%(DirectorName)s et %(DirectorTitle)s remplacés""",
@ -1056,7 +1056,7 @@ class BasePreferences(object):
<para leftindent="%(pv_htab1)s">%(codepostaldomicile)s %(villedomicile)s</para>
<para spaceBefore="25mm" fontSize="14" alignment="center">
<b>Jury de %(type_jury)s <br> %(titre_formation)s</b>
<b/>Jury de %(type_jury)s <br/> %(titre_formation)s</b>
</para>
<para spaceBefore="10mm" fontSize="14" leftindent="0">
@ -1499,7 +1499,7 @@ class BasePreferences(object):
"bul_pdf_sig_left",
{
"initvalue": """<para>La direction des études
<br>
<br/>
%(responsable)s
</para>
""",
@ -1515,7 +1515,7 @@ class BasePreferences(object):
"bul_pdf_sig_right",
{
"initvalue": """<para>Le chef de département
<br>
<br/>
%(ChiefDeptName)s
</para>
""",

View File

@ -341,10 +341,10 @@ def _simulate_br(paragraph_txt: str, para="<para>") -> str:
"""Reportlab bug turnaround (could be removed in a future version).
p is a string with Reportlab intra-paragraph XML tags.
Replaces <br> (currently ignored by Reportlab) by </para><para>
Also replaces <br> by <br>
Also replaces <br> by <br/>
"""
return ("</para>" + para).join(
re.split(r"<.*?br.*?/>", paragraph_txt.replace("<br>", "<br>"))
re.split(r"<.*?br.*?/>", paragraph_txt.replace("<br>", "<br/>"))
)
@ -515,7 +515,7 @@ def pdf_lettre_individuelle(sem, decision, etud: Identite, params, signature=Non
params.update(decision["identite"])
# fix domicile
if params["domicile"]:
params["domicile"] = params["domicile"].replace("\\n", "<br>")
params["domicile"] = params["domicile"].replace("\\n", "<br/>")
# UE capitalisées:
if decision["decisions_ue"] and decision["decisions_ue_descr"]:
@ -649,8 +649,8 @@ def add_apc_infos(formsemestre: FormSemestre, params: dict, decision: dict):
params["decision_sem_descr"] = decision_annee.get("code") or ""
params[
"decision_ue_txt"
] = f"""{params["decision_ue_txt"]}<br>
<b>Niveaux de compétences:</b><br> {decision.get("descr_decisions_rcue") or ""}
] = f"""{params["decision_ue_txt"]}<br/>
<b>Niveaux de compétences:</b><br/> {decision.get("descr_decisions_rcue") or ""}
"""

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.3.51"
SCOVERSION = "9.3.52"
SCONAME = "ScoDoc"