Intégration des ACs et Compétences
This commit is contained in:
parent
6cb79285b4
commit
abec48ce85
@ -25,6 +25,8 @@ from ressource import *
|
|||||||
REPERTOIRE_TEMP = Config.ROOT + "/python/export"
|
REPERTOIRE_TEMP = Config.ROOT + "/python/export"
|
||||||
REPERTOIRE_RESSOURCES_DEFINITIVES = Config.ROOT + "/yaml/ressources"
|
REPERTOIRE_RESSOURCES_DEFINITIVES = Config.ROOT + "/yaml/ressources"
|
||||||
REPERTOIRE_SAE_DEFINITIVES = Config.ROOT + "/yaml/saes"
|
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"
|
REPERTOIRE_HTML = Config.ROOT + "/html/export"
|
||||||
|
|
||||||
# Créer le dossier html/export s'il n'existe pas
|
# 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] = []
|
||||||
exemples[sem][sae].append(e)
|
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 = {
|
rename = {
|
||||||
"heures_encadrees": "Heures encadrées",
|
"heures_encadrees": "Heures encadrées",
|
||||||
"heures_formation": "Heures formation",
|
"heures_formation": "Heures formation",
|
||||||
@ -106,33 +116,12 @@ template = env.from_string("""
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}{{data.code}} - {{data.nom}}{{data.titre}}{% endblock %}
|
{% block title %}{{data.code}} - {{data.nom}}{{data.titre}}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<nav class="level is-mobile">
|
{% include "navigation.html" %}
|
||||||
<div class="level-left">
|
|
||||||
<div class="level-item">
|
|
||||||
<a class="button is-primary{% if not precedent %} is-static"{% else %} is-outlined" href="{{precedent}}"{% endif %}>
|
|
||||||
<span class="icon is-small">
|
|
||||||
<i class="fas fa-arrow-left"></i>
|
|
||||||
</span>
|
|
||||||
<span>Précédent</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="level-right">
|
|
||||||
<div class="level-item">
|
|
||||||
<a class="button is-primary{% if not suivant %} is-static"{% else %} is-outlined" href="{{suivant}}"{% endif %}>
|
|
||||||
<span>Suivant</span>
|
|
||||||
<span class="icon is-small">
|
|
||||||
<i class="fas fa-arrow-right"></i>
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<table class="table is-bordered is-hoverable is-fullwidth">
|
<table class="table is-bordered is-hoverable is-fullwidth">
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for categorie, valeur in data.items() %}
|
{% for categorie, valeur in data.items() %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% if rename[categorie] %}{{rename[categorie]}}{% else %}{{categorie.capitalize()}}{% endif %}</th>
|
<th>{% if rename and rename[categorie] %}{{rename[categorie]}}{% else %}{{categorie.capitalize()}}{% endif %}</th>
|
||||||
<td>
|
<td>
|
||||||
{#- Gestion des tableaux #}
|
{#- Gestion des tableaux #}
|
||||||
{% if categorie == "motscles" -%}
|
{% if categorie == "motscles" -%}
|
||||||
@ -142,10 +131,10 @@ template = env.from_string("""
|
|||||||
<div class="tags">{% for val in valeur %}<a class="tag is-info" href="{{val.replace("É","E")}}.html">{{val}}</a>{% endfor %}</div>
|
<div class="tags">{% for val in valeur %}<a class="tag is-info" href="{{val.replace("É","E")}}.html">{{val}}</a>{% endfor %}</div>
|
||||||
{#- Gestion des ACS #}
|
{#- Gestion des ACS #}
|
||||||
{% elif categorie == "acs" -%}
|
{% elif categorie == "acs" -%}
|
||||||
<div class="tags">{% for rt,acs in valeur.items() %}{% for ac in acs %}<span class="tag is-info">{{ac}}</span>{% endfor %}{% endfor %}</div>
|
<div class="tags">{% for rt,acs in valeur.items() %}{% for ac in acs %}<a class="tag is-info" href="{{ac}}.html">{{ac}}</a>{% endfor %}{% endfor %}</div>
|
||||||
{#- Gestion des coeffs #}
|
{#- Gestion des coeffs #}
|
||||||
{% elif categorie == "coeffs" -%}
|
{% elif categorie == "coeffs" -%}
|
||||||
<div class="tags">{% for rt, coeff in valeur.items() %}<span class="tag is-info">{{rt}} : {{coeff}}</span>{% endfor %}</div>
|
<div class="tags">{% for rt, coeff in valeur.items() %}<a class="tag is-info" href="{{rt}}.html">{{rt}} : {{coeff}}</a>{% endfor %}</div>
|
||||||
{#- Gestion des exemples #}
|
{#- Gestion des exemples #}
|
||||||
{% elif categorie == "exemples" -%}
|
{% elif categorie == "exemples" -%}
|
||||||
{% for exemple in valeur %}<a href="{{exemple.exemple["code"].replace("É","E") + "_exemple" + loop.index|string}}.html">Exemple{{loop.index}}</a>{% if not loop.last %} - {% endif %}{% endfor %}
|
{% for exemple in valeur %}<a href="{{exemple.exemple["code"].replace("É","E") + "_exemple" + loop.index|string}}.html">Exemple{{loop.index}}</a>{% if not loop.last %} - {% endif %}{% endfor %}
|
||||||
@ -162,28 +151,70 @@ template = env.from_string("""
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<nav class="level is-mobile">
|
{% include "navigation.html" %}
|
||||||
<div class="level-left">
|
{% endblock %}
|
||||||
<div class="level-item">
|
""")
|
||||||
<a class="button is-primary{% if not precedent %} is-static"{% else %} is-outlined" href="{{precedent}}"{% endif %}>
|
|
||||||
<span class="icon is-small">
|
# Template de chaque pages de compétences (doit contenir data,rt,precedent,suivant)
|
||||||
<i class="fas fa-arrow-left"></i>
|
template_Competence = env.from_string("""
|
||||||
</span>
|
{% extends "base.html" %}
|
||||||
<span>Précédent</span>
|
{% block title %}{{rt}}{% endblock %}
|
||||||
</a>
|
{% block content %}
|
||||||
|
{% include "navigation.html" %}
|
||||||
|
<table class="table is-bordered is-hoverable is-fullwidth">
|
||||||
|
<tbody>
|
||||||
|
{% for categorie, valeur in data.items() %}
|
||||||
|
<tr>
|
||||||
|
<th>{{categorie.capitalize()}}</th>
|
||||||
|
<td>
|
||||||
|
{%- if categorie == "composantes" or categorie == "situations" -%}
|
||||||
|
<div class="content">
|
||||||
|
<ul>
|
||||||
|
{% for valeur in valeur %}
|
||||||
|
<li>{{valeur}}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{% elif categorie == "niveaux" %}
|
||||||
|
<div class="content">
|
||||||
|
<ul>
|
||||||
|
{% for nom, acs in valeur.items() %}
|
||||||
|
<li>{{nom}}</li>
|
||||||
|
<ul>
|
||||||
|
{% for ac in acs %}
|
||||||
|
{% if ac[:2] == "AC" %}
|
||||||
|
<li><a class="tag is-info" href="{{ac}}.html">{{ac}}</a> - {{acs[ac]}}</li>
|
||||||
|
{% else %}
|
||||||
|
<li>{{ac}}</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
{% else -%}
|
||||||
<div class="level-item">
|
<div class="content">{{valeur}}</div>
|
||||||
<a class="button is-primary{% if not suivant %} is-static"{% else %} is-outlined" href="{{suivant}}"{% endif %}>
|
{% endif %}
|
||||||
<span>Suivant</span>
|
</td>
|
||||||
<span class="icon is-small">
|
</tr>
|
||||||
<i class="fas fa-arrow-right"></i>
|
{% endfor %}
|
||||||
</span>
|
</tbody>
|
||||||
</a>
|
</table>
|
||||||
|
{% 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" %}
|
||||||
|
<div class="content">
|
||||||
|
<h1>{{data["ac"]}}</h1>
|
||||||
|
<p>{{data["titre"]}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% include "navigation.html" %}
|
||||||
</nav>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@ -338,3 +369,28 @@ for indexSem, sem in enumerate(ressources):
|
|||||||
if(j < len(exemples[sem][sae]) - 1): datas["suivant"] = "SAE" + data["code"][-2:] + "_exemple" + str(i+1) + ".html"
|
if(j < len(exemples[sem][sae]) - 1): datas["suivant"] = "SAE" + data["code"][-2:] + "_exemple" + str(i+1) + ".html"
|
||||||
template.stream(datas).dump(REPERTOIRE_HTML + "/" + data["code"].replace("É","E") + "_exemple" + str(i) + ".html")
|
template.stream(datas).dump(REPERTOIRE_HTML + "/" + data["code"].replace("É","E") + "_exemple" + str(i) + ".html")
|
||||||
i+=1
|
i+=1
|
||||||
|
|
||||||
|
# Création des pages individuelles ACs, Compétences
|
||||||
|
for indexRt, rt in enumerate(acs.getInfo()):
|
||||||
|
|
||||||
|
# ACs
|
||||||
|
for i, (ac, desc) in enumerate(acs.getInfo()[rt].items()):
|
||||||
|
data = {}
|
||||||
|
data["ac"] = ac
|
||||||
|
data["titre"] = desc
|
||||||
|
datas = {"data":data}
|
||||||
|
if i > 0: datas["precedent"] = list(acs.getInfo()[rt].keys())[i-1] + ".html"
|
||||||
|
elif indexRt > 0: datas["precedent"] = list(acs.getInfo()["RT" + str(int(rt[-1])-1)].keys())[-1] + ".html"
|
||||||
|
if i < len(acs.getInfo()[rt])-1: datas["suivant"] = list(acs.getInfo()[rt].keys())[i+1] + ".html"
|
||||||
|
elif indexRt < len(acs.getInfo())-1: datas["suivant"] = list(acs.getInfo()["RT" + str(int(rt[-1])+1)].keys())[0] + ".html"
|
||||||
|
template_AC.stream(datas).dump(REPERTOIRE_HTML + "/" + ac + ".html")
|
||||||
|
|
||||||
|
# Compétences
|
||||||
|
data = {}
|
||||||
|
for categorie, valeur in competences.getInfo()[rt].items():
|
||||||
|
data[categorie] = valeur
|
||||||
|
data["description"] = formatHTML(data["description"])
|
||||||
|
datas = {"data": data, "rt": rt}
|
||||||
|
if indexRt > 0: datas["precedent"] = "RT" + str(indexRt) + ".html"
|
||||||
|
if indexRt <= len(competences.getInfo()): datas["suivant"] = "RT" + str(indexRt + 2) + ".html"
|
||||||
|
template_Competence.stream(datas).dump(REPERTOIRE_HTML + "/" + rt + ".html")
|
@ -394,6 +394,37 @@ class ExempleSAE:
|
|||||||
|
|
||||||
return chaine
|
return chaine
|
||||||
|
|
||||||
|
class Competences:
|
||||||
|
""" Modélise une liste de compétences lorsqu'elle est extraite d'un dictionnaire """
|
||||||
|
|
||||||
|
__LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
def __init__(self, fichieryaml):
|
||||||
|
with open(fichieryaml, "r", encoding="utf8") as fid:
|
||||||
|
yaml = ruamel.yaml.YAML()
|
||||||
|
try:
|
||||||
|
self.competences = yaml.load(fid.read())
|
||||||
|
except:
|
||||||
|
Competences.__LOGGER.warning(f"Pb de chargement de {fichieryaml}")
|
||||||
|
|
||||||
|
def getInfo(self):
|
||||||
|
return self.competences
|
||||||
|
|
||||||
|
class ACs:
|
||||||
|
""" Modélise une liste de acs lorsqu'elle est extraite d'un fichier yaml """
|
||||||
|
|
||||||
|
__LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
def __init__(self, fichieryaml):
|
||||||
|
with open(fichieryaml, "r", encoding="utf8") as fid:
|
||||||
|
yaml = ruamel.yaml.YAML(typ="safe")
|
||||||
|
try:
|
||||||
|
self.acs = yaml.load(fid.read())
|
||||||
|
except:
|
||||||
|
ACs.__LOGGER.warning(f"Pb de chargement de {fichieryaml}")
|
||||||
|
|
||||||
|
def getInfo(self):
|
||||||
|
return self.acs
|
||||||
|
|
||||||
def md_to_latex(contenu):
|
def md_to_latex(contenu):
|
||||||
"""Réalise la conversion markdown to latex avec pypandoc"""
|
"""Réalise la conversion markdown to latex avec pypandoc"""
|
||||||
|
Loading…
Reference in New Issue
Block a user