Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat speciesSheet: use Markdow for custom TaxHub attributes in infos bloc #415

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions atlas/modeles/repositories/vmCorTaxonAttribut.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding:utf-8 -*-

from sqlalchemy.sql import text
import markdown


def getAttributesTaxon(connection, cd_ref, attrDesc, attrComment, attrMilieu, attrChoro):
Expand All @@ -21,12 +22,13 @@ def getAttributesTaxon(connection, cd_ref, attrDesc, attrComment, attrMilieu, at

descTaxon = {"description": None, "commentaire": None, "milieu": None, "chorologie": None}
for r in req:
html_value = markdown.markdown(r.valeur_attribut)
if r.id_attribut == attrDesc:
descTaxon["description"] = r.valeur_attribut
descTaxon["description"] = html_value
elif r.id_attribut == attrComment:
descTaxon["commentaire"] = r.valeur_attribut
descTaxon["commentaire"] = html_value
elif r.id_attribut == attrMilieu:
descTaxon["milieu"] = r.valeur_attribut.replace("&", " | ")
elif r.id_attribut == attrChoro:
descTaxon["chorologie"] = r.valeur_attribut
descTaxon["chorologie"] = html_value
return descTaxon
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ geojson
gunicorn
itsdangerous
Jinja2
markdown
MarkupSafe
marshmallow
psycopg2
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jinja2==3.1.2
# -r requirements.in
# flask
# flask-babel
markdown==3.3.6
markupsafe==2.1.1
# via
# -r requirements.in
Expand Down