diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-03-05 10:54:37 -0500 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-03-05 15:31:30 -0500 |
| commit | 173d2aaa009d7d1b76addefc204a2bde329caa83 (patch) | |
| tree | 621661d8b266f7103fd7b5a176977aa264d27e79 /src/librustdoc/html/render/write_shared.rs | |
| parent | 69a879f3d199580dde491bb679df319867a44e56 (diff) | |
| download | rust-173d2aaa009d7d1b76addefc204a2bde329caa83.tar.gz rust-173d2aaa009d7d1b76addefc204a2bde329caa83.zip | |
Add an unstable option to print all unversioned files
This allows sharing those files between different doc invocations without having to know their names ahead of time.
Diffstat (limited to 'src/librustdoc/html/render/write_shared.rs')
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 7fcfe35f9a9..02ad01aa29a 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -3,8 +3,8 @@ use std::fmt::Write; use std::fs::{self, File}; use std::io::prelude::*; use std::io::{self, BufReader}; -use std::path::{Component, Path, PathBuf}; use std::lazy::SyncLazy as Lazy; +use std::path::{Component, Path, PathBuf}; use itertools::Itertools; use rustc_data_structures::flock; @@ -19,6 +19,26 @@ use crate::error::Error; use crate::formats::FormatRenderer; use crate::html::{layout, static_files}; +crate static FILES_UNVERSIONED: Lazy<FxHashMap<&str, &[u8]>> = Lazy::new(|| { + map! { + "FiraSans-Regular.woff2" => static_files::fira_sans::REGULAR2, + "FiraSans-Medium.woff2" => static_files::fira_sans::MEDIUM2, + "FiraSans-Regular.woff" => static_files::fira_sans::REGULAR, + "FiraSans-Medium.woff" => static_files::fira_sans::MEDIUM, + "FiraSans-LICENSE.txt" => static_files::fira_sans::LICENSE, + "SourceSerifPro-Regular.ttf.woff" => static_files::source_serif_pro::REGULAR, + "SourceSerifPro-Bold.ttf.woff" => static_files::source_serif_pro::BOLD, + "SourceSerifPro-It.ttf.woff" => static_files::source_serif_pro::ITALIC, + "SourceSerifPro-LICENSE.md" => static_files::source_serif_pro::LICENSE, + "SourceCodePro-Regular.woff" => static_files::source_code_pro::REGULAR, + "SourceCodePro-Semibold.woff" => static_files::source_code_pro::SEMIBOLD, + "SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE, + "LICENSE-MIT.txt" => static_files::LICENSE_MIT, + "LICENSE-APACHE.txt" => static_files::LICENSE_APACHE, + "COPYRIGHT.txt" => static_files::COPYRIGHT, + } +}); + pub(super) fn write_shared( cx: &Context<'_>, krate: &Crate, @@ -213,23 +233,6 @@ themePicker.onblur = handleThemeButtonsBlur; static_files::NORMALIZE_CSS, options.enable_minification, )?; - static FILES_UNVERSIONED: Lazy<FxHashMap<&str, &[u8]>> = Lazy::new(|| map! { - "FiraSans-Regular.woff2" => static_files::fira_sans::REGULAR2, - "FiraSans-Medium.woff2" => static_files::fira_sans::MEDIUM2, - "FiraSans-Regular.woff" => static_files::fira_sans::REGULAR, - "FiraSans-Medium.woff" => static_files::fira_sans::MEDIUM, - "FiraSans-LICENSE.txt" => static_files::fira_sans::LICENSE, - "SourceSerifPro-Regular.ttf.woff" => static_files::source_serif_pro::REGULAR, - "SourceSerifPro-Bold.ttf.woff" => static_files::source_serif_pro::BOLD, - "SourceSerifPro-It.ttf.woff" => static_files::source_serif_pro::ITALIC, - "SourceSerifPro-LICENSE.md" => static_files::source_serif_pro::LICENSE, - "SourceCodePro-Regular.woff" => static_files::source_code_pro::REGULAR, - "SourceCodePro-Semibold.woff" => static_files::source_code_pro::SEMIBOLD, - "SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE, - "LICENSE-MIT.txt" => static_files::LICENSE_MIT, - "LICENSE-APACHE.txt" => static_files::LICENSE_APACHE, - "COPYRIGHT.txt" => static_files::COPYRIGHT, - }); for (file, contents) in &*FILES_UNVERSIONED { write(cx.dst.join(file), contents)?; } |
