Correctly handle crate level page on docs.rs as well

This commit is contained in:
Guillaume Gomez 2022-07-13 14:43:52 +02:00
parent b3f4c31199
commit b98fb490b8
2 changed files with 15 additions and 18 deletions

View File

@ -479,23 +479,20 @@ function loadCss(cssFileName) {
} }
if (sidebar) { if (sidebar) {
const isModule = hasClass(document.body, "mod"); block("primitive", "primitives", "Primitive Types");
if (!isModule) { block("mod", "modules", "Modules");
block("primitive", "primitives", "Primitive Types"); block("macro", "macros", "Macros");
block("mod", "modules", "Modules"); block("struct", "structs", "Structs");
block("macro", "macros", "Macros"); block("enum", "enums", "Enums");
block("struct", "structs", "Structs"); block("union", "unions", "Unions");
block("enum", "enums", "Enums"); block("constant", "constants", "Constants");
block("union", "unions", "Unions"); block("static", "static", "Statics");
block("constant", "constants", "Constants"); block("trait", "traits", "Traits");
block("static", "static", "Statics"); block("fn", "functions", "Functions");
block("trait", "traits", "Traits"); block("type", "types", "Type Definitions");
block("fn", "functions", "Functions"); block("foreigntype", "foreign-types", "Foreign Types");
block("type", "types", "Type Definitions"); block("keyword", "keywords", "Keywords");
block("foreigntype", "foreign-types", "Foreign Types"); block("traitalias", "trait-aliases", "Trait Aliases");
block("keyword", "keywords", "Keywords");
block("traitalias", "trait-aliases", "Trait Aliases");
}
} }
} }

View File

@ -39,7 +39,7 @@
{%- else if page.css_class == "source" -%} {%- else if page.css_class == "source" -%}
<script defer src="{{static_root_path|safe}}source-script{{page.resource_suffix}}.js"></script> {#- -#} <script defer src="{{static_root_path|safe}}source-script{{page.resource_suffix}}.js"></script> {#- -#}
<script defer src="{{page.root_path|safe}}source-files{{page.resource_suffix}}.js"></script> {#- -#} <script defer src="{{page.root_path|safe}}source-files{{page.resource_suffix}}.js"></script> {#- -#}
{%- else -%} {%- else if !page.css_class.contains("mod") -%}
<script defer src="sidebar-items{{page.resource_suffix}}.js"></script> {#- -#} <script defer src="sidebar-items{{page.resource_suffix}}.js"></script> {#- -#}
{%- endif -%} {%- endif -%}
<script defer src="{{static_root_path|safe}}main{{page.resource_suffix}}.js"></script> {#- -#} <script defer src="{{static_root_path|safe}}main{{page.resource_suffix}}.js"></script> {#- -#}