generalize anchor redirects

renaming section headers and changing manually set `id`s will break URLs
in the wild.

this change allows keeping track of all changes to ensure backwards
compatibility.
This commit is contained in:
Valentin Gagarin 2022-09-05 22:37:22 +02:00
parent 089f584173
commit 59be1e500a

View file

@ -1,330 +1,413 @@
// Redirects from old DocBook manual. // Redirect rules for anchors ensure backwards compatibility of URLs.
// This must be done on the client side, as web servers do not see the anchor part of the URL.
// Redirections are declared as follows:
// Each entry has as key the matched URL path relative to the mdBook document root.
// Each entry is a set of key-value pairs, where
// - keys are anchors on to the matched path.
// - values are redirection targets relative to the current path.
var redirects = { var redirects = {
"#part-advanced-topics": "advanced-topics/advanced-topics.html", "index.html": {
"#chap-tuning-cores-and-jobs": "advanced-topics/cores-vs-jobs.html", "part-advanced-topics": "advanced-topics/advanced-topics.html",
"#chap-diff-hook": "advanced-topics/diff-hook.html", "chap-tuning-cores-and-jobs": "advanced-topics/cores-vs-jobs.html",
"#check-dirs-are-unregistered": "advanced-topics/diff-hook.html#check-dirs-are-unregistered", "chap-diff-hook": "advanced-topics/diff-hook.html",
"#chap-distributed-builds": "advanced-topics/distributed-builds.html", "check-dirs-are-unregistered": "advanced-topics/diff-hook.html#check-dirs-are-unregistered",
"#chap-post-build-hook": "advanced-topics/post-build-hook.html", "chap-distributed-builds": "advanced-topics/distributed-builds.html",
"#chap-post-build-hook-caveats": "advanced-topics/post-build-hook.html#implementation-caveats", "chap-post-build-hook": "advanced-topics/post-build-hook.html",
"#part-command-ref": "command-ref/command-ref.html", "chap-post-build-hook-caveats": "advanced-topics/post-build-hook.html#implementation-caveats",
"#conf-allow-import-from-derivation": "command-ref/conf-file.html#conf-allow-import-from-derivation", "part-command-ref": "command-ref/command-ref.html",
"#conf-allow-new-privileges": "command-ref/conf-file.html#conf-allow-new-privileges", "conf-allow-import-from-derivation": "command-ref/conf-file.html#conf-allow-import-from-derivation",
"#conf-allowed-uris": "command-ref/conf-file.html#conf-allowed-uris", "conf-allow-new-privileges": "command-ref/conf-file.html#conf-allow-new-privileges",
"#conf-allowed-users": "command-ref/conf-file.html#conf-allowed-users", "conf-allowed-uris": "command-ref/conf-file.html#conf-allowed-uris",
"#conf-auto-optimise-store": "command-ref/conf-file.html#conf-auto-optimise-store", "conf-allowed-users": "command-ref/conf-file.html#conf-allowed-users",
"#conf-binary-cache-public-keys": "command-ref/conf-file.html#conf-binary-cache-public-keys", "conf-auto-optimise-store": "command-ref/conf-file.html#conf-auto-optimise-store",
"#conf-binary-caches": "command-ref/conf-file.html#conf-binary-caches", "conf-binary-cache-public-keys": "command-ref/conf-file.html#conf-binary-cache-public-keys",
"#conf-build-compress-log": "command-ref/conf-file.html#conf-build-compress-log", "conf-binary-caches": "command-ref/conf-file.html#conf-binary-caches",
"#conf-build-cores": "command-ref/conf-file.html#conf-build-cores", "conf-build-compress-log": "command-ref/conf-file.html#conf-build-compress-log",
"#conf-build-extra-chroot-dirs": "command-ref/conf-file.html#conf-build-extra-chroot-dirs", "conf-build-cores": "command-ref/conf-file.html#conf-build-cores",
"#conf-build-extra-sandbox-paths": "command-ref/conf-file.html#conf-build-extra-sandbox-paths", "conf-build-extra-chroot-dirs": "command-ref/conf-file.html#conf-build-extra-chroot-dirs",
"#conf-build-fallback": "command-ref/conf-file.html#conf-build-fallback", "conf-build-extra-sandbox-paths": "command-ref/conf-file.html#conf-build-extra-sandbox-paths",
"#conf-build-max-jobs": "command-ref/conf-file.html#conf-build-max-jobs", "conf-build-fallback": "command-ref/conf-file.html#conf-build-fallback",
"#conf-build-max-log-size": "command-ref/conf-file.html#conf-build-max-log-size", "conf-build-max-jobs": "command-ref/conf-file.html#conf-build-max-jobs",
"#conf-build-max-silent-time": "command-ref/conf-file.html#conf-build-max-silent-time", "conf-build-max-log-size": "command-ref/conf-file.html#conf-build-max-log-size",
"#conf-build-repeat": "command-ref/conf-file.html#conf-build-repeat", "conf-build-max-silent-time": "command-ref/conf-file.html#conf-build-max-silent-time",
"#conf-build-timeout": "command-ref/conf-file.html#conf-build-timeout", "conf-build-repeat": "command-ref/conf-file.html#conf-build-repeat",
"#conf-build-use-chroot": "command-ref/conf-file.html#conf-build-use-chroot", "conf-build-timeout": "command-ref/conf-file.html#conf-build-timeout",
"#conf-build-use-sandbox": "command-ref/conf-file.html#conf-build-use-sandbox", "conf-build-use-chroot": "command-ref/conf-file.html#conf-build-use-chroot",
"#conf-build-use-substitutes": "command-ref/conf-file.html#conf-build-use-substitutes", "conf-build-use-sandbox": "command-ref/conf-file.html#conf-build-use-sandbox",
"#conf-build-users-group": "command-ref/conf-file.html#conf-build-users-group", "conf-build-use-substitutes": "command-ref/conf-file.html#conf-build-use-substitutes",
"#conf-builders": "command-ref/conf-file.html#conf-builders", "conf-build-users-group": "command-ref/conf-file.html#conf-build-users-group",
"#conf-builders-use-substitutes": "command-ref/conf-file.html#conf-builders-use-substitutes", "conf-builders": "command-ref/conf-file.html#conf-builders",
"#conf-compress-build-log": "command-ref/conf-file.html#conf-compress-build-log", "conf-builders-use-substitutes": "command-ref/conf-file.html#conf-builders-use-substitutes",
"#conf-connect-timeout": "command-ref/conf-file.html#conf-connect-timeout", "conf-compress-build-log": "command-ref/conf-file.html#conf-compress-build-log",
"#conf-cores": "command-ref/conf-file.html#conf-cores", "conf-connect-timeout": "command-ref/conf-file.html#conf-connect-timeout",
"#conf-diff-hook": "command-ref/conf-file.html#conf-diff-hook", "conf-cores": "command-ref/conf-file.html#conf-cores",
"#conf-enforce-determinism": "command-ref/conf-file.html#conf-enforce-determinism", "conf-diff-hook": "command-ref/conf-file.html#conf-diff-hook",
"#conf-env-keep-derivations": "command-ref/conf-file.html#conf-env-keep-derivations", "conf-enforce-determinism": "command-ref/conf-file.html#conf-enforce-determinism",
"#conf-extra-binary-caches": "command-ref/conf-file.html#conf-extra-binary-caches", "conf-env-keep-derivations": "command-ref/conf-file.html#conf-env-keep-derivations",
"#conf-extra-platforms": "command-ref/conf-file.html#conf-extra-platforms", "conf-extra-binary-caches": "command-ref/conf-file.html#conf-extra-binary-caches",
"#conf-extra-sandbox-paths": "command-ref/conf-file.html#conf-extra-sandbox-paths", "conf-extra-platforms": "command-ref/conf-file.html#conf-extra-platforms",
"#conf-extra-substituters": "command-ref/conf-file.html#conf-extra-substituters", "conf-extra-sandbox-paths": "command-ref/conf-file.html#conf-extra-sandbox-paths",
"#conf-fallback": "command-ref/conf-file.html#conf-fallback", "conf-extra-substituters": "command-ref/conf-file.html#conf-extra-substituters",
"#conf-fsync-metadata": "command-ref/conf-file.html#conf-fsync-metadata", "conf-fallback": "command-ref/conf-file.html#conf-fallback",
"#conf-gc-keep-derivations": "command-ref/conf-file.html#conf-gc-keep-derivations", "conf-fsync-metadata": "command-ref/conf-file.html#conf-fsync-metadata",
"#conf-gc-keep-outputs": "command-ref/conf-file.html#conf-gc-keep-outputs", "conf-gc-keep-derivations": "command-ref/conf-file.html#conf-gc-keep-derivations",
"#conf-hashed-mirrors": "command-ref/conf-file.html#conf-hashed-mirrors", "conf-gc-keep-outputs": "command-ref/conf-file.html#conf-gc-keep-outputs",
"#conf-http-connections": "command-ref/conf-file.html#conf-http-connections", "conf-hashed-mirrors": "command-ref/conf-file.html#conf-hashed-mirrors",
"#conf-keep-build-log": "command-ref/conf-file.html#conf-keep-build-log", "conf-http-connections": "command-ref/conf-file.html#conf-http-connections",
"#conf-keep-derivations": "command-ref/conf-file.html#conf-keep-derivations", "conf-keep-build-log": "command-ref/conf-file.html#conf-keep-build-log",
"#conf-keep-env-derivations": "command-ref/conf-file.html#conf-keep-env-derivations", "conf-keep-derivations": "command-ref/conf-file.html#conf-keep-derivations",
"#conf-keep-outputs": "command-ref/conf-file.html#conf-keep-outputs", "conf-keep-env-derivations": "command-ref/conf-file.html#conf-keep-env-derivations",
"#conf-max-build-log-size": "command-ref/conf-file.html#conf-max-build-log-size", "conf-keep-outputs": "command-ref/conf-file.html#conf-keep-outputs",
"#conf-max-free": "command-ref/conf-file.html#conf-max-free", "conf-max-build-log-size": "command-ref/conf-file.html#conf-max-build-log-size",
"#conf-max-jobs": "command-ref/conf-file.html#conf-max-jobs", "conf-max-free": "command-ref/conf-file.html#conf-max-free",
"#conf-max-silent-time": "command-ref/conf-file.html#conf-max-silent-time", "conf-max-jobs": "command-ref/conf-file.html#conf-max-jobs",
"#conf-min-free": "command-ref/conf-file.html#conf-min-free", "conf-max-silent-time": "command-ref/conf-file.html#conf-max-silent-time",
"#conf-narinfo-cache-negative-ttl": "command-ref/conf-file.html#conf-narinfo-cache-negative-ttl", "conf-min-free": "command-ref/conf-file.html#conf-min-free",
"#conf-narinfo-cache-positive-ttl": "command-ref/conf-file.html#conf-narinfo-cache-positive-ttl", "conf-narinfo-cache-negative-ttl": "command-ref/conf-file.html#conf-narinfo-cache-negative-ttl",
"#conf-netrc-file": "command-ref/conf-file.html#conf-netrc-file", "conf-narinfo-cache-positive-ttl": "command-ref/conf-file.html#conf-narinfo-cache-positive-ttl",
"#conf-plugin-files": "command-ref/conf-file.html#conf-plugin-files", "conf-netrc-file": "command-ref/conf-file.html#conf-netrc-file",
"#conf-post-build-hook": "command-ref/conf-file.html#conf-post-build-hook", "conf-plugin-files": "command-ref/conf-file.html#conf-plugin-files",
"#conf-pre-build-hook": "command-ref/conf-file.html#conf-pre-build-hook", "conf-post-build-hook": "command-ref/conf-file.html#conf-post-build-hook",
"#conf-repeat": "command-ref/conf-file.html#conf-repeat", "conf-pre-build-hook": "command-ref/conf-file.html#conf-pre-build-hook",
"#conf-require-sigs": "command-ref/conf-file.html#conf-require-sigs", "conf-repeat": "command-ref/conf-file.html#conf-repeat",
"#conf-restrict-eval": "command-ref/conf-file.html#conf-restrict-eval", "conf-require-sigs": "command-ref/conf-file.html#conf-require-sigs",
"#conf-run-diff-hook": "command-ref/conf-file.html#conf-run-diff-hook", "conf-restrict-eval": "command-ref/conf-file.html#conf-restrict-eval",
"#conf-sandbox": "command-ref/conf-file.html#conf-sandbox", "conf-run-diff-hook": "command-ref/conf-file.html#conf-run-diff-hook",
"#conf-sandbox-dev-shm-size": "command-ref/conf-file.html#conf-sandbox-dev-shm-size", "conf-sandbox": "command-ref/conf-file.html#conf-sandbox",
"#conf-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths", "conf-sandbox-dev-shm-size": "command-ref/conf-file.html#conf-sandbox-dev-shm-size",
"#conf-secret-key-files": "command-ref/conf-file.html#conf-secret-key-files", "conf-sandbox-paths": "command-ref/conf-file.html#conf-sandbox-paths",
"#conf-show-trace": "command-ref/conf-file.html#conf-show-trace", "conf-secret-key-files": "command-ref/conf-file.html#conf-secret-key-files",
"#conf-stalled-download-timeout": "command-ref/conf-file.html#conf-stalled-download-timeout", "conf-show-trace": "command-ref/conf-file.html#conf-show-trace",
"#conf-substitute": "command-ref/conf-file.html#conf-substitute", "conf-stalled-download-timeout": "command-ref/conf-file.html#conf-stalled-download-timeout",
"#conf-substituters": "command-ref/conf-file.html#conf-substituters", "conf-substitute": "command-ref/conf-file.html#conf-substitute",
"#conf-system": "command-ref/conf-file.html#conf-system", "conf-substituters": "command-ref/conf-file.html#conf-substituters",
"#conf-system-features": "command-ref/conf-file.html#conf-system-features", "conf-system": "command-ref/conf-file.html#conf-system",
"#conf-tarball-ttl": "command-ref/conf-file.html#conf-tarball-ttl", "conf-system-features": "command-ref/conf-file.html#conf-system-features",
"#conf-timeout": "command-ref/conf-file.html#conf-timeout", "conf-tarball-ttl": "command-ref/conf-file.html#conf-tarball-ttl",
"#conf-trace-function-calls": "command-ref/conf-file.html#conf-trace-function-calls", "conf-timeout": "command-ref/conf-file.html#conf-timeout",
"#conf-trusted-binary-caches": "command-ref/conf-file.html#conf-trusted-binary-caches", "conf-trace-function-calls": "command-ref/conf-file.html#conf-trace-function-calls",
"#conf-trusted-public-keys": "command-ref/conf-file.html#conf-trusted-public-keys", "conf-trusted-binary-caches": "command-ref/conf-file.html#conf-trusted-binary-caches",
"#conf-trusted-substituters": "command-ref/conf-file.html#conf-trusted-substituters", "conf-trusted-public-keys": "command-ref/conf-file.html#conf-trusted-public-keys",
"#conf-trusted-users": "command-ref/conf-file.html#conf-trusted-users", "conf-trusted-substituters": "command-ref/conf-file.html#conf-trusted-substituters",
"#extra-sandbox-paths": "command-ref/conf-file.html#extra-sandbox-paths", "conf-trusted-users": "command-ref/conf-file.html#conf-trusted-users",
"#sec-conf-file": "command-ref/conf-file.html", "extra-sandbox-paths": "command-ref/conf-file.html#extra-sandbox-paths",
"#env-NIX_PATH": "command-ref/env-common.html#env-NIX_PATH", "sec-conf-file": "command-ref/conf-file.html",
"#env-common": "command-ref/env-common.html", "env-NIX_PATH": "command-ref/env-common.html#env-NIX_PATH",
"#envar-remote": "command-ref/env-common.html#env-NIX_REMOTE", "env-common": "command-ref/env-common.html",
"#sec-common-env": "command-ref/env-common.html", "envar-remote": "command-ref/env-common.html#env-NIX_REMOTE",
"#ch-files": "command-ref/files.html", "sec-common-env": "command-ref/env-common.html",
"#ch-main-commands": "command-ref/main-commands.html", "ch-files": "command-ref/files.html",
"#opt-out-link": "command-ref/nix-build.html#opt-out-link", "ch-main-commands": "command-ref/main-commands.html",
"#sec-nix-build": "command-ref/nix-build.html", "opt-out-link": "command-ref/nix-build.html#opt-out-link",
"#sec-nix-channel": "command-ref/nix-channel.html", "sec-nix-build": "command-ref/nix-build.html",
"#sec-nix-collect-garbage": "command-ref/nix-collect-garbage.html", "sec-nix-channel": "command-ref/nix-channel.html",
"#sec-nix-copy-closure": "command-ref/nix-copy-closure.html", "sec-nix-collect-garbage": "command-ref/nix-collect-garbage.html",
"#sec-nix-daemon": "command-ref/nix-daemon.html", "sec-nix-copy-closure": "command-ref/nix-copy-closure.html",
"#refsec-nix-env-install-examples": "command-ref/nix-env.html#examples", "sec-nix-daemon": "command-ref/nix-daemon.html",
"#rsec-nix-env-install": "command-ref/nix-env.html#operation---install", "refsec-nix-env-install-examples": "command-ref/nix-env.html#examples",
"#rsec-nix-env-set": "command-ref/nix-env.html#operation---set", "rsec-nix-env-install": "command-ref/nix-env.html#operation---install",
"#rsec-nix-env-set-flag": "command-ref/nix-env.html#operation---set-flag", "rsec-nix-env-set": "command-ref/nix-env.html#operation---set",
"#rsec-nix-env-upgrade": "command-ref/nix-env.html#operation---upgrade", "rsec-nix-env-set-flag": "command-ref/nix-env.html#operation---set-flag",
"#sec-nix-env": "command-ref/nix-env.html", "rsec-nix-env-upgrade": "command-ref/nix-env.html#operation---upgrade",
"#ssec-version-comparisons": "command-ref/nix-env.html#versions", "sec-nix-env": "command-ref/nix-env.html",
"#sec-nix-hash": "command-ref/nix-hash.html", "ssec-version-comparisons": "command-ref/nix-env.html#versions",
"#sec-nix-instantiate": "command-ref/nix-instantiate.html", "sec-nix-hash": "command-ref/nix-hash.html",
"#sec-nix-prefetch-url": "command-ref/nix-prefetch-url.html", "sec-nix-instantiate": "command-ref/nix-instantiate.html",
"#sec-nix-shell": "command-ref/nix-shell.html", "sec-nix-prefetch-url": "command-ref/nix-prefetch-url.html",
"#ssec-nix-shell-shebang": "command-ref/nix-shell.html#use-as-a--interpreter", "sec-nix-shell": "command-ref/nix-shell.html",
"#nixref-queries": "command-ref/nix-store.html#queries", "ssec-nix-shell-shebang": "command-ref/nix-shell.html#use-as-a--interpreter",
"#opt-add-root": "command-ref/nix-store.html#opt-add-root", "nixref-queries": "command-ref/nix-store.html#queries",
"#refsec-nix-store-dump": "command-ref/nix-store.html#operation---dump", "opt-add-root": "command-ref/nix-store.html#opt-add-root",
"#refsec-nix-store-export": "command-ref/nix-store.html#operation---export", "refsec-nix-store-dump": "command-ref/nix-store.html#operation---dump",
"#refsec-nix-store-import": "command-ref/nix-store.html#operation---import", "refsec-nix-store-export": "command-ref/nix-store.html#operation---export",
"#refsec-nix-store-query": "command-ref/nix-store.html#operation---query", "refsec-nix-store-import": "command-ref/nix-store.html#operation---import",
"#refsec-nix-store-verify": "command-ref/nix-store.html#operation---verify", "refsec-nix-store-query": "command-ref/nix-store.html#operation---query",
"#rsec-nix-store-gc": "command-ref/nix-store.html#operation---gc", "refsec-nix-store-verify": "command-ref/nix-store.html#operation---verify",
"#rsec-nix-store-generate-binary-cache-key": "command-ref/nix-store.html#operation---generate-binary-cache-key", "rsec-nix-store-gc": "command-ref/nix-store.html#operation---gc",
"#rsec-nix-store-realise": "command-ref/nix-store.html#operation---realise", "rsec-nix-store-generate-binary-cache-key": "command-ref/nix-store.html#operation---generate-binary-cache-key",
"#rsec-nix-store-serve": "command-ref/nix-store.html#operation---serve", "rsec-nix-store-realise": "command-ref/nix-store.html#operation---realise",
"#sec-nix-store": "command-ref/nix-store.html", "rsec-nix-store-serve": "command-ref/nix-store.html#operation---serve",
"#opt-I": "command-ref/opt-common.html#opt-I", "sec-nix-store": "command-ref/nix-store.html",
"#opt-attr": "command-ref/opt-common.html#opt-attr", "opt-I": "command-ref/opt-common.html#opt-I",
"#opt-common": "command-ref/opt-common.html", "opt-attr": "command-ref/opt-common.html#opt-attr",
"#opt-cores": "command-ref/opt-common.html#opt-cores", "opt-common": "command-ref/opt-common.html",
"#opt-log-format": "command-ref/opt-common.html#opt-log-format", "opt-cores": "command-ref/opt-common.html#opt-cores",
"#opt-max-jobs": "command-ref/opt-common.html#opt-max-jobs", "opt-log-format": "command-ref/opt-common.html#opt-log-format",
"#opt-max-silent-time": "command-ref/opt-common.html#opt-max-silent-time", "opt-max-jobs": "command-ref/opt-common.html#opt-max-jobs",
"#opt-timeout": "command-ref/opt-common.html#opt-timeout", "opt-max-silent-time": "command-ref/opt-common.html#opt-max-silent-time",
"#sec-common-options": "command-ref/opt-common.html", "opt-timeout": "command-ref/opt-common.html#opt-timeout",
"#ch-utilities": "command-ref/utilities.html", "sec-common-options": "command-ref/opt-common.html",
"#chap-hacking": "contributing/hacking.html", "ch-utilities": "command-ref/utilities.html",
"#adv-attr-allowSubstitutes": "language/advanced-attributes.html#adv-attr-allowSubstitutes", "chap-hacking": "contributing/hacking.html",
"#adv-attr-allowedReferences": "language/advanced-attributes.html#adv-attr-allowedReferences", "adv-attr-allowSubstitutes": "language/advanced-attributes.html#adv-attr-allowSubstitutes",
"#adv-attr-allowedRequisites": "language/advanced-attributes.html#adv-attr-allowedRequisites", "adv-attr-allowedReferences": "language/advanced-attributes.html#adv-attr-allowedReferences",
"#adv-attr-disallowedReferences": "language/advanced-attributes.html#adv-attr-disallowedReferences", "adv-attr-allowedRequisites": "language/advanced-attributes.html#adv-attr-allowedRequisites",
"#adv-attr-disallowedRequisites": "language/advanced-attributes.html#adv-attr-disallowedRequisites", "adv-attr-disallowedReferences": "language/advanced-attributes.html#adv-attr-disallowedReferences",
"#adv-attr-exportReferencesGraph": "language/advanced-attributes.html#adv-attr-exportReferencesGraph", "adv-attr-disallowedRequisites": "language/advanced-attributes.html#adv-attr-disallowedRequisites",
"#adv-attr-impureEnvVars": "language/advanced-attributes.html#adv-attr-impureEnvVars", "adv-attr-exportReferencesGraph": "language/advanced-attributes.html#adv-attr-exportReferencesGraph",
"#adv-attr-outputHash": "language/advanced-attributes.html#adv-attr-outputHash", "adv-attr-impureEnvVars": "language/advanced-attributes.html#adv-attr-impureEnvVars",
"#adv-attr-outputHashAlgo": "language/advanced-attributes.html#adv-attr-outputHashAlgo", "adv-attr-outputHash": "language/advanced-attributes.html#adv-attr-outputHash",
"#adv-attr-outputHashMode": "language/advanced-attributes.html#adv-attr-outputHashMode", "adv-attr-outputHashAlgo": "language/advanced-attributes.html#adv-attr-outputHashAlgo",
"#adv-attr-passAsFile": "language/advanced-attributes.html#adv-attr-passAsFile", "adv-attr-outputHashMode": "language/advanced-attributes.html#adv-attr-outputHashMode",
"#adv-attr-preferLocalBuild": "language/advanced-attributes.html#adv-attr-preferLocalBuild", "adv-attr-passAsFile": "language/advanced-attributes.html#adv-attr-passAsFile",
"#fixed-output-drvs": "language/advanced-attributes.html#adv-attr-outputHash", "adv-attr-preferLocalBuild": "language/advanced-attributes.html#adv-attr-preferLocalBuild",
"#sec-advanced-attributes": "language/advanced-attributes.html", "fixed-output-drvs": "language/advanced-attributes.html#adv-attr-outputHash",
"#builtin-abort": "language/builtins.html#builtins-abort", "sec-advanced-attributes": "language/advanced-attributes.html",
"#builtin-add": "language/builtins.html#builtins-add", "builtin-abort": "language/builtins.html#builtins-abort",
"#builtin-all": "language/builtins.html#builtins-all", "builtin-add": "language/builtins.html#builtins-add",
"#builtin-any": "language/builtins.html#builtins-any", "builtin-all": "language/builtins.html#builtins-all",
"#builtin-attrNames": "language/builtins.html#builtins-attrNames", "builtin-any": "language/builtins.html#builtins-any",
"#builtin-attrValues": "language/builtins.html#builtins-attrValues", "builtin-attrNames": "language/builtins.html#builtins-attrNames",
"#builtin-baseNameOf": "language/builtins.html#builtins-baseNameOf", "builtin-attrValues": "language/builtins.html#builtins-attrValues",
"#builtin-bitAnd": "language/builtins.html#builtins-bitAnd", "builtin-baseNameOf": "language/builtins.html#builtins-baseNameOf",
"#builtin-bitOr": "language/builtins.html#builtins-bitOr", "builtin-bitAnd": "language/builtins.html#builtins-bitAnd",
"#builtin-bitXor": "language/builtins.html#builtins-bitXor", "builtin-bitOr": "language/builtins.html#builtins-bitOr",
"#builtin-builtins": "language/builtins.html#builtins-builtins", "builtin-bitXor": "language/builtins.html#builtins-bitXor",
"#builtin-compareVersions": "language/builtins.html#builtins-compareVersions", "builtin-builtins": "language/builtins.html#builtins-builtins",
"#builtin-concatLists": "language/builtins.html#builtins-concatLists", "builtin-compareVersions": "language/builtins.html#builtins-compareVersions",
"#builtin-concatStringsSep": "language/builtins.html#builtins-concatStringsSep", "builtin-concatLists": "language/builtins.html#builtins-concatLists",
"#builtin-currentSystem": "language/builtins.html#builtins-currentSystem", "builtin-concatStringsSep": "language/builtins.html#builtins-concatStringsSep",
"#builtin-deepSeq": "language/builtins.html#builtins-deepSeq", "builtin-currentSystem": "language/builtins.html#builtins-currentSystem",
"#builtin-derivation": "language/builtins.html#builtins-derivation", "builtin-deepSeq": "language/builtins.html#builtins-deepSeq",
"#builtin-dirOf": "language/builtins.html#builtins-dirOf", "builtin-derivation": "language/builtins.html#builtins-derivation",
"#builtin-div": "language/builtins.html#builtins-div", "builtin-dirOf": "language/builtins.html#builtins-dirOf",
"#builtin-elem": "language/builtins.html#builtins-elem", "builtin-div": "language/builtins.html#builtins-div",
"#builtin-elemAt": "language/builtins.html#builtins-elemAt", "builtin-elem": "language/builtins.html#builtins-elem",
"#builtin-fetchGit": "language/builtins.html#builtins-fetchGit", "builtin-elemAt": "language/builtins.html#builtins-elemAt",
"#builtin-fetchTarball": "language/builtins.html#builtins-fetchTarball", "builtin-fetchGit": "language/builtins.html#builtins-fetchGit",
"#builtin-fetchurl": "language/builtins.html#builtins-fetchurl", "builtin-fetchTarball": "language/builtins.html#builtins-fetchTarball",
"#builtin-filterSource": "language/builtins.html#builtins-filterSource", "builtin-fetchurl": "language/builtins.html#builtins-fetchurl",
"#builtin-foldl-prime": "language/builtins.html#builtins-foldl-prime", "builtin-filterSource": "language/builtins.html#builtins-filterSource",
"#builtin-fromJSON": "language/builtins.html#builtins-fromJSON", "builtin-foldl-prime": "language/builtins.html#builtins-foldl-prime",
"#builtin-functionArgs": "language/builtins.html#builtins-functionArgs", "builtin-fromJSON": "language/builtins.html#builtins-fromJSON",
"#builtin-genList": "language/builtins.html#builtins-genList", "builtin-functionArgs": "language/builtins.html#builtins-functionArgs",
"#builtin-getAttr": "language/builtins.html#builtins-getAttr", "builtin-genList": "language/builtins.html#builtins-genList",
"#builtin-getEnv": "language/builtins.html#builtins-getEnv", "builtin-getAttr": "language/builtins.html#builtins-getAttr",
"#builtin-hasAttr": "language/builtins.html#builtins-hasAttr", "builtin-getEnv": "language/builtins.html#builtins-getEnv",
"#builtin-hashFile": "language/builtins.html#builtins-hashFile", "builtin-hasAttr": "language/builtins.html#builtins-hasAttr",
"#builtin-hashString": "language/builtins.html#builtins-hashString", "builtin-hashFile": "language/builtins.html#builtins-hashFile",
"#builtin-head": "language/builtins.html#builtins-head", "builtin-hashString": "language/builtins.html#builtins-hashString",
"#builtin-import": "language/builtins.html#builtins-import", "builtin-head": "language/builtins.html#builtins-head",
"#builtin-intersectAttrs": "language/builtins.html#builtins-intersectAttrs", "builtin-import": "language/builtins.html#builtins-import",
"#builtin-isAttrs": "language/builtins.html#builtins-isAttrs", "builtin-intersectAttrs": "language/builtins.html#builtins-intersectAttrs",
"#builtin-isBool": "language/builtins.html#builtins-isBool", "builtin-isAttrs": "language/builtins.html#builtins-isAttrs",
"#builtin-isFloat": "language/builtins.html#builtins-isFloat", "builtin-isBool": "language/builtins.html#builtins-isBool",
"#builtin-isFunction": "language/builtins.html#builtins-isFunction", "builtin-isFloat": "language/builtins.html#builtins-isFloat",
"#builtin-isInt": "language/builtins.html#builtins-isInt", "builtin-isFunction": "language/builtins.html#builtins-isFunction",
"#builtin-isList": "language/builtins.html#builtins-isList", "builtin-isInt": "language/builtins.html#builtins-isInt",
"#builtin-isNull": "language/builtins.html#builtins-isNull", "builtin-isList": "language/builtins.html#builtins-isList",
"#builtin-isString": "language/builtins.html#builtins-isString", "builtin-isNull": "language/builtins.html#builtins-isNull",
"#builtin-length": "language/builtins.html#builtins-length", "builtin-isString": "language/builtins.html#builtins-isString",
"#builtin-lessThan": "language/builtins.html#builtins-lessThan", "builtin-length": "language/builtins.html#builtins-length",
"#builtin-listToAttrs": "language/builtins.html#builtins-listToAttrs", "builtin-lessThan": "language/builtins.html#builtins-lessThan",
"#builtin-map": "language/builtins.html#builtins-map", "builtin-listToAttrs": "language/builtins.html#builtins-listToAttrs",
"#builtin-match": "language/builtins.html#builtins-match", "builtin-map": "language/builtins.html#builtins-map",
"#builtin-mul": "language/builtins.html#builtins-mul", "builtin-match": "language/builtins.html#builtins-match",
"#builtin-parseDrvName": "language/builtins.html#builtins-parseDrvName", "builtin-mul": "language/builtins.html#builtins-mul",
"#builtin-path": "language/builtins.html#builtins-path", "builtin-parseDrvName": "language/builtins.html#builtins-parseDrvName",
"#builtin-pathExists": "language/builtins.html#builtins-pathExists", "builtin-path": "language/builtins.html#builtins-path",
"#builtin-placeholder": "language/builtins.html#builtins-placeholder", "builtin-pathExists": "language/builtins.html#builtins-pathExists",
"#builtin-readDir": "language/builtins.html#builtins-readDir", "builtin-placeholder": "language/builtins.html#builtins-placeholder",
"#builtin-readFile": "language/builtins.html#builtins-readFile", "builtin-readDir": "language/builtins.html#builtins-readDir",
"#builtin-removeAttrs": "language/builtins.html#builtins-removeAttrs", "builtin-readFile": "language/builtins.html#builtins-readFile",
"#builtin-replaceStrings": "language/builtins.html#builtins-replaceStrings", "builtin-removeAttrs": "language/builtins.html#builtins-removeAttrs",
"#builtin-seq": "language/builtins.html#builtins-seq", "builtin-replaceStrings": "language/builtins.html#builtins-replaceStrings",
"#builtin-sort": "language/builtins.html#builtins-sort", "builtin-seq": "language/builtins.html#builtins-seq",
"#builtin-split": "language/builtins.html#builtins-split", "builtin-sort": "language/builtins.html#builtins-sort",
"#builtin-splitVersion": "language/builtins.html#builtins-splitVersion", "builtin-split": "language/builtins.html#builtins-split",
"#builtin-stringLength": "language/builtins.html#builtins-stringLength", "builtin-splitVersion": "language/builtins.html#builtins-splitVersion",
"#builtin-sub": "language/builtins.html#builtins-sub", "builtin-stringLength": "language/builtins.html#builtins-stringLength",
"#builtin-substring": "language/builtins.html#builtins-substring", "builtin-sub": "language/builtins.html#builtins-sub",
"#builtin-tail": "language/builtins.html#builtins-tail", "builtin-substring": "language/builtins.html#builtins-substring",
"#builtin-throw": "language/builtins.html#builtins-throw", "builtin-tail": "language/builtins.html#builtins-tail",
"#builtin-toFile": "language/builtins.html#builtins-toFile", "builtin-throw": "language/builtins.html#builtins-throw",
"#builtin-toJSON": "language/builtins.html#builtins-toJSON", "builtin-toFile": "language/builtins.html#builtins-toFile",
"#builtin-toPath": "language/builtins.html#builtins-toPath", "builtin-toJSON": "language/builtins.html#builtins-toJSON",
"#builtin-toString": "language/builtins.html#builtins-toString", "builtin-toPath": "language/builtins.html#builtins-toPath",
"#builtin-toXML": "language/builtins.html#builtins-toXML", "builtin-toString": "language/builtins.html#builtins-toString",
"#builtin-trace": "language/builtins.html#builtins-trace", "builtin-toXML": "language/builtins.html#builtins-toXML",
"#builtin-tryEval": "language/builtins.html#builtins-tryEval", "builtin-trace": "language/builtins.html#builtins-trace",
"#builtin-typeOf": "language/builtins.html#builtins-typeOf", "builtin-tryEval": "language/builtins.html#builtins-tryEval",
"#ssec-builtins": "language/builtins.html", "builtin-typeOf": "language/builtins.html#builtins-typeOf",
"#attr-system": "language/derivations.html#attr-system", "ssec-builtins": "language/builtins.html",
"#ssec-derivation": "language/derivations.html", "attr-system": "language/derivations.html#attr-system",
"#ch-expression-language": "language/index.html", "ssec-derivation": "language/derivations.html",
"#sec-constructs": "language/constructs.html", "ch-expression-language": "language/index.html",
"#sect-let-language": "language/constructs.html#let-language", "sec-constructs": "language/constructs.html",
"#ss-functions": "language/constructs.html#functions", "sect-let-language": "language/constructs.html#let-language",
"#sec-language-operators": "language/operators.html", "ss-functions": "language/constructs.html#functions",
"#table-operators": "language/operators.html", "sec-language-operators": "language/operators.html",
"#ssec-values": "language/values.html", "table-operators": "language/operators.html",
"#gloss-closure": "glossary.html#gloss-closure", "ssec-values": "language/values.html",
"#gloss-derivation": "glossary.html#gloss-derivation", "gloss-closure": "glossary.html#gloss-closure",
"#gloss-deriver": "glossary.html#gloss-deriver", "gloss-derivation": "glossary.html#gloss-derivation",
"#gloss-nar": "glossary.html#gloss-nar", "gloss-deriver": "glossary.html#gloss-deriver",
"#gloss-output-path": "glossary.html#gloss-output-path", "gloss-nar": "glossary.html#gloss-nar",
"#gloss-profile": "glossary.html#gloss-profile", "gloss-output-path": "glossary.html#gloss-output-path",
"#gloss-reachable": "glossary.html#gloss-reachable", "gloss-profile": "glossary.html#gloss-profile",
"#gloss-reference": "glossary.html#gloss-reference", "gloss-reachable": "glossary.html#gloss-reachable",
"#gloss-substitute": "glossary.html#gloss-substitute", "gloss-reference": "glossary.html#gloss-reference",
"#gloss-user-env": "glossary.html#gloss-user-env", "gloss-substitute": "glossary.html#gloss-substitute",
"#gloss-validity": "glossary.html#gloss-validity", "gloss-user-env": "glossary.html#gloss-user-env",
"#part-glossary": "glossary.html", "gloss-validity": "glossary.html#gloss-validity",
"#sec-building-source": "installation/building-source.html", "part-glossary": "glossary.html",
"#ch-env-variables": "installation/env-variables.html", "sec-building-source": "installation/building-source.html",
"#sec-installer-proxy-settings": "installation/env-variables.html#proxy-environment-variables", "ch-env-variables": "installation/env-variables.html",
"#sec-nix-ssl-cert-file": "installation/env-variables.html#nix_ssl_cert_file", "sec-installer-proxy-settings": "installation/env-variables.html#proxy-environment-variables",
"#sec-nix-ssl-cert-file-with-nix-daemon-and-macos": "installation/env-variables.html#nix_ssl_cert_file-with-macos-and-the-nix-daemon", "sec-nix-ssl-cert-file": "installation/env-variables.html#nix_ssl_cert_file",
"#chap-installation": "installation/installation.html", "sec-nix-ssl-cert-file-with-nix-daemon-and-macos": "installation/env-variables.html#nix_ssl_cert_file-with-macos-and-the-nix-daemon",
"#ch-installing-binary": "installation/installing-binary.html", "chap-installation": "installation/installation.html",
"#sect-macos-installation": "installation/installing-binary.html#macos-installation", "ch-installing-binary": "installation/installing-binary.html",
"#sect-macos-installation-change-store-prefix": "installation/installing-binary.html#macos-installation", "sect-macos-installation": "installation/installing-binary.html#macos-installation",
"#sect-macos-installation-encrypted-volume": "installation/installing-binary.html#macos-installation", "sect-macos-installation-change-store-prefix": "installation/installing-binary.html#macos-installation",
"#sect-macos-installation-recommended-notes": "installation/installing-binary.html#macos-installation", "sect-macos-installation-encrypted-volume": "installation/installing-binary.html#macos-installation",
"#sect-macos-installation-symlink": "installation/installing-binary.html#macos-installation", "sect-macos-installation-recommended-notes": "installation/installing-binary.html#macos-installation",
"#sect-multi-user-installation": "installation/installing-binary.html#multi-user-installation", "sect-macos-installation-symlink": "installation/installing-binary.html#macos-installation",
"#sect-nix-install-binary-tarball": "installation/installing-binary.html#installing-from-a-binary-tarball", "sect-multi-user-installation": "installation/installing-binary.html#multi-user-installation",
"#sect-nix-install-pinned-version-url": "installation/installing-binary.html#installing-a-pinned-nix-version-from-a-url", "sect-nix-install-binary-tarball": "installation/installing-binary.html#installing-from-a-binary-tarball",
"#sect-single-user-installation": "installation/installing-binary.html#single-user-installation", "sect-nix-install-pinned-version-url": "installation/installing-binary.html#installing-a-pinned-nix-version-from-a-url",
"#ch-installing-source": "installation/installing-source.html", "sect-single-user-installation": "installation/installing-binary.html#single-user-installation",
"#ssec-multi-user": "installation/multi-user.html", "ch-installing-source": "installation/installing-source.html",
"#ch-nix-security": "installation/nix-security.html", "ssec-multi-user": "installation/multi-user.html",
"#sec-obtaining-source": "installation/obtaining-source.html", "ch-nix-security": "installation/nix-security.html",
"#sec-prerequisites-source": "installation/prerequisites-source.html", "sec-obtaining-source": "installation/obtaining-source.html",
"#sec-single-user": "installation/single-user.html", "sec-prerequisites-source": "installation/prerequisites-source.html",
"#ch-supported-platforms": "installation/supported-platforms.html", "sec-single-user": "installation/single-user.html",
"#ch-upgrading-nix": "installation/upgrading.html", "ch-supported-platforms": "installation/supported-platforms.html",
"#ch-about-nix": "introduction.html", "ch-upgrading-nix": "installation/upgrading.html",
"#chap-introduction": "introduction.html", "ch-about-nix": "introduction.html",
"#ch-basic-package-mgmt": "package-management/basic-package-mgmt.html", "chap-introduction": "introduction.html",
"#ssec-binary-cache-substituter": "package-management/binary-cache-substituter.html", "ch-basic-package-mgmt": "package-management/basic-package-mgmt.html",
"#sec-channels": "package-management/channels.html", "ssec-binary-cache-substituter": "package-management/binary-cache-substituter.html",
"#ssec-copy-closure": "package-management/copy-closure.html", "sec-channels": "package-management/channels.html",
"#sec-garbage-collection": "package-management/garbage-collection.html", "ssec-copy-closure": "package-management/copy-closure.html",
"#ssec-gc-roots": "package-management/garbage-collector-roots.html", "sec-garbage-collection": "package-management/garbage-collection.html",
"#chap-package-management": "package-management/package-management.html", "ssec-gc-roots": "package-management/garbage-collector-roots.html",
"#sec-profiles": "package-management/profiles.html", "chap-package-management": "package-management/package-management.html",
"#ssec-s3-substituter": "package-management/s3-substituter.html", "sec-profiles": "package-management/profiles.html",
"#ssec-s3-substituter-anonymous-reads": "package-management/s3-substituter.html#anonymous-reads-to-your-s3-compatible-binary-cache", "ssec-s3-substituter": "package-management/s3-substituter.html",
"#ssec-s3-substituter-authenticated-reads": "package-management/s3-substituter.html#authenticated-reads-to-your-s3-binary-cache", "ssec-s3-substituter-anonymous-reads": "package-management/s3-substituter.html#anonymous-reads-to-your-s3-compatible-binary-cache",
"#ssec-s3-substituter-authenticated-writes": "package-management/s3-substituter.html#authenticated-writes-to-your-s3-compatible-binary-cache", "ssec-s3-substituter-authenticated-reads": "package-management/s3-substituter.html#authenticated-reads-to-your-s3-binary-cache",
"#sec-sharing-packages": "package-management/sharing-packages.html", "ssec-s3-substituter-authenticated-writes": "package-management/s3-substituter.html#authenticated-writes-to-your-s3-compatible-binary-cache",
"#ssec-ssh-substituter": "package-management/ssh-substituter.html", "sec-sharing-packages": "package-management/sharing-packages.html",
"#chap-quick-start": "quick-start.html", "ssec-ssh-substituter": "package-management/ssh-substituter.html",
"#sec-relnotes": "release-notes/release-notes.html", "chap-quick-start": "quick-start.html",
"#ch-relnotes-0.10.1": "release-notes/rl-0.10.1.html", "sec-relnotes": "release-notes/release-notes.html",
"#ch-relnotes-0.10": "release-notes/rl-0.10.html", "ch-relnotes-0.10.1": "release-notes/rl-0.10.1.html",
"#ssec-relnotes-0.11": "release-notes/rl-0.11.html", "ch-relnotes-0.10": "release-notes/rl-0.10.html",
"#ssec-relnotes-0.12": "release-notes/rl-0.12.html", "ssec-relnotes-0.11": "release-notes/rl-0.11.html",
"#ssec-relnotes-0.13": "release-notes/rl-0.13.html", "ssec-relnotes-0.12": "release-notes/rl-0.12.html",
"#ssec-relnotes-0.14": "release-notes/rl-0.14.html", "ssec-relnotes-0.13": "release-notes/rl-0.13.html",
"#ssec-relnotes-0.15": "release-notes/rl-0.15.html", "ssec-relnotes-0.14": "release-notes/rl-0.14.html",
"#ssec-relnotes-0.16": "release-notes/rl-0.16.html", "ssec-relnotes-0.15": "release-notes/rl-0.15.html",
"#ch-relnotes-0.5": "release-notes/rl-0.5.html", "ssec-relnotes-0.16": "release-notes/rl-0.16.html",
"#ch-relnotes-0.6": "release-notes/rl-0.6.html", "ch-relnotes-0.5": "release-notes/rl-0.5.html",
"#ch-relnotes-0.7": "release-notes/rl-0.7.html", "ch-relnotes-0.6": "release-notes/rl-0.6.html",
"#ch-relnotes-0.8.1": "release-notes/rl-0.8.1.html", "ch-relnotes-0.7": "release-notes/rl-0.7.html",
"#ch-relnotes-0.8": "release-notes/rl-0.8.html", "ch-relnotes-0.8.1": "release-notes/rl-0.8.1.html",
"#ch-relnotes-0.9.1": "release-notes/rl-0.9.1.html", "ch-relnotes-0.8": "release-notes/rl-0.8.html",
"#ch-relnotes-0.9.2": "release-notes/rl-0.9.2.html", "ch-relnotes-0.9.1": "release-notes/rl-0.9.1.html",
"#ch-relnotes-0.9": "release-notes/rl-0.9.html", "ch-relnotes-0.9.2": "release-notes/rl-0.9.2.html",
"#ssec-relnotes-1.0": "release-notes/rl-1.0.html", "ch-relnotes-0.9": "release-notes/rl-0.9.html",
"#ssec-relnotes-1.1": "release-notes/rl-1.1.html", "ssec-relnotes-1.0": "release-notes/rl-1.0.html",
"#ssec-relnotes-1.10": "release-notes/rl-1.10.html", "ssec-relnotes-1.1": "release-notes/rl-1.1.html",
"#ssec-relnotes-1.11.10": "release-notes/rl-1.11.10.html", "ssec-relnotes-1.10": "release-notes/rl-1.10.html",
"#ssec-relnotes-1.11": "release-notes/rl-1.11.html", "ssec-relnotes-1.11.10": "release-notes/rl-1.11.10.html",
"#ssec-relnotes-1.2": "release-notes/rl-1.2.html", "ssec-relnotes-1.11": "release-notes/rl-1.11.html",
"#ssec-relnotes-1.3": "release-notes/rl-1.3.html", "ssec-relnotes-1.2": "release-notes/rl-1.2.html",
"#ssec-relnotes-1.4": "release-notes/rl-1.4.html", "ssec-relnotes-1.3": "release-notes/rl-1.3.html",
"#ssec-relnotes-1.5.1": "release-notes/rl-1.5.1.html", "ssec-relnotes-1.4": "release-notes/rl-1.4.html",
"#ssec-relnotes-1.5.2": "release-notes/rl-1.5.2.html", "ssec-relnotes-1.5.1": "release-notes/rl-1.5.1.html",
"#ssec-relnotes-1.5": "release-notes/rl-1.5.html", "ssec-relnotes-1.5.2": "release-notes/rl-1.5.2.html",
"#ssec-relnotes-1.6.1": "release-notes/rl-1.6.1.html", "ssec-relnotes-1.5": "release-notes/rl-1.5.html",
"#ssec-relnotes-1.6.0": "release-notes/rl-1.6.html", "ssec-relnotes-1.6.1": "release-notes/rl-1.6.1.html",
"#ssec-relnotes-1.7": "release-notes/rl-1.7.html", "ssec-relnotes-1.6.0": "release-notes/rl-1.6.html",
"#ssec-relnotes-1.8": "release-notes/rl-1.8.html", "ssec-relnotes-1.7": "release-notes/rl-1.7.html",
"#ssec-relnotes-1.9": "release-notes/rl-1.9.html", "ssec-relnotes-1.8": "release-notes/rl-1.8.html",
"#ssec-relnotes-2.0": "release-notes/rl-2.0.html", "ssec-relnotes-1.9": "release-notes/rl-1.9.html",
"#ssec-relnotes-2.1": "release-notes/rl-2.1.html", "ssec-relnotes-2.0": "release-notes/rl-2.0.html",
"#ssec-relnotes-2.2": "release-notes/rl-2.2.html", "ssec-relnotes-2.1": "release-notes/rl-2.1.html",
"#ssec-relnotes-2.3": "release-notes/rl-2.3.html" "ssec-relnotes-2.2": "release-notes/rl-2.2.html",
"ssec-relnotes-2.3": "release-notes/rl-2.3.html"
},
"language/values": {
"simple-values": "#primitives",
"lists": "#list",
"strings": "#string",
"lists": "#list",
"attribute-sets": "#attribute-set"
}
}; };
var isRoot = (document.location.pathname.endsWith('/') || document.location.pathname.endsWith('/index.html')) && path_to_root === '';
if (isRoot && redirects[document.location.hash]) { function pathsMatch(a, b, path_to_root) {
document.location.href = path_to_root + redirects[document.location.hash]; // Do paths `a` and `b` match?
//
// This is more involved than it should be:
//
// 1. Path `b` can have an have an arbitrary prefix.
//
// 2. `path_to_root` consists only of `../`s and determines the depth
// of `b` relative to the prefix:
//
// `document.location.pathname`
// |-----------------------------|
// <prefix>/<path>/[<file>[.html]][#<anchor>]
// |----|
// `path_to_root` has same number of segments
//
// 3. The following paths are equivalent:
//
// foo/bar/
// foo/bar/index.html
// foo/bar/index
//
// 4. The following paths are also equivalent:
//
// foo/bar/baz
// foo/bar/baz.html
//
// We can use `path_to_root` to discern prefix from path.
//
// The last element of the following split is always empty.
// Example: '../../'.split('/') -> [ '..', '..', '' ]
const depth = path_to_root.split('/').length - 1;
var segmentsB = b.split('/');
// get file name of `b`
const fileB = segmentsB.pop(); // mutates `segmentsB`!
// get path of `b` without prefix and file name
const pathB = segmentsB.slice(segmentsB.length - depth).join('/');
var segmentsA = a.split('/');
const fileA = segmentsA.pop(); // mutates `segmentsA`!
const pathA = segmentsA.join('/')
function normalize(file) {
if (file === '') { return "index.html"; }
if (!file.endsWith('.html')) { return file + '.html'; }
return file;
}
return pathA === pathB && normalize(fileA) === normalize(fileB);
}
// The anchor starts with the hash character (`#`),
// but our redirect declarations don't, so we strip it.
// Example: document.location.hash -> '#foo'
const anchor = document.location.hash.substring(1);
for (const [path, redirect] of Object.entries(redirects)) {
// The global variable `path_to_root` is set by `mdBook`:
//
// > This is a path containing exclusively `../`'s that points to the root of the
// > book from the current file. Since the original directory structure is
// > maintained, it is useful to prepend relative links with this `path_to_root`.
//
// Source: https://phaiax.github.io/mdBook/format/theme/index-hbs.html#data
if (pathsMatch(path, document.location.pathname, path_to_root) && redirect[anchor]) {
document.location.href = redirect[anchor];
break;
}
} }