From 9e06336cbcc9b38cff15c32ff2e66b236b0caee8 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 23 Nov 2025 12:20:50 +0100 Subject: [PATCH] Update docs and unify flag names --- README.md | 4 +++- main.py | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9431db0..d7f6ba7 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This program is meant to be used as a git submodule of your actual presentation ```sh git submodule add -b release git@path-to-onpoint.git -```` +``` Make sure to have python3 and pandoc (the same version for all developers!) installed. Next, we can install all requirements: @@ -18,6 +18,8 @@ cd onpoint pip3 install -r requirements.txt ``` +To compile, run `python3 main.py $root_directory`. You will have to pass `--no-help-menu` to compile the slides in the `test` folder of this development repository. Use `python3 main.py -h` to learn more about all available optional parameters. + ## The Project Structure We recommend you to structure your project directory like this: diff --git a/main.py b/main.py index bc506ad..7f6c107 100755 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ import helper # stores it in a corresponding slides.lang.html file inside the same directory. -def compile(root, language='en', force_recompile=False, lazyload_images=False, no_helpmenu=False): +def compile(root, language='en', force_recompile=False, lazyload_images=False, no_help_menu=False): wrapper = open(os.path.join(root, 'layouts/root.html'), 'r', encoding='utf8').read() compiled_chapters = chapters.compile_chapters(root, language, force_recompile) wrapper = wrapper.replace('@slides', compiled_chapters) @@ -20,7 +20,7 @@ def compile(root, language='en', force_recompile=False, lazyload_images=False, n wrapper = fragments.defragmentize(wrapper) wrapper = helper.add_lazyload(wrapper, lazyload_images) - if not no_helpmenu: + if not no_help_menu: with open(os.path.join(root, 'slides.' + language + '.html'), 'w+') as output: wrapper = helper.add_help_menu(wrapper, root) @@ -31,24 +31,24 @@ def compile(root, language='en', force_recompile=False, lazyload_images=False, n if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument("rootdirectory", help="your project's root directory") + parser.add_argument("root_directory", help="your project's root directory") parser.add_argument("-l", "--language", default="all", help="the presentation language (default: all)") parser.add_argument("-f", "--force-recompile", action='store_true', help="recompile the entire presentation without caches") parser.add_argument("-i", "--lazyload-images", action='store_true', help="replace all images' src attributes by data-src for image lazyloading") - parser.add_argument("-n", "--nohelpmenu", action="store_true", help="do not compile the help menu") + parser.add_argument("-n", "--no-help-menu", action="store_true", help="do not compile the help menu") args = parser.parse_args() force_recompile = False or args.force_recompile lazyload_images = False or args.lazyload_images - no_helpmenu = False or args.nohelpmenu + no_help_menu = False or args.no_help_menu if args.language == "all": - for language in helper.get_available_languages(args.rootdirectory): - compile(args.rootdirectory, language=language, - force_recompile=force_recompile, lazyload_images=lazyload_images, no_helpmenu=no_helpmenu) + for language in helper.get_available_languages(args.root_directory): + compile(args.root_directory, language=language, + force_recompile=force_recompile, lazyload_images=lazyload_images, no_help_menu=no_help_menu) else: - compile(args.rootdirectory, language=args.language, - force_recompile=force_recompile, lazyload_images=lazyload_images, no_helpmenu=no_helpmenu) + compile(args.root_directory, language=args.language, + force_recompile=force_recompile, lazyload_images=lazyload_images, no_help_menu=no_help_menu)