Update docs and unify flag names

This commit is contained in:
Florian 2025-11-23 12:20:50 +01:00
parent f824b13a27
commit 9e06336cbc
2 changed files with 13 additions and 11 deletions

View File

@ -6,7 +6,7 @@ This program is meant to be used as a git submodule of your actual presentation
```sh ```sh
git submodule add -b release git@path-to-onpoint.git git submodule add -b release git@path-to-onpoint.git
```` ```
Make sure to have python3 and pandoc (the same version for all developers!) installed. Make sure to have python3 and pandoc (the same version for all developers!) installed.
Next, we can install all requirements: Next, we can install all requirements:
@ -18,6 +18,8 @@ cd onpoint
pip3 install -r requirements.txt 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 ## The Project Structure
We recommend you to structure your project directory like this: We recommend you to structure your project directory like this:

20
main.py
View File

@ -12,7 +12,7 @@ import helper
# stores it in a corresponding slides.lang.html file inside the same directory. # 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() wrapper = open(os.path.join(root, 'layouts/root.html'), 'r', encoding='utf8').read()
compiled_chapters = chapters.compile_chapters(root, language, force_recompile) compiled_chapters = chapters.compile_chapters(root, language, force_recompile)
wrapper = wrapper.replace('@slides', compiled_chapters) 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 = fragments.defragmentize(wrapper)
wrapper = helper.add_lazyload(wrapper, lazyload_images) 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: with open(os.path.join(root, 'slides.' + language + '.html'), 'w+') as output:
wrapper = helper.add_help_menu(wrapper, root) 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__': if __name__ == '__main__':
parser = argparse.ArgumentParser() 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", parser.add_argument("-l", "--language", default="all",
help="the presentation language (default: all)") help="the presentation language (default: all)")
parser.add_argument("-f", "--force-recompile", action='store_true', parser.add_argument("-f", "--force-recompile", action='store_true',
help="recompile the entire presentation without caches") help="recompile the entire presentation without caches")
parser.add_argument("-i", "--lazyload-images", action='store_true', parser.add_argument("-i", "--lazyload-images", action='store_true',
help="replace all images' src attributes by data-src for image lazyloading") 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() args = parser.parse_args()
force_recompile = False or args.force_recompile force_recompile = False or args.force_recompile
lazyload_images = False or args.lazyload_images 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": if args.language == "all":
for language in helper.get_available_languages(args.rootdirectory): for language in helper.get_available_languages(args.root_directory):
compile(args.rootdirectory, language=language, compile(args.root_directory, language=language,
force_recompile=force_recompile, lazyload_images=lazyload_images, no_helpmenu=no_helpmenu) force_recompile=force_recompile, lazyload_images=lazyload_images, no_help_menu=no_help_menu)
else: else:
compile(args.rootdirectory, language=args.language, compile(args.root_directory, language=args.language,
force_recompile=force_recompile, lazyload_images=lazyload_images, no_helpmenu=no_helpmenu) force_recompile=force_recompile, lazyload_images=lazyload_images, no_help_menu=no_help_menu)