Fixed whitespace behavior in generate.py

This commit is contained in:
Edgar P. Burkhart 2021-12-29 16:22:02 +01:00
parent 528ef21491
commit 3a3a0f42f2
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -26,7 +26,10 @@ modules = dict(map(read, module.glob('*.html')))
def format(item, modules): def format(item, modules):
name, content = item name, content = item
return (name, re.sub('\n\s*', '', content.format(**modules))) content = content.format(**modules)
content = re.sub(r'\s+', ' ', content)
content = re.sub(r'>\s<', '><', content)
return (name, content)
dist_html = dict(map(lambda item: format(item, modules), templates.items())) dist_html = dict(map(lambda item: format(item, modules), templates.items()))
@ -42,4 +45,5 @@ def mk_dist(dist, item):
for item in dist_html.items(): for item in dist_html.items():
mk_dist(dist, item) mk_dist(dist, item)
dist.joinpath('static').symlink_to(static.resolve(strict=True), target_is_directory=True) dist.joinpath('static')\
.symlink_to(static.resolve(strict=True), target_is_directory=True)