diff --git a/app/routes.py b/app/routes.py index 58ba963..64c4034 100644 --- a/app/routes.py +++ b/app/routes.py @@ -2,9 +2,9 @@ import os import re import typing as t -from peewee import * +from lxml import etree from flask import Blueprint, abort, render_template, request, send_from_directory -from playhouse.flask_utils import PaginatedQuery +from peewee import * from .app import APPPATH from .modeles import Institution, State, House, Intervention_type, Production_place, Diplo_type, Document, Acte, Individual, Involved_in @@ -78,9 +78,24 @@ def acte(house=None, prince=None, acte_id=None): Diplo_type.id_diplo_type == acte_diplo_type)] state = [t.state_label for t in State.select().where( State.id_state == acte_state_id)] + + source_doc = etree.parse( + os.path.join(APPPATH, "static", "xml", house, acte_id + '.xml')) + # remove namespace : + query = "descendant-or-self::*[namespace-uri()!='']" + for element in source_doc.xpath(query): + #replace element name with its local name + element.tag = etree.QName(element).localname + etree.cleanup_namespaces(source_doc) + + xslt_doc = etree.parse(os.path.join(APPPATH, "static", "xsl", "actes_princiers.xsl")) + xslt_transformer = etree.XSLT(xslt_doc) + output_doc = xslt_transformer(source_doc) + print(output_doc) return render_template("acte.html", house=house, prince=prince, infos=q_acte, place=place[0], doc=doc[0][0], arch=inst[0], - diplo=diplo_t[0].replace("_", " "), state=state[0]) + diplo=diplo_t[0].replace("_", " "), state=state[0], + output_doc=output_doc) @main.route("/contact") def contact() -> t.Text: diff --git a/app/static/css/custom_style_main.css b/app/static/css/custom_style_main.css index 45712a2..9740b3d 100644 --- a/app/static/css/custom_style_main.css +++ b/app/static/css/custom_style_main.css @@ -10,4 +10,75 @@ font-style: italic; font-size: small; margin-top: 0; +} + +.analyse { + text-align: justify; + font-style: italic; + font-size: 20px; + line-height: 1.8; +} + +.analyse > p { + text-indent: 5%; + margin-top: 1.5%; + margin-bottom: 1.5%; +} + +.tradition { + font-size: small; + text-align: justify; + margin-top: 10px; + margin-bottom: 20px; + font-size: 17px; + line-height: 1.5; +} + +.tradition > p { + margin: 0.5%; +} + +.act { + text-align: justify; + text-indent: 5%; + margin-top: 2%; + margin-bottom: 0.5%; + font-size: 20px; + line-height: 2; +} + +.text_etabli { + text-align: center; + font-variant: small-caps; + font-size: 18pt; +} + +.mht { + text-indent: 5%; + font-size: 14pt; + margin-top: 0.5%; + margin-bottom: 0.5%; +} + +.signature { + text-indent: 5%; + font-size: 14pt; + margin-top: 0.5%; + margin-bottom: 0.5% +} + +.signature > p { + margin-top: 0%; + margin-bottom: 0.5% +} + +.note-global { + margin-top: 1%; + margin-bottom: 3%; + font-size: 11pt; +} + +.note-global > p { + margin: 0.25%; + text-align: justify; } \ No newline at end of file diff --git a/app/static/xsl/actes_princiers.xsl b/app/static/xsl/actes_princiers.xsl index e61d241..24deebe 100644 --- a/app/static/xsl/actes_princiers.xsl +++ b/app/static/xsl/actes_princiers.xsl @@ -29,7 +29,7 @@ - + @@ -97,7 +97,7 @@ », dans - + @@ -122,7 +122,7 @@ - + @@ -194,7 +194,7 @@ - + @@ -230,9 +230,9 @@ - + - date + text-center @@ -365,10 +365,10 @@ # - + - + diff --git a/app/templates/acte.html b/app/templates/acte.html index ca75803..5fc2275 100644 --- a/app/templates/acte.html +++ b/app/templates/acte.html @@ -8,5 +8,6 @@

{{item.analysis}}.

{{state}}, {{diplo}}, {{arch}}, {{doc}}, {{item.ref_acte}}.

{% endfor %} + {{output_doc|safe}} {% endblock %} \ No newline at end of file