Skip to content

Commit c0f1766

Browse files
Remove slugify filter
1 parent 69a2d2a commit c0f1766

File tree

8 files changed

+14
-17
lines changed

8 files changed

+14
-17
lines changed

src/web/page/templates.rs

-4
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,6 @@ pub mod filters {
221221
)))
222222
}
223223

224-
pub fn slugify<T: AsRef<str>>(code: T) -> rinja::Result<String> {
225-
Ok(slug::slugify(code.as_ref()))
226-
}
227-
228224
pub fn round(value: &f32, precision: u32) -> rinja::Result<String> {
229225
let multiplier = if precision == 0 {
230226
1.0

templates/base.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
<meta name="generator" content="docs.rs {{ crate::BUILD_VERSION }}">
88
{%- block meta -%}{%- endblock meta -%}
99

10-
{# Docs.rs styles #}
11-
<link rel="stylesheet" href="/-/static/vendored.css?{{ crate::BUILD_VERSION|slugify }}" media="all" />
12-
<link rel="stylesheet" href="/-/static/style.css?{{ crate::BUILD_VERSION|slugify }}" media="all" />
10+
{#- Docs.rs styles -#}
11+
{%- set build_slug = slug::slugify(crate::BUILD_VERSION) -%}
12+
<link rel="stylesheet" href="/-/static/vendored.css?{{ build_slug }}" media="all" />
13+
<link rel="stylesheet" href="/-/static/style.css?{{ build_slug }}" media="all" />
1314

1415
<link rel="search" href="/-/static/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs" />
1516

@@ -18,8 +19,8 @@
1819
<script nonce="{{ csp_nonce }}">{%- include "theme.js" -%}</script>
1920
{%- block css -%}{%- endblock css -%}
2021

21-
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/menu.js?{{ crate::BUILD_VERSION|slugify }}"></script>
22-
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/index.js?{{ crate::BUILD_VERSION|slugify }}"></script>
22+
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/menu.js?{{ build_slug }}"></script>
23+
<script defer type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/index.js?{{ build_slug }}"></script>
2324
</head>
2425

2526
<body class="{% block body_classes %}{% endblock body_classes %}">

templates/core/home.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ <h1 class="brand">{{ "cubes"|fas(false, false, "") }} Docs.rs</h1>
7676
{%- endblock body -%}
7777

7878
{%- block javascript -%}
79-
<script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/keyboard.js?{{ crate::BUILD_VERSION|slugify }}"></script>
79+
<script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/keyboard.js?{{ build_slug }}"></script>
8080
{%- endblock javascript -%}

templates/crate/source.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@
137137

138138
{%- block javascript -%}
139139
{% if file_content.is_some() %}
140-
<script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/source.js?{{ crate::BUILD_VERSION|slugify }}"></script>
140+
<script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/source.js?{{ slug::slugify(crate::BUILD_VERSION) }}"></script>
141141
{% endif %}
142142
{%- endblock javascript -%}

templates/releases/releases.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@
102102
{%- endblock body -%}
103103

104104
{%- block javascript -%}
105-
<script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/keyboard.js?{{ crate::BUILD_VERSION|slugify }}"></script>
105+
<script nonce="{{ csp_nonce }}" type="text/javascript" src="/-/static/keyboard.js?{{ build_slug }}"></script>
106106
{%- endblock javascript -%}

templates/rustdoc/body.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<script async src="/-/static/menu.js?{{ crate::BUILD_VERSION|slugify }}"></script>
2-
<script async src="/-/static/index.js?{{ crate::BUILD_VERSION|slugify }}"></script>
1+
{%- set build_slug = slug::slugify(crate::BUILD_VERSION) -%}
2+
<script async src="/-/static/menu.js?{{ build_slug }}"></script>
3+
<script async src="/-/static/index.js?{{ build_slug }}"></script>
34
{# see comment in ../storage-change-detection.html for details #}
45
<iframe src="/-/storage-change-detection.html" width="0" height="0" style="display: none"></iframe>

templates/rustdoc/head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{%- import "macros.html" as macros -%}
2-
<link rel="stylesheet" href="/-/static/{{rustdoc_css_file.as_ref().unwrap()}}?{{ crate::BUILD_VERSION|slugify }}" media="all" />
2+
<link rel="stylesheet" href="/-/static/{{rustdoc_css_file.as_ref().unwrap()}}?{% if build_slug is defined %}{{ build_slug }}{% else %}{{ slug::slugify(crate::BUILD_VERSION) }}{% endif %}" media="all" />
33

44
<link rel="search" href="/-/static/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs" />
55

templates/rustdoc/vendored.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<link rel="stylesheet" href="/-/static/vendored.css?{{ crate::BUILD_VERSION|slugify }}" media="all" />
2-
1+
<link rel="stylesheet" href="/-/static/vendored.css?{{ slug::slugify(crate::BUILD_VERSION) }}" media="all" />

0 commit comments

Comments
 (0)