This commit is contained in:
Marc Beninca 2020-10-07 13:50:11 +02:00
parent 0a2f3cae99
commit 641fc45fe0
3 changed files with 46 additions and 43 deletions

View file

@ -5,10 +5,12 @@ import shutil
import subprocess import subprocess
import sys import sys
ENGLISH='en'
FRENCH='fr'
LANGUAGES = [ENGLISH, FRENCH]
DOCUMENTS = [ DOCUMENTS = [
# ('topic', 'sujet'), {ENGLISH: 'thesis', FRENCH: 'mémoire'},
('document', 'mémoire'), # {ENGLISH: 'presentation', FRENCH: 'présentation'},
# ('presentation', 'présentation'),
] ]
TMP = 'tmp' TMP = 'tmp'
@ -23,20 +25,21 @@ def errun(command):
def build(sign): def build(sign):
for en, fr in DOCUMENTS: for language in LANGUAGES:
command = ['xelatex', '-output-directory', TMP, en] for document in DOCUMENTS:
if en == 'document': command = ['xelatex', '-output-directory', TMP, document[ENGLISH]]
if document['en'] == 'thesis':
run(command) run(command)
run(['makeglossaries', '-d', TMP, en]) run(['makeglossaries', '-d', TMP, document[ENGLISH]])
run(['biber', run(['biber',
'--input-directory', TMP, '--input-directory', TMP,
'--output-directory', TMP, '--output-directory', TMP,
en, document['en'],
]) ])
run(command) run(command)
run(command) run(command)
pdf = f'{fr}.pdf' pdf = f'{document[FRENCH]}.pdf'
os.rename(os.path.join(TMP, f'{en}.pdf'), os.rename(os.path.join(TMP, f'{document[ENGLISH]}.pdf'),
os.path.join(TMP, pdf)) os.path.join(TMP, pdf))
if not sign: if not sign:
os.rename(os.path.join(TMP, pdf), pdf) os.rename(os.path.join(TMP, pdf), pdf)

View file

@ -1,4 +1,4 @@
\newcommand{\import}[1]{\input{document/#1}} \newcommand{\import}[1]{\input{thesis/#1}}
\import{settings} \import{settings}