|
|
@@ -1,6 +1,7 @@
|
|
|
#!./venv/bin/python
|
|
|
-import sys,pypandoc,os,re,subprocess
|
|
|
+import sys,pypandoc,os,re,subprocess,yaml
|
|
|
#
|
|
|
+data_yml_manadatory_keys=['fichier', 'date', 'type', 'auteur', 'titre']
|
|
|
def star_sec(l):
|
|
|
it=iter(L)
|
|
|
ret=[]
|
|
|
@@ -27,17 +28,22 @@ def star_sec(l):
|
|
|
#
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
-with open("data_titre") as f:
|
|
|
- lt=f.readlines()
|
|
|
-if (llt:=len(lt))!=6:
|
|
|
- m=f"\nle fichier data-titre a {llt} lignes (il en faut 6)"
|
|
|
- raise Exception(m)
|
|
|
-fich=lt[0].strip()
|
|
|
-le_titre="\\titre{"+"}{".join([x.replace("\n","") for x in lt[1:]])+"}"+"\n"
|
|
|
+# Construire le titre à partir du fichier yml.
|
|
|
+#-----------------------------------------------------------------------
|
|
|
+with open("data.yml") as f:
|
|
|
+ lt=yaml.safe_load(f)
|
|
|
+
|
|
|
+if not "statut" in lt.keys():
|
|
|
+ lt["statut"]=" "
|
|
|
+ lt["type"]="Conférence"
|
|
|
+fich=lt["fichier"].strip()
|
|
|
+titre_elements="}{".join([lt[x].replace("\n","") for x in lt.keys()
|
|
|
+ if x!="fichier"])
|
|
|
+le_titre="\\titre{"+titre_elements+"}"+"\n"
|
|
|
print(le_titre)
|
|
|
-#
|
|
|
+#--------------------------------------------------------------------
|
|
|
template="../tpl.tex"
|
|
|
-#
|
|
|
+#---------------------------------------------------------------------
|
|
|
exten=fich.split(".")[-1]
|
|
|
|
|
|
if exten=="docx" or exten=="odt":
|