Skip to content

Commit 1f1e7d4

Browse files
authored
Updates the docs file so that the pages related to index and error are compliant of the security policy. (boto#3424)
This change makes the docs pages compliant of the security policy. It removes inline styles from some docs pages and transfers them to a separate CSS file. This change has been tested in the dev environment.
1 parent b79ef33 commit 1f1e7d4

4 files changed

Lines changed: 155 additions & 31 deletions

File tree

docs/source/_static/404.html

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<title>Page Not Found</title>
6-
<style>
7-
* {
8-
box-sizing: border-box;
9-
}
10-
body {
11-
vertical-align: middle;
12-
text-align: center;
13-
line-height: 1.5;
14-
font-family: "Open Sans", Helvetica, Arial, sans-serif;
15-
font-size: 16px;
16-
margin: 0;
17-
padding: 0;
18-
}
19-
h1 {
20-
font-size: 38px;
21-
padding: 10px 10px 10px 45px;
22-
margin: 20px 0 35px -45px;
23-
font-weight: normal;
24-
}
25-
p {
26-
padding: 0;
27-
margin: 0 0 10px;
28-
}
29-
</style>
30-
</head>
31-
<body>
32-
<h1>Page Not Found</h1>
33-
<p>Sorry, the page you requested could not be found.</p>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Page Not Found</title>
6+
<link rel="stylesheet" href="css/custom.css" />
7+
</head>
8+
<body class="error-page-style">
9+
<h1>Page Not Found</h1>
10+
<p>Sorry, the page you requested could not be found.</p>
11+
</body>
3412
</html>

docs/source/_static/css/custom.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,35 @@ h3.admonition-title::before {
110110
.hidden {
111111
display: none;
112112
}
113+
114+
.max-width {
115+
width: 100%;
116+
}
117+
/* Ensures columns are aligned properly */
118+
.styled-row-col {
119+
width: 33%;
120+
vertical-align: top;
121+
}
122+
/* Applies styling to an error page */
123+
.error-page-style {
124+
box-sizing: border-box;
125+
vertical-align: middle;
126+
text-align: center;
127+
line-height: 1.5;
128+
font-family: "Open Sans", Helvetica, Arial, sans-serif;
129+
font-size: 16px;
130+
margin: 0;
131+
padding: 0;
132+
}
133+
134+
.error-page-style h1 {
135+
font-size: 38px;
136+
padding: 10px 10px 10px 45px;
137+
margin: 20px 0 35px -45px;
138+
font-weight: normal;
139+
}
140+
141+
.error-page-style p {
142+
padding: 0;
143+
margin: 0 0 10px;
144+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{#This file is normally inherited from the version defined by our docs theme (Furo).
2+
However, that file includes in-line styling which isn't allowed by our website's
3+
Content Security Policy (CSP). To resolve this issue, we copied this file from
4+
Furo version "2022.12.7".#}
5+
6+
{% extends "page.html" %}
7+
8+
{% block htmltitle -%}
9+
<title>{{ indextitle|striptags|e }} - {{ docstitle|striptags|e }}</title>
10+
{% endblock htmltitle -%}
11+
12+
{% block scripts -%}
13+
{{ super() }}
14+
{%- if not embedded and collapse_index %}
15+
<script>DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true</script>
16+
{%- endif -%}
17+
{%- endblock scripts %}
18+
19+
{% block content %}
20+
<section class="domainindex-section">
21+
<h1>{{ indextitle }}</h1>
22+
<div class="domainindex-jumpbox">
23+
{%- for (letter, entries) in content -%}
24+
<a href="#cap-{{ letter }}"><strong>{{ letter }}</strong></a>
25+
{%- if not loop.last %} | {% endif -%}
26+
{%- endfor -%}
27+
</div>
28+
</section>
29+
30+
{%- set groupid = idgen() %}
31+
<table class="domainindex-table">
32+
{%- for letter, entries in content %}
33+
<tr class="pcap">
34+
<td></td><td>&#160;</td><td></td>
35+
</tr>
36+
<tr class="cap" id="cap-{{ letter }}">
37+
<td></td><td><strong>{{ letter }}</strong></td><td></td>
38+
</tr>
39+
{%- for (name, grouptype, page, anchor, extra, qualifier, description) in entries %}
40+
<tr{% if grouptype == 2 %} class="cg-{{ groupid.current() }}"{% endif %}>
41+
<td>{% if grouptype == 1 -%}
42+
<img src="{{ pathto('_static/minus.png', 1) }}" class="toggler"
43+
id="toggle-{{ groupid.next() }}" class="hidden" alt="-" />
44+
{%- endif %}</td>
45+
<td>{% if grouptype == 2 %}&#160;&#160;&#160;{% endif %}
46+
{% if page %}<a href="{{ pathto(page)|e }}#{{ anchor }}">{% endif -%}
47+
<code class="xref">{{ name|e }}</code>
48+
{%- if page %}</a>{% endif %}
49+
{%- if extra %} <em>({{ extra|e }})</em>{% endif -%}
50+
</td><td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong>{% endif %}
51+
<em>{{ description|e }}</em></td>
52+
</tr>
53+
{%- endfor %}
54+
{%- endfor %}
55+
</table>
56+
{% endblock content %}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{% extends "page.html" %}
2+
3+
{% block htmltitle -%}
4+
<title>{{ _("Index") }} - {{ docstitle|striptags|e }}</title>
5+
{% endblock htmltitle -%}
6+
7+
{% macro indexentries(firstname, links) %}
8+
{%- if links -%}
9+
<a href="{{ links[0][1] }}">
10+
{%- if links[0][0] %}<strong>{% endif -%}
11+
{{ firstname|e }}
12+
{%- if links[0][0] %}</strong>{% endif -%}
13+
</a>
14+
15+
{%- for ismain, link in links[1:] -%}
16+
, <a href="{{ link }}">{% if ismain %}<strong>{% endif -%}
17+
[{{ loop.index }}]
18+
{%- if ismain %}</strong>{% endif -%}
19+
</a>
20+
{%- endfor %}
21+
{%- else %}
22+
{{ firstname|e }}
23+
{%- endif %}
24+
{% endmacro %}
25+
26+
{% block content %}
27+
<section class="genindex-section">
28+
<h1 id="index">{{ _('Index') }}</h1>
29+
<div class="genindex-jumpbox">
30+
{%- for key, dummy in genindexentries -%}
31+
<a href="#{{ key }}"><strong>{{ key }}</strong></a>
32+
{%- if not loop.last %} | {% endif -%}
33+
{%- endfor -%}
34+
</div>
35+
</section>
36+
37+
{%- for key, entries in genindexentries %}
38+
<section id="{{ key }}" class="genindex-section">
39+
<h2>{{ key }}</h2>
40+
<table class="max-width indextable genindextable">
41+
{%- for column in entries|slice_index(2) if column %}
42+
<td class="styled-row-col"><ul>
43+
{%- for entryname, (links, subitems, _) in column %}
44+
<li>{{ indexentries(entryname, links) }}
45+
{%- if subitems %}
46+
<ul>
47+
{%- for subentryname, subentrylinks in subitems %}
48+
<li>{{ indexentries(subentryname, subentrylinks) }}</li>
49+
{%- endfor %}
50+
</ul>
51+
{%- endif -%}</li>
52+
{%- endfor %}
53+
</ul></td>
54+
{%- endfor %}
55+
</tr></table>
56+
</section>
57+
{% endfor %}
58+
{% endblock %}

0 commit comments

Comments
 (0)