Fix URLs in docs generation

This commit is contained in:
Richard Feldman 2022-05-02 20:14:48 -04:00
parent 64b5c49faf
commit ddfa45eeb5
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
2 changed files with 6 additions and 8 deletions

View file

@ -56,12 +56,9 @@ pub fn generate_docs_html(filenames: Vec<PathBuf>, build_dir: &Path) {
.expect("TODO gracefully handle failing to make the favicon");
let template_html = include_str!("./static/index.html")
.replace("<!-- search.js -->", &format!("{}search.js", base_url()))
.replace("<!-- styles.css -->", &format!("{}styles.css", base_url()))
.replace(
"<!-- favicon.svg -->",
&format!("{}favicon.svg", base_url()),
)
.replace("<!-- search.js -->", "/search.js")
.replace("<!-- styles.css -->", "/styles.css")
.replace("<!-- favicon.svg -->", "/favicon.svg")
.replace(
"<!-- Module links -->",
render_sidebar(package.modules.iter().flat_map(|loaded_module| {

View file

@ -41,7 +41,7 @@ RUSTFLAGS=-Awarnings
# We set ROC_DOCS_ROOT_DIR=builtins so that links will be generated relative to
# "/builtins/" rather than "/" - which is what we want based on how the server
# is set up to serve them.
ROC_DOCS_URL_ROOT=builtins
export ROC_DOCS_URL_ROOT=/builtins
# These just need to be defined so that some env! macros don't fail.
BUILTINS_WASM32_O=""
@ -51,5 +51,6 @@ BUILTINS_HOST_O=""
# "llvm" feature and therefore don't depend on LLVM being installed on the
# system. (Netlify's build servers have Rust installed, but not LLVM.)
cargo run -p roc_cli --no-default-features docs compiler/builtins/roc/*.roc
mv generated-docs/ www/build/builtins
mv generated-docs/*.* www/build # move all the .js, .css, etc. files to build/
mv generated-docs/ www/build/builtins # move all the folders to build/builtins/
popd