Merge branch 'master' into release

This commit is contained in:
Knoch 2023-04-26 09:28:12 +02:00
commit 737a47ce1e
12 changed files with 12 additions and 5 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
cache.py Normal file → Executable file
View File

0
chapters.py Normal file → Executable file
View File

0
fragments.py Normal file → Executable file
View File

0
help-menu.html Normal file → Executable file
View File

0
helper.py Normal file → Executable file
View File

14
main.py
View File

@ -12,14 +12,18 @@ 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):
def compile(root, language='en', force_recompile=False, lazyload_images=False, no_helpmenu=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)
wrapper = helper.insert_metadata(wrapper, root, language)
wrapper = fragments.defragmentize(wrapper)
wrapper = helper.add_lazyload(wrapper, lazyload_images)
wrapper = helper.add_help_menu(wrapper, root)
if not no_helpmenu:
with open(os.path.join(root, 'slides.' + language + '.html'), 'w+') as output:
wrapper = helper.add_help_menu(wrapper, root)
with open(os.path.join(root, 'slides.' + language + '.html'), 'w+', encoding='utf8') as output:
output.write(wrapper)
print('done')
@ -34,15 +38,17 @@ if __name__ == '__main__':
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")
args = parser.parse_args()
force_recompile = False or args.force_recompile
lazyload_images = False or args.lazyload_images
no_helpmenu = False or args.nohelpmenu
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)
force_recompile=force_recompile, lazyload_images=lazyload_images, no_helpmenu=no_helpmenu)
else:
compile(args.rootdirectory, language=args.language,
force_recompile=force_recompile, lazyload_images=lazyload_images)
force_recompile=force_recompile, lazyload_images=lazyload_images, no_helpmenu=no_helpmenu)

0
onpoint.js Normal file → Executable file
View File

0
requirements.txt Normal file → Executable file
View File

3
slides.py Normal file → Executable file
View File

@ -26,9 +26,10 @@ 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)
slide = slide.replace(
inline_key,
re.sub(r"<p>(.+)</p>", r"\1", filler)
filler_without_outer_paragraph
)
elif '@' + key in slide:

0
structure-draft Normal file → Executable file
View File