Merge branch 'master' into release

This commit is contained in:
Knoch 2020-02-06 18:09:10 +01:00
commit f6959e532a
3 changed files with 25 additions and 3 deletions

View File

@ -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`.
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.

6
autocompile.sh Executable file
View File

@ -0,0 +1,6 @@
#! /bin/bash
# Requirements: inotify-tools, python3
while inotifywait -e close_write ./slides/*.md; do
python3 ./onpoint/main.py .
done

13
main.py
View File

@ -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)