|
9 | 9 | from sphinx import addnodes |
10 | 10 | from sphinx.builders.html.transforms import KeyboardTransform |
11 | 11 | from sphinx.builders.latex import LaTeXBuilder |
| 12 | +from sphinx.environment import default_settings |
12 | 13 | from sphinx.roles import XRefRole |
13 | 14 | from sphinx.testing.util import Struct, assert_node |
14 | 15 | from sphinx.transforms import SphinxSmartQuotes |
|
22 | 23 | def settings(app): |
23 | 24 | texescape.init() # otherwise done by the latex builder |
24 | 25 | optparser = frontend.OptionParser( |
25 | | - components=(RstParser, HTMLWriter, LaTeXWriter)) |
| 26 | + components=(RstParser, HTMLWriter, LaTeXWriter), |
| 27 | + defaults=default_settings) |
26 | 28 | settings = optparser.get_default_values() |
27 | 29 | settings.smart_quotes = True |
28 | 30 | settings.env = app.builder.env |
29 | 31 | settings.env.temp_data['docname'] = 'dummy' |
30 | 32 | settings.contentsname = 'dummy' |
31 | | - settings.rfc_base_url = 'http://datatracker.ietf.org/doc/html/' |
32 | 33 | domain_context = sphinx_domains(settings.env) |
33 | 34 | domain_context.enable() |
34 | 35 | yield settings |
@@ -146,51 +147,49 @@ def get(name): |
146 | 147 | @pytest.mark.parametrize('type,rst,html_expected,latex_expected', [ |
147 | 148 | ( |
148 | 149 | # pep role |
149 | | - 'verify_re', |
| 150 | + 'verify', |
150 | 151 | ':pep:`8`', |
151 | | - # since docutils-0.19, :pep: role points to python.org via https schema |
152 | 152 | ('<p><span class="target" id="index-0"></span><a class="pep reference external" ' |
153 | | - 'href="https?://(www.python.org/dev/peps|peps.python.org)/pep-0008"><strong>PEP 8</strong></a></p>'), |
154 | | - (r'\\sphinxAtStartPar\n' |
155 | | - r'\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}' |
156 | | - r'!PEP 8@\\spxentry{PEP 8}}\\sphinxhref{https?://(www.python.org/dev/peps|peps.python.org)/pep-0008}' |
157 | | - r'{\\sphinxstylestrong{PEP 8}}') |
| 153 | + 'href="https://peps.python.org/pep-0008"><strong>PEP 8</strong></a></p>'), |
| 154 | + ('\\sphinxAtStartPar\n' |
| 155 | + '\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}' |
| 156 | + '!PEP 8@\\spxentry{PEP 8}}\\sphinxhref{https://peps.python.org/pep-0008}' |
| 157 | + '{\\sphinxstylestrong{PEP 8}}') |
158 | 158 | ), |
159 | 159 | ( |
160 | 160 | # pep role with anchor |
161 | | - 'verify_re', |
| 161 | + 'verify', |
162 | 162 | ':pep:`8#id1`', |
163 | | - # since docutils-0.19, :pep: role points to python.org via https schema |
164 | 163 | ('<p><span class="target" id="index-0"></span><a class="pep reference external" ' |
165 | | - 'href="https?://(www.python.org/dev/peps|peps.python.org)/pep-0008#id1">' |
| 164 | + 'href="https://peps.python.org/pep-0008#id1">' |
166 | 165 | '<strong>PEP 8#id1</strong></a></p>'), |
167 | | - (r'\\sphinxAtStartPar\n' |
168 | | - r'\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}' |
169 | | - r'!PEP 8\\#id1@\\spxentry{PEP 8\\#id1}}\\sphinxhref' |
170 | | - r'{https?://(www.python.org/dev/peps|peps.python.org)/pep-0008\\#id1}' |
171 | | - r'{\\sphinxstylestrong{PEP 8\\#id1}}') |
| 166 | + ('\\sphinxAtStartPar\n' |
| 167 | + '\\index{Python Enhancement Proposals@\\spxentry{Python Enhancement Proposals}' |
| 168 | + '!PEP 8\\#id1@\\spxentry{PEP 8\\#id1}}\\sphinxhref' |
| 169 | + '{https://peps.python.org/pep-0008\\#id1}' |
| 170 | + '{\\sphinxstylestrong{PEP 8\\#id1}}') |
172 | 171 | ), |
173 | 172 | ( |
174 | 173 | # rfc role |
175 | 174 | 'verify', |
176 | 175 | ':rfc:`2324`', |
177 | 176 | ('<p><span class="target" id="index-0"></span><a class="rfc reference external" ' |
178 | | - 'href="http://datatracker.ietf.org/doc/html/rfc2324.html"><strong>RFC 2324</strong></a></p>'), |
| 177 | + 'href="https://datatracker.ietf.org/doc/html/rfc2324.html"><strong>RFC 2324</strong></a></p>'), |
179 | 178 | ('\\sphinxAtStartPar\n' |
180 | 179 | '\\index{RFC@\\spxentry{RFC}!RFC 2324@\\spxentry{RFC 2324}}' |
181 | | - '\\sphinxhref{http://datatracker.ietf.org/doc/html/rfc2324.html}' |
| 180 | + '\\sphinxhref{https://datatracker.ietf.org/doc/html/rfc2324.html}' |
182 | 181 | '{\\sphinxstylestrong{RFC 2324}}') |
183 | 182 | ), |
184 | 183 | ( |
185 | 184 | # rfc role with anchor |
186 | 185 | 'verify', |
187 | 186 | ':rfc:`2324#id1`', |
188 | 187 | ('<p><span class="target" id="index-0"></span><a class="rfc reference external" ' |
189 | | - 'href="http://datatracker.ietf.org/doc/html/rfc2324.html#id1">' |
| 188 | + 'href="https://datatracker.ietf.org/doc/html/rfc2324.html#id1">' |
190 | 189 | '<strong>RFC 2324#id1</strong></a></p>'), |
191 | 190 | ('\\sphinxAtStartPar\n' |
192 | 191 | '\\index{RFC@\\spxentry{RFC}!RFC 2324\\#id1@\\spxentry{RFC 2324\\#id1}}' |
193 | | - '\\sphinxhref{http://datatracker.ietf.org/doc/html/rfc2324.html\\#id1}' |
| 192 | + '\\sphinxhref{https://datatracker.ietf.org/doc/html/rfc2324.html\\#id1}' |
194 | 193 | '{\\sphinxstylestrong{RFC 2324\\#id1}}') |
195 | 194 | ), |
196 | 195 | ( |
|
0 commit comments