Compare commits

..

2 commits

2 changed files with 11 additions and 4 deletions

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)

View file

@ -34,8 +34,11 @@ for item in codes:
code, title, desc = item.groups() code, title, desc = item.groups()
if int(code) < 400 or int(code) >= 600: continue if int(code) < 400 or int(code) >= 600: continue
with error.joinpath(f'{code}.html').open('w') as html: with error.joinpath(f'{code}.html').open('w') as html:
html.write(root_html.format( content = root_html.format(
code=code, title=title, desc=desc, style=root_css)) code=code, title=title, desc=desc, style=root_css)
content = re.sub(r'\s+', ' ', content)
content = re.sub(r'>\s<', '><', content)
html.write(content)
nginx_head += f'error_page {code} @error{code};\n' nginx_head += f'error_page {code} @error{code};\n'
nginx_body += f'location @error{code} {{\n'\ nginx_body += f'location @error{code} {{\n'\
f'root {error.resolve()};\n'\ f'root {error.resolve()};\n'\