django-docs-viewer 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/PKG-INFO +1 -1
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/pages.py +17 -7
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/views.py +6 -4
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/pyproject.toml +1 -1
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/LICENSE +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/README.md +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/__init__.py +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/apps.py +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/conf.py +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/de/LC_MESSAGES/django.mo +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/de/LC_MESSAGES/django.po +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/en/LC_MESSAGES/django.mo +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/en/LC_MESSAGES/django.po +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/fr/LC_MESSAGES/django.mo +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/fr/LC_MESSAGES/django.po +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/navigation.py +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/paths.py +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/templates/docs_viewer/base.html +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/templates/docs_viewer/detail.html +0 -0
- {django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/urls.py +0 -0
|
@@ -73,23 +73,33 @@ def discover_pages():
|
|
|
73
73
|
return pages
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
def
|
|
77
|
-
"""The
|
|
78
|
-
|
|
79
|
-
if not root.is_dir():
|
|
76
|
+
def directory_index(directory):
|
|
77
|
+
"""The index/README file directly inside directory, matched case-insensitively; None when absent."""
|
|
78
|
+
if directory is None or not directory.is_dir():
|
|
80
79
|
return None
|
|
81
|
-
by_name = {child.name.lower(): child.name for child in
|
|
80
|
+
by_name = {child.name.lower(): child.name for child in directory.iterdir() if child.is_file()}
|
|
82
81
|
for candidate in INDEX_FILENAMES:
|
|
83
82
|
if candidate in by_name:
|
|
84
|
-
return by_name[candidate]
|
|
83
|
+
return directory / by_name[candidate]
|
|
85
84
|
return None
|
|
86
85
|
|
|
87
86
|
|
|
87
|
+
def dedicated_index():
|
|
88
|
+
"""The docs-root index/README landing file name, matched case-insensitively; None when absent."""
|
|
89
|
+
match = directory_index(docs_root())
|
|
90
|
+
return match.name if match else None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _landing_sort_key(page):
|
|
94
|
+
relative = page.relative_to(docs_root()).as_posix()
|
|
95
|
+
return (0 if is_index_filename(page.name) else 1, relative.lower())
|
|
96
|
+
|
|
97
|
+
|
|
88
98
|
def landing_relative_path():
|
|
89
99
|
index = dedicated_index()
|
|
90
100
|
if index is not None:
|
|
91
101
|
return index
|
|
92
|
-
pages = discover_pages()
|
|
102
|
+
pages = sorted(discover_pages(), key=_landing_sort_key)
|
|
93
103
|
return pages[0].relative_to(docs_root()).as_posix() if pages else None
|
|
94
104
|
|
|
95
105
|
|
|
@@ -6,7 +6,7 @@ from django.views.static import serve
|
|
|
6
6
|
|
|
7
7
|
from .conf import base_template, login_required
|
|
8
8
|
from .navigation import build_sidebar_html
|
|
9
|
-
from .pages import is_hidden, landing_relative_path, render_page, site_title
|
|
9
|
+
from .pages import directory_index, is_hidden, landing_relative_path, render_page, site_title
|
|
10
10
|
from .paths import (
|
|
11
11
|
docs_root,
|
|
12
12
|
is_image_request,
|
|
@@ -33,11 +33,13 @@ class DocsView(View):
|
|
|
33
33
|
relative_path = landing_relative_path()
|
|
34
34
|
if relative_path is None:
|
|
35
35
|
raise Http404("No documentation available")
|
|
36
|
+
markdown_path = resolve_within_docs(relative_path)
|
|
36
37
|
else:
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
markdown_path = resolve_within_docs(with_markdown_suffix(doc_path))
|
|
39
|
+
if markdown_path is None or not markdown_path.is_file():
|
|
40
|
+
directory = resolve_within_docs(without_markdown_suffix(doc_path))
|
|
41
|
+
markdown_path = directory_index(directory)
|
|
39
42
|
|
|
40
|
-
markdown_path = resolve_within_docs(relative_path)
|
|
41
43
|
if markdown_path is None or not markdown_path.is_file():
|
|
42
44
|
raise Http404("Documentation page not found")
|
|
43
45
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/de/LC_MESSAGES/django.mo
RENAMED
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/de/LC_MESSAGES/django.po
RENAMED
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/en/LC_MESSAGES/django.mo
RENAMED
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/en/LC_MESSAGES/django.po
RENAMED
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/fr/LC_MESSAGES/django.mo
RENAMED
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/locale/fr/LC_MESSAGES/django.po
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/templates/docs_viewer/base.html
RENAMED
|
File without changes
|
{django_docs_viewer-0.2.0 → django_docs_viewer-0.2.1}/docs_viewer/templates/docs_viewer/detail.html
RENAMED
|
File without changes
|
|
File without changes
|