rustdoc: Provide a general --default-setting SETTING[=VALUE] option

We just plumb through what the user tells us.

This is flagged as unstable, mostly because I don't understand the
compatibility rules that rustdoc obeys for local storage data, and how
error handling of invalid data works.

We collect() the needed HashMap from Vec of Vecs of (key, value)
pairs, so that there is a nice place to add new more-specific options.
It would have been possible to use Extend::extend but doing it this
way ensures that all the used inputs are (and will stay) right next to
each other.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2020-10-13 18:52:43 +01:00
parent 5cd96d638c
commit d8a4497561
3 changed files with 26 additions and 2 deletions

View file

@ -178,7 +178,7 @@ pub fn render<T: Print, S: Print>(
default_settings = layout
.default_settings
.iter()
.map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-',"_"), Escape(v),))
.map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v),))
.collect::<String>(),
style_files = style_files
.iter()