Le contenu du programme est toujours dérivé du fichier diaporama.tex

This commit is contained in:
Benjamin Bohard 2021-01-29 16:26:03 +01:00
parent 7edb5ee916
commit 983a8f3cf6
1 changed files with 5 additions and 4 deletions

View File

@ -369,7 +369,8 @@ def main():
section_re = re.compile(r'\\section\{(?P<name>.*?)\}')
part_re = re.compile(r'\\part\{(?P<name>.*?)}')
subsection_re = re.compile(r'\\subsection\{(?P<name>.*?)\}')
with open(args.master, 'r') as master_tex:
master_file = path.join('presentations', args.directory, 'diaporama.tex')
with open(master_file, 'r') as master_tex:
master = master_tex.read()
skbconfig = SKBCONFIG_RE.search(master)
@ -380,10 +381,10 @@ def main():
includes = SKBINPUT_RE.finditer(master)
parts_list = [(part.start(), part_level, part.group('name')) for part in parts]
sections_list = [(section.start(), section_level, section.group('name')) for section in sections]
includes_list = [element for skbinput in includes for element in outline_from_include(file_path_from_skbinput(skbinput, args.master, skbconfig), skbinput.start(), document_class)]
includes_list = [element for skbinput in includes for element in outline_from_include(file_path_from_skbinput(skbinput, master_file, skbconfig), skbinput.start(), document_class)]
subsections_list = [(subsection.start(), subsection_level, subsection.group('name')) for subsection in subsections]
structured_outline = structure_outline(filter_outlines(reorder_lists(parts_list, sections_list, includes_list, subsections_list)))
content_file = path.join(path.dirname(path.abspath(args.master)), 'programme', 'contenu.tex')
content_file = path.join(path.dirname(path.abspath(master_file)), 'programme', 'contenu.tex')
with open(content_file, 'w') as content_fh:
content_fh.write(structured_outline.render())
@ -415,7 +416,7 @@ def main():
parser_update.add_argument('-m', '--master', help="Emplacement du fichier maître", required=True)
parser_update.set_defaults(func=update)
parser_outline = subparsers.add_parser('outline', help="Création du programme à partir du fichier maître")
parser_outline.add_argument('-m', '--master', help="Emplacement du fichier maître", required=True)
parser_outline.add_argument('-d', '--directory', help="Sous-répertoires contenant le diaporama", required=True)
parser_outline.set_defaults(func=outline)
args = parser.parse_args()
args.func(args)