Compare commits
4 Commits
bb13938cca
...
737a47ce1e
| Author | SHA1 | Date | |
|---|---|---|---|
| 737a47ce1e | |||
| 67388f2a7e | |||
| 814d661810 | |||
| 4cddcc259d |
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
chapters.py
Normal file → Executable file
0
chapters.py
Normal file → Executable file
0
fragments.py
Normal file → Executable file
0
fragments.py
Normal file → Executable file
0
help-menu.html
Normal file → Executable file
0
help-menu.html
Normal file → Executable file
14
main.py
14
main.py
@ -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
0
onpoint.js
Normal file → Executable file
0
requirements.txt
Normal file → Executable file
0
requirements.txt
Normal file → Executable file
3
slides.py
Normal file → Executable file
3
slides.py
Normal file → Executable 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
0
structure-draft
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user