General docs improvements for v3.0 (#2280)
* Split the docs into sections * Split the options page into two pages - so the reference is more clean * Reorder/Tidy up this 'deliver' page to make auto-deploy more obvious * Fix up some links * Merge the platform docs into a single page to clean up the navbar. * Split the setup page to make a page dedicated to CI setup * Move general platform-specific information into the platforms page * Tidy up the platforms page * Remove some redundancy in the cpp/platforms docs * Clarify this section * Move another FAQ entry to the platforms page * Remove some out-of-date entries from the FAQ * A few corrections to the options page * Fix some broken links * Improve the Docker references * Update bump version filename * Improve options TOC information density * whitespace Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com> * Convert the normal test invocation to `pytest ./tests`, not placeholder --------- Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
co-authored by
Henry Schreiner
parent
74a7d8a68e
commit
1d34f85c63
@@ -58,3 +58,54 @@ while (true) {
|
||||
// this will catch infinite loops which can occur when editing the above
|
||||
if (tabConversionIterations++ > 1000) throw 'too many iterations'
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects the current page based on the path and fragment identifier (hash) in the URL.
|
||||
*
|
||||
* Example usage:
|
||||
* fragmentRedirect([
|
||||
* { source: 'setup/#github-actions', destination: 'ci-services' }
|
||||
* { source: 'faq/#macosx', destination: 'platforms#apple' }
|
||||
* ])
|
||||
*/
|
||||
function fragmentRedirect(redirects) {
|
||||
const href = window.location.href;
|
||||
const hash = window.location.hash;
|
||||
|
||||
for (const redirect of redirects) {
|
||||
const source = redirect.source;
|
||||
const destination = redirect.destination;
|
||||
|
||||
if (endswith(href, source)) {
|
||||
// Redirect to the destination path, with the same fragment identifier
|
||||
// specified in the destination path, otherwise, keep the same hash
|
||||
// from the current URL.
|
||||
const destinationIncludesHash = destination.includes('#');
|
||||
let newUrl = href.replace(source, destination);
|
||||
if (!destinationIncludesHash) {
|
||||
newUrl += hash;
|
||||
}
|
||||
console.log('Redirecting to:', newUrl);
|
||||
window.location.replace(newUrl);
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function endswith(str, suffix) {
|
||||
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
||||
}
|
||||
|
||||
fragmentRedirect([
|
||||
{ source: 'setup/#github-actions', destination: 'ci-services/' },
|
||||
{ source: 'setup/#azure-pipelines', destination: 'ci-services/' },
|
||||
{ source: 'setup/#travis-ci', destination: 'ci-services/' },
|
||||
{ source: 'setup/#appveyor', destination: 'ci-services/' },
|
||||
{ source: 'setup/#circleci', destination: 'ci-services/' },
|
||||
{ source: 'setup/#gitlab-ci', destination: 'ci-services/' },
|
||||
{ source: 'setup/#cirrus-ci', destination: 'ci-services/' },
|
||||
|
||||
{ source: 'faq/#linux-builds-in-containers', destination: 'platforms/#linux-containers' },
|
||||
{ source: 'faq/#apple-silicon', destination: 'platforms/#macos-architectures' },
|
||||
{ source: 'faq/#windows-arm64', destination: 'platforms/#windows-arm64' },
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user