Skip to content

Commit 3c3240c

Browse files
stsewdericholscher
authored andcommitted
Remove doctype from resolver
1 parent 597de6a commit 3c3240c

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

readthedocs/core/resolver.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
"""URL resolver for documentation."""
44

5-
import re
65
from urllib.parse import urlunparse
76

87
from django.conf import settings
@@ -255,29 +254,10 @@ def _fix_filename(self, project, filename):
255254
"""
256255
Force filenames that might be HTML file paths into proper URL's.
257256
258-
This basically means stripping / and .html endings and then re-adding
259-
them properly.
257+
This basically means stripping /.
260258
"""
261-
# Bail out on non-html files
262-
if '.' in filename and '.html' not in filename:
263-
return filename
264259
filename = filename.lstrip('/')
265-
filename = re.sub(r'(^|/)index(?:.html)?$', '\\1', filename)
266-
if filename:
267-
if filename.endswith('/') or filename.endswith('.html'):
268-
path = filename
269-
elif project.documentation_type == 'sphinx_singlehtml':
270-
path = 'index.html#document-' + filename
271-
elif project.documentation_type in ['sphinx_htmldir', 'mkdocs']:
272-
path = filename + '/'
273-
elif '#' in filename:
274-
# do nothing if the filename contains URL fragments
275-
path = filename
276-
else:
277-
path = filename + '.html'
278-
else:
279-
path = ''
280-
return path
260+
return filename
281261

282262
def _use_custom_domain(self, custom_domain):
283263
"""

0 commit comments

Comments
 (0)