Compare commits
2 commits
528ef21491
...
04e3f982d4
Author | SHA1 | Date | |
---|---|---|---|
04e3f982d4 | |||
3a3a0f42f2 |
2 changed files with 11 additions and 4 deletions
|
@ -26,7 +26,10 @@ modules = dict(map(read, module.glob('*.html')))
|
|||
def format(item, modules):
|
||||
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()))
|
||||
|
||||
|
@ -42,4 +45,5 @@ def mk_dist(dist, item):
|
|||
for item in dist_html.items():
|
||||
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)
|
||||
|
|
|
@ -34,8 +34,11 @@ for item in codes:
|
|||
code, title, desc = item.groups()
|
||||
if int(code) < 400 or int(code) >= 600: continue
|
||||
with error.joinpath(f'{code}.html').open('w') as html:
|
||||
html.write(root_html.format(
|
||||
code=code, title=title, desc=desc, style=root_css))
|
||||
content = root_html.format(
|
||||
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_body += f'location @error{code} {{\n'\
|
||||
f'root {error.resolve()};\n'\
|
||||
|
|
Reference in a new issue