Browse Source

on remplit

Thierry Dumont 1 month ago
parent
commit
e4bc1272c8
3 changed files with 64 additions and 0 deletions
  1. 3 0
      All/all_texts
  2. 55 0
      All/tout.py
  3. 6 0
      data_titre.proto

+ 3 - 0
All/all_texts

@@ -0,0 +1,3 @@
+Crepel2/meteo1.tex
+Crepel1/c2.tex
+Dumont1/dumont1.tex

+ 55 - 0
All/tout.py

@@ -0,0 +1,55 @@
+def getlines(L,bound1,bound2):
+    ret=[]
+    start=False
+    for l in L:
+        if start:
+            if bound2 in l:
+                return ret
+            else:
+                ret.append(l)
+        else:
+            start = bound1 in l
+        
+#-------------------------------------------            
+def addpath(x,ajout):
+    if "includegraphics" in x:
+        return x.replace("{",ajout)
+    else:
+        return x
+#
+templat= "../tpl.tex"
+# Récupérer le liste des txtes à introduire
+with open("all_texts") as f:
+    lf= f.readlines()
+#on récupère le template
+with open(templat) as f:
+    Ltmpl=f.readlines()
+
+Lall=[]
+for l in Ltmpl:
+    if "body" in l:
+        break
+    else:
+        Lall.append(l)
+
+bound1= "pagestyle"
+bound2= "tableofcontents"
+
+for l in lf:
+    lok="../"+l.replace("\n","")
+    print(lok)
+    with open(lok) as g:
+        LL=g.readlines()
+    Z= getlines(LL,bound1,bound2)
+
+    # graphiques
+    ajout="{../"+l.split("/")[0]+"/"
+    
+    Lall+=[addpath(x,ajout) for x in Z if not "newcounter" in x]
+    Lall.append("\\eject\n")
+    
+with open("final.tex","w") as f:
+    for x in Lall[:-1]:
+        f.write(x)
+    f.write("\\tableofcontents\n")
+    f.write("\\end{document}\n")

+ 6 - 0
data_titre.proto

@@ -0,0 +1,6 @@
+fichier à traiter docx ou odt
+date: Mardi 25 Mai 2021
+communication/conférence: Communication
+Nom Prénom:Pierre Crépel
+tituleire/associé ou ligne de blancs:membre titulaire
+titre: La statistique et l'Académie de Lyon dans la première moitié du XIX\ieme{} siècle