Add unicode-input docs redirect
This commit is contained in:
parent
7e449dec4f
commit
5956639082
26
publish.py
26
publish.py
@ -79,16 +79,9 @@ def run_html(args: Any) -> None:
|
||||
add_old_redirects('docs/_build/dirhtml')
|
||||
|
||||
|
||||
def add_old_redirects(loc: str) -> None:
|
||||
for dirpath, dirnames, filenames in os.walk(loc):
|
||||
if dirpath != loc:
|
||||
for fname in filenames:
|
||||
if fname == 'index.html':
|
||||
bname = os.path.basename(dirpath)
|
||||
base = os.path.dirname(dirpath)
|
||||
link_name = os.path.join(base, f'{bname}.html') if base else f'{bname}.html'
|
||||
with open(link_name, 'w') as f:
|
||||
f.write(f'''
|
||||
def generate_redirect_html(link_name: str, bname: str) -> None:
|
||||
with open(link_name, 'w') as f:
|
||||
f.write(f'''
|
||||
<html>
|
||||
<head>
|
||||
<title>Redirecting...</title>
|
||||
@ -107,6 +100,19 @@ window.location.replace('./{bname}/' + window.location.hash);
|
||||
''')
|
||||
|
||||
|
||||
def add_old_redirects(loc: str) -> None:
|
||||
for dirpath, dirnames, filenames in os.walk(loc):
|
||||
if dirpath != loc:
|
||||
for fname in filenames:
|
||||
if fname == 'index.html':
|
||||
bname = os.path.basename(dirpath)
|
||||
base = os.path.dirname(dirpath)
|
||||
link_name = os.path.join(base, f'{bname}.html') if base else f'{bname}.html'
|
||||
generate_redirect_html(link_name, bname)
|
||||
|
||||
generate_redirect_html(os.path.join(loc, 'kittens', 'unicode-input.html'), 'unicode_input')
|
||||
|
||||
|
||||
def run_docs(args: Any) -> None:
|
||||
subprocess.check_call(['make', 'docs'])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user