update dev documentation index page

This commit is contained in:
Trevor Spiteri 2021-03-23 17:50:54 +01:00
parent 68970be469
commit 5154c05b7b
4 changed files with 48 additions and 57 deletions

41
etc/gen-doc-index.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
set -e
cd public
cp dev/*/index.html index.html
awk -i inplace '{if ($0 ~ /button>$/) {printf "%s", $0; next}; print}' index.html
awk -i inplace '{print gensub(/('\''|")\.\.\//, "\\1dev/", "g")}' index.html
awk -i inplace '{
gsub(/<\/nav>/, "\013")
sub(/<div class="block[^\013]*\013/, "\013")
sub(/<nav class="sub[^\013]*\013/, "")
gsub(/\013/, "</nav>")
sub(/dev\/[^/]*\/index.html/, "index.html")
gsub(/<\/h1>/, "\013")
sub(/<h1 class="fqn[^\013]*\013/, "")
gsub(/\013/, "</h1>")
gsub(/<\/script>/, "\013")
sub(/<script src="[^"]*main\.js[^\013]*\013/, "")
gsub(/\013/, "</script>")
print
}' index.html
awk -i inplace '{
if ($0 ~ /<\/h1>/) {
print gensub(/(.*<\/h1>).*/, "\\1", 1)
sub(/.*<\/h1>/, "")
while ($0 !~ /<\/section>/) { getline }
while (getline line<"../etc/index-contents.html") { print line }
gsub(/<\/section>/, "\013")
sub(/^[^\013]*/, "</div>")
gsub(/\013/, "</section>")
print
} else {
print
}
}' index.html

View File

@ -120,9 +120,9 @@ pages:
- rustup toolchain install --profile minimal nightly-$TARGET
- rm -rf public
- mkdir public
- cp etc/index.html public
- cargo +nightly-$TARGET doc --no-deps --features "num-traits serde std"
- mv target/doc public/dev
- bash etc/gen-doc-index.sh
artifacts:
paths:
- public

6
etc/index-contents.html Normal file
View File

@ -0,0 +1,6 @@
<p>The <a href="https://crates.io/crates/fixed"><em>fixed</em> crate</a> provides fixed-point numbers. Here you can find the documentation for the <a href="https://gitlab.com/tspiteri/fixed">current development version</a> of the crate.</p>
<h2>Documentation</h2>
<ul>
<li><a href="dev/fixed">Documentation for the current development version.</a></li>
<li><a href="https://docs.rs/fixed">Documentation for the published versions.</a></li>
</ul>

View File

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `fixed` crate.">
<meta name="keywords" content="rust, rustlang, rust-lang, fixed">
<title>fixed - Rust</title>
<link rel="stylesheet" type="text/css" href="dev/normalize.css">
<link rel="stylesheet" type="text/css" href="dev/rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="dev/dark.css">
<link rel="stylesheet" type="text/css" href="dev/light.css" id="themeStyle">
<script src="dev/storage.js"></script>
<noscript><link rel="stylesheet" href="dev/noscript.css"></noscript>
<link rel="shortcut icon" href="dev/favicon.ico">
<style type="text/css">
#crate-search {
background-image: url("down-arrow.svg");
}
</style>
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<a href="index.html"><div class="logo-container"><img src="dev/rust-logo.png" alt="logo"></div></a>
<p class="location">Crate fixed</p>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="dev/brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="dev/theme.js"></script>
<section id="main" class="content">
<div class="docblock">
<h1 id="fixed-point-numbers" class="section-header"><a href="#fixed-point-numbers">Fixed-point numbers</a></h1>
<p>The <a href="https://crates.io/crates/fixed"><em>fixed</em> crate</a> provides fixed-point numbers. Here you can find the documentation for the <a href="https://gitlab.com/tspiteri/fixed">current development version</a> of the crate.</p>
<h2>Documentation</h2>
<ul>
<li><a href="dev/fixed">Documentation for the current development version.</a></li>
<li><a href="https://docs.rs/fixed">Documentation for the published versions.</a></li>
</ul>
</div>
</section>
<section id="search" class="content hidden"></section>
<section class="footer"></section>
<script>window.rootPath = "";window.currentCrate = "fixed";</script>
</body>
</html>