diff --git a/README.md b/README.md index bd4f43d..19b23af 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ We recommend you to structure your project directory like this: │   └── titlepage.html ├── meta.yml ├── onpoint + │ ├── autocompile.sh │ ├── main.py │ ├── README.md │ └── requirements.txt @@ -45,4 +46,10 @@ We recommend you to structure your project directory like this: ## Updating onPoint -In order to update the version of onPoint in an existing project, simply enter the `onpoint` directory and run `git pull`. \ No newline at end of file +In order to update the version of onPoint in an existing project, simply enter the `onpoint` directory and run `git pull`. + +## Auto-compile during Development + +You might want to have all slides auto-compiled for you on safe. For this case, we wrote a small bash script that spawns a file watcher to compile your presentation once any markdown file in the slides folder is saved. Simply run `./onpoint/autocompile.sh` from your project root folder. + +You will need Python and `inotify-tools` to execute the script. \ No newline at end of file diff --git a/autocompile.sh b/autocompile.sh new file mode 100755 index 0000000..f10a240 --- /dev/null +++ b/autocompile.sh @@ -0,0 +1,6 @@ +#! /bin/bash +# Requirements: inotify-tools, python3 + +while inotifywait -e close_write ./slides/*.md; do + python3 ./onpoint/main.py . +done \ No newline at end of file diff --git a/main.py b/main.py index 378c3ab..039c756 100644 --- a/main.py +++ b/main.py @@ -124,11 +124,20 @@ def read_yaml(path): except yaml.YAMLError as exc: print(exc) +# +def get_available_languages(): + return read_yaml('./meta.yml')['language'] + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("rootdirectory", help="your project's root directory") - parser.add_argument("-l", "--language", default="de", help="the presentation language (default: de)") + parser.add_argument("-l", "--language", default="all", help="the presentation language (default: all)") args = parser.parse_args() - compile(args.rootdirectory, language=args.language) + + if args.language == "all": + for language in get_available_languages(): + compile(args.rootdirectory, language=language) + else: + compile(args.rootdirectory, language=args.language)