mirror of
https://github.com/fmtlib/fmt.git
synced 2026-06-15 00:16:15 +08:00
Restore api.html redirect to fix broken deep links
Re-enable generation of the api.html redirect page during docs deploy so legacy links such as api.html#udt forward to the new MkDocs api/ page with their URL hash preserved.
This commit is contained in:
parent
ffd8397db1
commit
e6a8751df7
@ -71,15 +71,18 @@ if len(args) > 0:
|
||||
# mike stages files added by deploy for deletion for unclear reason,
|
||||
# undo it.
|
||||
ret = call(['git', 'reset', '--hard'], cwd=site_dir)
|
||||
if False:
|
||||
os.makedirs(current_doc_path, exist_ok=True)
|
||||
redirect_page_path = os.path.join(current_doc_path, 'api.html')
|
||||
with open(redirect_page_path, "w") as file:
|
||||
file.write(redirect_page)
|
||||
ret = call(['git', 'add', redirect_page_path], cwd=site_dir)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
ret = call(['git', 'commit', '--amend', '--no-edit'], cwd=site_dir)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
# Generate a redirect page from the old Sphinx api.html to the new api/
|
||||
# page, preserving the URL hash so links such as api.html#udt keep working.
|
||||
os.makedirs(current_doc_path, exist_ok=True)
|
||||
redirect_page_path = os.path.join(current_doc_path, 'api.html')
|
||||
with open(redirect_page_path, "w") as file:
|
||||
file.write(redirect_page)
|
||||
ret = call(['git', 'add', redirect_page_path], cwd=site_dir)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
ret = call(['git', 'commit', '--amend', '--no-edit'], cwd=site_dir)
|
||||
sys.exit(ret)
|
||||
elif not command.startswith('-'):
|
||||
args += ['-f', config_path]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user