Compare commits
4 Commits
830de3fdac
...
1ac8ff6547
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ac8ff6547 | ||
|
|
60df66dec9 | ||
|
|
9e06336cbc | ||
|
|
f824b13a27 |
@ -8,7 +8,7 @@ This program is meant to be used as a git submodule of your actual presentation
|
||||
|
||||
```sh
|
||||
git submodule add -b release git@git.stuve-bamberg.de:latex/onpoint.git
|
||||
````
|
||||
```
|
||||
|
||||
Make sure to have python3 and pandoc (the same version for all developers!) installed.
|
||||
Next, we can install all requirements:
|
||||
@ -20,6 +20,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:
|
||||
|
||||
@ -1,24 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="4.2333331mm"
|
||||
height="4.2333331mm"
|
||||
viewBox="0 0 4.2333331 4.2333331"
|
||||
width="35px"
|
||||
height="35px"
|
||||
viewBox="0 0 100 100"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
id="pointer"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1" />
|
||||
<g
|
||||
id="layer1"
|
||||
transform="translate(-36.493334,-89.210833)">
|
||||
<circle
|
||||
style="fill:#d40000;stroke-width:0.264583"
|
||||
id="path1"
|
||||
cx="38.610001"
|
||||
cy="91.327499"
|
||||
r="2.1166666" />
|
||||
</g>
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<circle
|
||||
style="fill:red;stroke:white;stroke-width:10"
|
||||
id="circle"
|
||||
cx="50"
|
||||
cy="50"
|
||||
r="40"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 374 B |
20
main.py
20
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)
|
||||
|
||||
@ -26,7 +26,7 @@ def compile_slide(slide, root_directory):
|
||||
# very unelegant attempt at inline elements
|
||||
inline_key = '@' + key + '(inline)'
|
||||
if inline_key in slide:
|
||||
filler_without_outer_paragraph = re.sub(r"<p>(.+)</p>", r"\1", filler, flags=re.DOTALL)
|
||||
filler_without_outer_paragraph = re.sub(r"<p>(.+)</p>", r"\1", filler, flags=re.DOTALL).strip()
|
||||
slide = slide.replace(
|
||||
inline_key,
|
||||
filler_without_outer_paragraph
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user