|
|
@@ -1,39 +1,37 @@
|
|
|
|
|
|
#-------------------------------------------
|
|
|
def addpath(x,ajout):
|
|
|
+ # if faut transformesr les chemins vers les images
|
|
|
if "includegraphics" in x:
|
|
|
return x.replace("{",ajout)
|
|
|
else:
|
|
|
return x
|
|
|
-#
|
|
|
-templat= "../tpl.tex"
|
|
|
-#
|
|
|
+
|
|
|
# Récupérer la liste des textes à introduire
|
|
|
#
|
|
|
with open("all_texts") as f:
|
|
|
lf= f.readlines()
|
|
|
+
|
|
|
+templat= "../tpl.tex"
|
|
|
#
|
|
|
-#on récupère le template
|
|
|
with open(templat) as f:
|
|
|
Ltmpl=f.readlines()
|
|
|
-#
|
|
|
+# ne garder du template que le début
|
|
|
Lall=[]
|
|
|
for l in Ltmpl:
|
|
|
if "%@@debut" in l:
|
|
|
break
|
|
|
else:
|
|
|
Lall.append(l)
|
|
|
-
|
|
|
-bound1= "pagestyle"
|
|
|
-bound2= "tableofcontents"
|
|
|
-
|
|
|
-
|
|
|
+#
|
|
|
+# parcourir les fichiers à assembler:
|
|
|
+#
|
|
|
for l in lf:
|
|
|
lok="../"+l.replace("\n","")
|
|
|
print(lok)
|
|
|
with open(lok) as g:
|
|
|
LL=g.readlines()
|
|
|
- #Z= getlines(LL,"debut","fin")
|
|
|
+ # insérer ce qui entre %@@debut et "%@@fin":
|
|
|
start= False
|
|
|
Z= []
|
|
|
for x in LL:
|
|
|
@@ -43,14 +41,15 @@ for l in lf:
|
|
|
break
|
|
|
if start:
|
|
|
Z.append(x)
|
|
|
- # graphiques
|
|
|
+ # graphiques: modifier les chemins:
|
|
|
ajout="{../"+l.split("/")[0]+"/"
|
|
|
-
|
|
|
Lall+=[addpath(x,ajout) for x in Z if not "newcounter" in x]
|
|
|
Lall.append("\\eject\n")
|
|
|
-
|
|
|
+#
|
|
|
+# sauver le resultat....
|
|
|
with open("final.tex","w") as f:
|
|
|
for x in Lall[:-1]:
|
|
|
f.write(x)
|
|
|
+#-----------------------------------------------------------
|
|
|
f.write("\\tableofcontents\n")
|
|
|
f.write("\\end{document}\n")
|