rustdoc: remove empty extern_crates and type="text/javascript" on script
Like #101023, this removes an attribute with a default value.
This commit is contained in:
parent
42fa8ac723
commit
52582d301d
2 changed files with 7 additions and 5 deletions
|
@ -987,7 +987,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
|
||||||
// So C's HTML will have something like this:
|
// So C's HTML will have something like this:
|
||||||
//
|
//
|
||||||
// ```html
|
// ```html
|
||||||
// <script type="text/javascript" src="/implementors/A/trait.Foo.js"
|
// <script src="/implementors/A/trait.Foo.js"
|
||||||
// data-ignore-extern-crates="A,B" async></script>
|
// data-ignore-extern-crates="A,B" async></script>
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
|
@ -1013,9 +1013,11 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
|
||||||
.map(|cnum| cx.shared.tcx.crate_name(cnum).to_string())
|
.map(|cnum| cx.shared.tcx.crate_name(cnum).to_string())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(",");
|
.join(",");
|
||||||
|
let (extern_before, extern_after) =
|
||||||
|
if extern_crates.is_empty() { ("", "") } else { (" data-ignore-extern-crates=\"", "\"") };
|
||||||
write!(
|
write!(
|
||||||
w,
|
w,
|
||||||
"<script type=\"text/javascript\" src=\"{src}\" data-ignore-extern-crates=\"{extern_crates}\" async></script>",
|
"<script src=\"{src}\"{extern_before}{extern_crates}{extern_after} async></script>",
|
||||||
src = js_src_path.finish(),
|
src = js_src_path.finish(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,9 +528,9 @@ function loadCss(cssFileName) {
|
||||||
// We don't want to include impls from this JS file, when the HTML already has them.
|
// We don't want to include impls from this JS file, when the HTML already has them.
|
||||||
// The current crate should always be ignored. Other crates that should also be
|
// The current crate should always be ignored. Other crates that should also be
|
||||||
// ignored are included in the attribute `data-ignore-extern-crates`.
|
// ignored are included in the attribute `data-ignore-extern-crates`.
|
||||||
const ignoreExternCrates = document
|
const script = document
|
||||||
.querySelector("script[data-ignore-extern-crates]")
|
.querySelector("script[data-ignore-extern-crates]");
|
||||||
.getAttribute("data-ignore-extern-crates");
|
const ignoreExternCrates = script ? script.getAttribute("data-ignore-extern-crates") : "";
|
||||||
for (const lib of libs) {
|
for (const lib of libs) {
|
||||||
if (lib === window.currentCrate || ignoreExternCrates.indexOf(lib) !== -1) {
|
if (lib === window.currentCrate || ignoreExternCrates.indexOf(lib) !== -1) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue