Compare commits

...

5 Commits

Author SHA1 Message Date
Florian
de68c2076e Merge branch 'main' into release 2025-11-23 12:36:18 +01:00
Florian
1ac8ff6547 Merge branch 'main' of ssh://git.stuve-bamberg.de/latex/onpoint 2025-11-23 12:33:51 +01:00
Florian
60df66dec9 Increase pointer size 2025-11-23 12:32:07 +01:00
Florian
9e06336cbc Update docs and unify flag names 2025-11-23 12:20:50 +01:00
Florian
f824b13a27 Strip whitespace on inline slide fillers 2025-11-23 12:13:12 +01:00
4 changed files with 27 additions and 31 deletions

View File

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

View File

@ -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
View File

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

View File

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