sigrennesmetropole / geor_urbanisme_mapstore

GNU General Public License v3.0
2 stars 5 forks source link

How to parse HTML code in the information window ? #15

Closed jusabatier closed 3 years ago

jusabatier commented 3 years ago

I tried to show constraints on a parcel and everything looks good but the display of text returned for constraints doesn't handle html tags :

image

Is it possible to handle them, or is there any syntax to styling the text ?

MaelREBOUX commented 3 years ago

Uh ?

The backend is responding with JSON @jusabatier . From where come your datas ?

{
    "libelles": [
        {"libelle": "Plan Local d'Urbanisme intercommunal (PLUi) approuvé par délibération du Conseil de Rennes Métropole du 19/12/2019. Modification Simplifiée (MS n°1) approuvée par délibération du Conseil de Rennes Métropole du 10/09/2020, dernière Mise à jour (MAJ n°3) par arrêté de la Présidente de Rennes Métropole du 27/11/2020"},
        {"libelle": "Terrain concerné par la servitude de dégagement contre les obstacles à la navigation aérienne (T7) ."},
        {"libelle": "Terrain concerné par la Redevance Archéologique Préventive (RAP), (taux de 0,40%)."},
        {"libelle": "Zone A"},
        {"libelle": "Terrain concerné par une orientation d'aménagement et de programmation (OAP) thématique : \"Projet patrimonial, paysager, trame verte et bleue\"."},
        {"libelle": "Terrain non soumis au Droit de Préemption urbain (DPu)."},
        {"libelle": "Terrain concerné par la Taxe d'Aménagement (TA)   créée par délibération du Conseil de Rennes Métropole du 15/11/2018 (taux de 5%)."},
        {"libelle": "Terrain concerné par une servitude relative à la protection des centres de réception contre les perturbations électromagnétiques - ZG Zone de Garde (assiette) (PT1)."},
        {"libelle": "Terrain concerné par une Orientation d'Aménagement et de Programmation (OAP) communale."},
        {"libelle": "Terrain affecté par le bruit des infrastructures terrestres de catégorie 2 (largeur : 250m)"},
        {"libelle": "Terrain concerné par une servitude relative à la protection des centres de réception contre les perturbations électromagnétiques - ZP Zone de Protection (assiette) (PT1)."},
        {"libelle": "Terrain concerné par une Orientation d'Aménagement et de Programmation (OAP) intercommunale."},
        {"libelle": "Terrain concerné par une servitude relative à la protection contre les obstacles de centres d'émission et de réception exploités par l'État - ZP Zone Secondaire de dégagement (assiette) (PT2)."},
        {"libelle": "Terrain concerné par une Orientation d'Aménagement et de Programmation (OAP) thématique : \"Les axes de développement de la ville archipel\"."},
        {"libelle": "Terrain concerné par les règles de végétalisation indiquées dans le règlement littéral."},
        {"libelle": "Terrain concerné par une règle de hauteur indiquée dans le règlement littéral."},
        {"libelle": "Terrain concerné par une Orientation d'Aménagement et de Programmation (OAP) thématique : \"santé, climat, énergie\"."},
        {"libelle": "Terrain situé dans un secteur obligatoire à l'infiltration des eaux pluviales."},
        {"libelle": "Terrain concerné par une disposition réglementaire relative au phénomène de retrait/gonflement des sols argileux (aléa faible)."},
        {"libelle": "Terrain concerné par la Taxe d'Aménagement (TA) départementale  créée par délibération du Conseil Général d'Ille et Vilaine du 10/11/2011 (taux de 1,85%)."}
    ],
    "parcelle": "350047000ZK0034"
}
MaelREBOUX commented 3 years ago

May I understand that you have correct JSON but you want to have HTML tags in it and so you want this HTML to be interpreted by the MS2 plugin ?

jusabatier commented 3 years ago

Exactly, as I already explained, I developped another backend to fit our needs.

In order to order returned constraints in groups, I need to have the possibility to styling them and for now it's done via HTML. The data is returned in JSON but embed HTML for styling.

MaelREBOUX commented 3 years ago

So that is a question about MapStore2 capabilities.

@tdipisa could you tell us if / how MS2 could parse HTML code catched in a ajax response ?

offtherailz commented 3 years ago

I created a PR for this. This allows libelle content to optionally contain html that can be rendered. Is it enough?

jusabatier commented 3 years ago

I think it will be OK with this. You can close the issue once the PR is merged.