From abec48ce8541bcdb8ee6f6847fd139272f403bd0 Mon Sep 17 00:00:00 2001 From: Nekori Date: Mon, 26 Apr 2021 17:51:24 +0200 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20des=20ACs=20et=20Comp=C3=A9t?= =?UTF-8?q?ences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/export_yaml_to_html.py | 156 ++++++++++++++++++++++++------------ python/ressource.py | 31 +++++++ 2 files changed, 137 insertions(+), 50 deletions(-) diff --git a/html/export_yaml_to_html.py b/html/export_yaml_to_html.py index 7370405..6c82163 100644 --- a/html/export_yaml_to_html.py +++ b/html/export_yaml_to_html.py @@ -25,6 +25,8 @@ from ressource import * REPERTOIRE_TEMP = Config.ROOT + "/python/export" REPERTOIRE_RESSOURCES_DEFINITIVES = Config.ROOT + "/yaml/ressources" REPERTOIRE_SAE_DEFINITIVES = Config.ROOT + "/yaml/saes" +REPERTOIRE_COMPETENCES_DEFINITIVES = Config.ROOT + "/yaml/competences" +REPERTOIRE_ACS = Config.ROOT + "/python/pn" REPERTOIRE_HTML = Config.ROOT + "/html/export" # Créer le dossier html/export s'il n'existe pas @@ -83,7 +85,15 @@ for fichieryaml in fichiers_exemples: exemples[sem][sae] = [] exemples[sem][sae].append(e) -#Liste de string pour renommer certains catégories (les autres qui n'ont pas besoins ont la première lettre en majuscule) +# Chargement des ACs +fichieryaml = REPERTOIRE_ACS +'/acs.yml' +acs = ACs(fichieryaml) + +# Chargement des Compétences +fichieryaml = REPERTOIRE_COMPETENCES_DEFINITIVES + '/RT123.yml' +competences = Competences(fichieryaml) + +#Liste de string pour renommer certaines catégories (les autres qui n'ont pas besoins ont la première lettre en majuscule) rename = { "heures_encadrees": "Heures encadrées", "heures_formation": "Heures formation", @@ -106,46 +116,25 @@ template = env.from_string(""" {% extends "base.html" %} {% block title %}{{data.code}} - {{data.nom}}{{data.titre}}{% endblock %} {% block content %} - + {% include "navigation.html" %} {% for categorie, valeur in data.items() %} - +
{% if rename[categorie] %}{{rename[categorie]}}{% else %}{{categorie.capitalize()}}{% endif %}{% if rename and rename[categorie] %}{{rename[categorie]}}{% else %}{{categorie.capitalize()}}{% endif %} {#- Gestion des tableaux #} - {% if categorie == "motscles" -%} + {% if categorie == "motscles" -%}
{% for mot in valeur %}{{mot}}{% endfor %}
{#- Gestion des saes #} {% elif categorie == "sae" or categorie == "ressources" -%}
{% for val in valeur %}{{val}}{% endfor %}
{#- Gestion des ACS #} {% elif categorie == "acs" -%} -
{% for rt,acs in valeur.items() %}{% for ac in acs %}{{ac}}{% endfor %}{% endfor %}
+
{% for rt,acs in valeur.items() %}{% for ac in acs %}{{ac}}{% endfor %}{% endfor %}
{#- Gestion des coeffs #} {% elif categorie == "coeffs" -%} -
{% for rt, coeff in valeur.items() %}{{rt}} : {{coeff}}{% endfor %}
+
{% for rt, coeff in valeur.items() %}{{rt}} : {{coeff}}{% endfor %}
{#- Gestion des exemples #} {% elif categorie == "exemples" -%} {% for exemple in valeur %}Exemple{{loop.index}}{% if not loop.last %} - {% endif %}{% endfor %} @@ -162,31 +151,73 @@ template = env.from_string(""" {% endfor %}
- + {% include "navigation.html" %} {% endblock %} """) +# Template de chaque pages de compétences (doit contenir data,rt,precedent,suivant) +template_Competence = env.from_string(""" + {% extends "base.html" %} + {% block title %}{{rt}}{% endblock %} + {% block content %} + {% include "navigation.html" %} + + + {% for categorie, valeur in data.items() %} + + + + + {% endfor %} + +
{{categorie.capitalize()}} + {%- if categorie == "composantes" or categorie == "situations" -%} +
+
    + {% for valeur in valeur %} +
  • {{valeur}}
  • + {% endfor %} +
+
+ {% elif categorie == "niveaux" %} +
+
    + {% for nom, acs in valeur.items() %} +
  • {{nom}}
  • +
      + {% for ac in acs %} + {% if ac[:2] == "AC" %} +
    • {{ac}} - {{acs[ac]}}
    • + {% else %} +
    • {{ac}}
    • + {% endif %} + {% endfor %} +
    + {% endfor %} +
+
+ {% else -%} +
{{valeur}}
+ {% endif %} +
+ {% include "navigation.html" %} + {% endblock %} +""") + +# Template de chaque pages de ACs (doit contenir data, precedent, suivant) +template_AC = env.from_string(""" + {% extends "base.html" %} + {% block title %}{{data["ac"]}}{% endblock %} + {% block content %} + {% include "navigation.html" %} +
+

{{data["ac"]}}

+

{{data["titre"]}}

+
+ {% include "navigation.html" %} + {% endblock %} +""") + # Template de la liste des ressources par semestre (doit contenir data,sem) template_List_Ressource = env.from_string(""" {% extends "base.html" %} @@ -244,7 +275,7 @@ def formatHTML(string): phrases = list(filter(None,string.split("\n"))) i = 0 while i < len(phrases): - if "*" in phrases[i]: # première balise li détecté + if "* " in phrases[i]: # première balise li détecté texte += "