Rollup merge of #87288 - ijackson:rustdoc-theme, r=GuillaumeGomez
rustdoc: Restore --default-theme, etc, by restoring varname escaping
In #86157
cd0f93193c
Use Tera templates for rustdoc.
dropped the following transformation from the keys of the default settings element's `data-` attribute names:
.map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v)))
The `Escape` part is indeed no longer needed, because Tera does that for us. But the massaging of `-` to `_` is needed, for the (bizarre) reasons explained in the new comments.
I have tested that the default theme function works again for me. I have also verified that passing (in shell syntax)
'--default-theme="zork&"'
escapes the value in the HTML.
Closes #87263
This commit is contained in:
8
src/test/rustdoc-gui/default-settings.goml
Normal file
8
src/test/rustdoc-gui/default-settings.goml
Normal file
@@ -0,0 +1,8 @@
|
||||
// This test ensures that the default settings are correctly applied.
|
||||
//
|
||||
// The "settings" crate uses "ayu" as default setting, which is what we will
|
||||
// check.
|
||||
goto: file://|DOC_PATH|/settings/index.html
|
||||
// Wait a bit to be sure the default theme is applied.
|
||||
wait-for: 1000
|
||||
assert-css: ("body", {"background-color": "rgb(15, 20, 25)"})
|
||||
@@ -1,6 +0,0 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"test_docs",
|
||||
"lib2",
|
||||
"implementors",
|
||||
]
|
||||
@@ -12,7 +12,3 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"implementors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test_docs"
|
||||
version = "0.1.0"
|
||||
@@ -7,4 +7,4 @@ edition = "2018"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
implementors = { path = "../implementors" }
|
||||
implementors = { path = "./implementors" }
|
||||
|
||||
7
src/test/rustdoc-gui/src/lib2/implementors/Cargo.lock
Normal file
7
src/test/rustdoc-gui/src/lib2/implementors/Cargo.lock
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "implementors"
|
||||
version = "0.1.0"
|
||||
2
src/test/rustdoc-gui/src/settings/.cargo/config.toml
Normal file
2
src/test/rustdoc-gui/src/settings/.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[build]
|
||||
rustdocflags = ["--default-theme", "ayu"]
|
||||
7
src/test/rustdoc-gui/src/settings/Cargo.lock
Normal file
7
src/test/rustdoc-gui/src/settings/Cargo.lock
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "settings"
|
||||
version = "0.1.0"
|
||||
7
src/test/rustdoc-gui/src/settings/Cargo.toml
Normal file
7
src/test/rustdoc-gui/src/settings/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "settings"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
1
src/test/rustdoc-gui/src/settings/lib.rs
Normal file
1
src/test/rustdoc-gui/src/settings/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub fn foo() {}
|
||||
7
src/test/rustdoc-gui/src/test_docs/Cargo.lock
Normal file
7
src/test/rustdoc-gui/src/test_docs/Cargo.lock
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "test_docs"
|
||||
version = "0.1.0"
|
||||
Reference in New Issue
Block a user