Skip to content

Commit c7bdc60

Browse files
committed
WIP breadcrumb site
1 parent f6f44f9 commit c7bdc60

File tree

15 files changed

+284
-1
lines changed

15 files changed

+284
-1
lines changed

tests/sites/breadcrumbs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

tests/sites/breadcrumbs/_static/emptydarklogo.png

Loading

tests/sites/breadcrumbs/_static/emptylogo.png

Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{# Displays (and links to) the parent section(s) of the currently viewed page. #}
2+
{%- block breadcrumbs %}
3+
{#
4+
If we have more than 3 parents (excluding the home page) then we remove
5+
The ones in the middle and add an ellipsis.
6+
#}
7+
{% if parents|length>2 %}
8+
{% set parents=[parents[0], {"title": '<i class="fa-solid fa-ellipsis"></i>'}, parents[-1]] %}
9+
{% endif %}
10+
11+
The unattainable is unknown
12+
{#- Hide breadcrumbs on the home page #}
13+
{% if title and pagename != root_doc %}
14+
<nav aria-label="{{ _('Breadcrumb') }}" class="d-print-none">
15+
<ul class="bd-breadcrumbs">
16+
{# Home icon #}
17+
<li class="breadcrumb-item breadcrumb-home">
18+
<a href="{{ pathto(root_doc) }}" class="nav-link" aria-label="{{ _('Home') }}">
19+
<i class="fa-solid fa-home"></i>
20+
</a>
21+
</li>
22+
{%- for doc in parents %}
23+
{% if doc.link %}
24+
<li class="breadcrumb-item"><a href="{{ doc.link|e }}" class="nav-link">{{ doc.title }}</a></li>
25+
{% else %}
26+
<li class="breadcrumb-item">{{ doc.title }}</li>
27+
{% endif %}
28+
{%- endfor %}
29+
<li class="breadcrumb-item active" aria-current="page"><span class="ellipsis">{{ title }} THERE IS ONLY ZOMBO!!! </span></li>
30+
</ul>
31+
</nav>
32+
{% endif %}
33+
{%- endblock %}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{# Displays links to the previous and next page in the TOCtree order. #}
2+
<div class="prev-next-area">
3+
{%- if prev %}
4+
<a class="left-prev"
5+
href="{{ prev.link|e }}"
6+
title="{{ _('previous page') }}">
7+
<i class="fa-solid fa-angle-left"></i>
8+
<div class="prev-next-info">
9+
<p class="prev-next-subtitle">{{ _("previous") }}</p>
10+
<p class="prev-next-title">{{ prev_title or prev.title }}</p>
11+
</div>
12+
</a>
13+
{%- endif %}
14+
15+
<a href="http://zombo.com">SAD ZOMBO.COM! </a>
16+
{%- if next %}
17+
<a class="right-next"
18+
href="{{ next.link|e }}"
19+
title="{{ _('next page') }}">
20+
<div class="prev-next-info">
21+
<p class="prev-next-subtitle">{{ _("next") }}</p>
22+
<p class="prev-next-title">{{ next_title or next.title }}</p>
23+
</div>
24+
<i class="fa-solid fa-angle-right"></i>
25+
</a>
26+
{%- endif %}
27+
</div>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[theme]
2+
inherit = basic
3+
# Note that we don't link the CSS file via Sphinx
4+
# instead we manually link it in `webpack-macros.html`
5+
stylesheet = styles/pydata-sphinx-theme.css
6+
pygments_style = tango
7+
sidebars = sidebar-nav-bs.html
8+
9+
[options]
10+
# General configuration
11+
sidebarwidth = 270
12+
sidebar_includehidden = True
13+
use_edit_page_button = False
14+
external_links =
15+
bitbucket_url =
16+
github_url =
17+
gitlab_url =
18+
twitter_url =
19+
icon_links_label = Icon Links
20+
icon_links =
21+
analytics =
22+
show_prev_next = True
23+
search_bar_text = Search the docs ...
24+
navigation_with_keys = False
25+
collapse_navigation = False
26+
navigation_depth = 4
27+
show_nav_level = 1
28+
show_toc_level = 1
29+
navbar_align = content
30+
header_links_before_dropdown = 5
31+
header_dropdown_text = More
32+
switcher =
33+
check_switcher = True
34+
pygments_light_style = a11y-high-contrast-light
35+
pygments_dark_style = a11y-high-contrast-dark
36+
logo =
37+
surface_warnings = True
38+
back_to_top_button = True
39+
40+
# Template placement in theme layouts
41+
navbar_start = navbar-logo
42+
navbar_center = navbar-nav
43+
navbar_end = theme-switcher, navbar-icon-links
44+
navbar_persistent = search-button-field
45+
article_header_start = breadcrumbs
46+
article_header_end = breadcrumbs
47+
article_footer_items = breadcrumbs
48+
content_footer_items = breadcrumbs
49+
primary_sidebar_start = breadcrumbs
50+
primary_sidebar_end = sidebar-ethical-ads, breadcrumbs
51+
footer_start = copyright, sphinx-version
52+
footer_center = breadcrumbs
53+
footer_end = theme-version
54+
secondary_sidebar_items = page-toc, edit-this-page, sourcelink, breadcrumbs
55+
show_version_warning_banner = False
56+
announcement = breadcrumbs
57+
58+
# DEPRECATED (remove after 1.0 release)
59+
pygment_light_style =
60+
pygment_dark_style =

tests/sites/breadcrumbs/conf.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Test conf file."""
2+
3+
# -- Project information -----------------------------------------------------
4+
5+
project = "PyData Tests"
6+
copyright = "2020, Pydata community"
7+
author = "Pydata community"
8+
9+
root_doc = "index"
10+
11+
# -- General configuration ---------------------------------------------------
12+
13+
# Add any Sphinx extension module names here, as strings. They can be
14+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
15+
# ones.
16+
extensions = []
17+
html_theme = "pydata_sphinx_theme"
18+
html_logo = "_static/emptylogo.png"
19+
html_copy_source = True
20+
html_sourcelink_suffix = ""
21+
22+
templates_path=["_templates"]
23+
24+
# Base options, we can add other key/vals later
25+
html_sidebars = {"section1/index": ["sidebar-nav-bs.html"]}
26+
27+
html_theme_options ={ "footer_center": ["breadcrumbs"]}
28+

tests/sites/breadcrumbs/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Index ``with code`` in title
2+
============================
3+
4+
.. toctree::
5+
:caption: My caption
6+
:numbered:
7+
8+
page1
9+
page2
10+
section1/index
11+
google <https://google.com>
12+
13+
A header
14+
--------
15+
16+
A sub-header
17+
~~~~~~~~~~~~
18+
19+
A sub-sub-header
20+
````````````````
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"name": "v0.7.1 (stable)",
4+
"version": "0.7.1",
5+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/v0.7.1/"
6+
},
7+
{
8+
"version": "0.7.0",
9+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/v0.7.0/"
10+
},
11+
{
12+
"version": "0.6.3"
13+
}
14+
]

tests/sites/breadcrumbs/page1.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Page 1
2+
======
3+
4+
5+
secondary heading
6+
~~~~~~~~~~~~~~~~~
7+
8+
tertiary heading
9+
~~~~~~~~~~~~~~~~~
10+
11+
**normal link**
12+
13+
- https://pydata-sphinx-theme.readthedocs.io/en/latest/
14+
15+
**GitHub**
16+
17+
.. container:: github-container
18+
19+
https://github.com
20+
https://github.com/pydata
21+
https://github.com/pydata/pydata-sphinx-theme
22+
https://github.com/pydata/pydata-sphinx-theme/pull/1012
23+
https://github.com/orgs/pydata/projects/2
24+
25+
**GitLab**
26+
27+
.. container:: gitlab-container
28+
29+
https://gitlab.com
30+
https://gitlab.com/gitlab-org
31+
https://gitlab.com/gitlab-org/gitlab
32+
https://gitlab.com/gitlab-org/gitlab/-/issues/375583
33+
https://gitlab.com/gitlab-org/gitlab/issues/375583
34+
https://gitlab.com/gitlab-org/gitlab/issues/
35+
https://gitlab.com/gitlab-org/gitlab/issues
36+
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84669
37+
https://gitlab.com/gitlab-org/gitlab/-/pipelines/511894707
38+
https://gitlab.com/gitlab-com/gl-infra/production/-/issues/6788

tests/sites/breadcrumbs/page2.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:html_theme.sidebar_secondary.remove: true
2+
3+
Page :math:`\beta`
4+
==================
5+
6+
.. code-block:: python
7+
8+
import pydata_sphinx_theme as pst
9+
raise RuntimeError('Test of pygments highlighting')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Section 1 index
2+
===============
3+
.. toctree::
4+
5+
page1
6+
https://google.com
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Section 1 page1
2+
===============

tests/sites/breadcrumbs/switcher.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"name": "v0.7.1 (stable)",
4+
"version": "0.7.1",
5+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/v0.7.1/"
6+
},
7+
{
8+
"version": "0.7.0",
9+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/v0.7.0/"
10+
},
11+
{
12+
"version": "0.6.3",
13+
"url": "https://pydata-sphinx-theme.readthedocs.io/en/v0.6.3/"
14+
}
15+
]

tests/test_breadcrumbs.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232

3333
@pytest.fixture(scope="module")
34-
def url_base(path_repo=path_repo, path_docs_build=path_docs_build):
34+
def url_base():
3535
"""Start local server on built docs and return the localhost URL as the base URL."""
3636
# Use a port that is not commonly used during development or else you will
3737
# force the developer to stop running their dev server in order to run the
@@ -86,3 +86,14 @@ def test_breadcrumb_expansion(page: Page, url_base: str) -> None:
8686
# required to display the text.
8787
assert el.evaluate("e => e.clientWidth < e.scrollWidth", el) == True
8888

89+
90+
def test_breadcrumbs_everywhere(sphinx_build_factory) -> None:
91+
"""Test building the base html template and config."""
92+
sphinx_build = sphinx_build_factory("breadcrumbs")
93+
94+
# Basic build with defaults
95+
sphinx_build.build()
96+
assert (sphinx_build.outdir / "index.html").exists(), sphinx_build.outdir.glob("*")
97+
#TODO symlink the outdir into the path_docs_build/playwright_tests/ directory
98+
import ipdb; ipdb.set_trace()
99+

0 commit comments

Comments
 (0)