Skip to content

Commit

Permalink
Merge branch '4.1.x' into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Jul 14, 2021
2 parents 5559e5a + 9a2c3c4 commit 939c7bb
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 5 deletions.
16 changes: 15 additions & 1 deletion CHANGES
Expand Up @@ -19,7 +19,7 @@ Bugs fixed
Testing
--------

Release 4.1.1 (in development)
Release 4.1.2 (in development)
==============================

Dependencies
Expand All @@ -40,6 +40,20 @@ Bugs fixed
Testing
--------

Release 4.1.1 (released Jul 15, 2021)
=====================================

Dependencies
------------

* #9434: sphinxcontrib-htmlhelp-2.0.0 or above
* #9434: sphinxcontrib-serializinghtml-1.1.5 or above

Bugs fixed
----------

* #9438: html: HTML logo or Favicon specified as file not being found on output

Release 4.1.0 (released Jul 12, 2021)
=====================================

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -18,8 +18,8 @@
'sphinxcontrib-applehelp',
'sphinxcontrib-devhelp',
'sphinxcontrib-jsmath',
'sphinxcontrib-htmlhelp',
'sphinxcontrib-serializinghtml',
'sphinxcontrib-htmlhelp>=2.0.0',
'sphinxcontrib-serializinghtml>=1.1.5',
'sphinxcontrib-qthelp',
'Jinja2>=2.3',
'Pygments>=2.0',
Expand Down
14 changes: 12 additions & 2 deletions sphinx/builders/html/__init__.py
Expand Up @@ -468,6 +468,16 @@ def prepare_writing(self, docnames: Set[str]) -> None:
else:
self.last_updated = None

# If the logo or favicon are urls, keep them as-is, otherwise
# strip the relative path as the files will be copied into _static.
logo = self.config.html_logo or ''
favicon = self.config.html_favicon or ''

if not isurl(logo):
logo = path.basename(logo)
if not isurl(favicon):
favicon = path.basename(favicon)

self.relations = self.env.collect_relations()

rellinks: List[Tuple[str, str, str, str]] = []
Expand Down Expand Up @@ -510,8 +520,8 @@ def prepare_writing(self, docnames: Set[str]) -> None:
'rellinks': rellinks,
'builder': self.name,
'parents': [],
'logo': self.config.html_logo or '',
'favicon': self.config.html_favicon or '',
'logo': logo,
'favicon': favicon,
'html5_doctype': html5_ready and not self.config.html4_writer,
}
if self.theme:
Expand Down
4 changes: 4 additions & 0 deletions tests/roots/test-local-logo/conf.py
@@ -0,0 +1,4 @@
latex_documents = [
('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report')
]
html_logo = "images/img.png"
Binary file added tests/roots/test-local-logo/images/img.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions tests/roots/test-local-logo/index.rst
@@ -0,0 +1,32 @@
The basic Sphinx documentation for testing
==========================================

Sphinx is a tool that makes it easy to create intelligent and beautiful
documentation for Python projects (or other documents consisting of multiple
reStructuredText sources), written by Georg Brandl. It was originally created
for the new Python documentation, and has excellent facilities for Python
project documentation, but C/C++ is supported as well, and more languages are
planned.

Sphinx uses reStructuredText as its markup language, and many of its strengths
come from the power and straightforwardness of reStructuredText and its parsing
and translating suite, the Docutils.

features
--------

Among its features are the following:

* Output formats: HTML (including derivative formats such as HTML Help, Epub
and Qt Help), plain text, manual pages and LaTeX or direct PDF output
using rst2pdf
* Extensive cross-references: semantic markup and automatic links
for functions, classes, glossary terms and similar pieces of information
* Hierarchical structure: easy definition of a document tree, with automatic
links to siblings, parents and children
* Automatic indices: general index as well as a module index
* Code handling: automatic highlighting using the Pygments highlighter
* Flexible HTML output using the Jinja 2 templating engine
* Various extensions are available, e.g. for automatic testing of snippets
and inclusion of appropriately formatted docstrings
* Setuptools integration
9 changes: 9 additions & 0 deletions tests/test_build_html.py
Expand Up @@ -1340,6 +1340,15 @@ def test_html_remote_logo(app, status, warning):
assert not (app.outdir / 'python-logo.png').exists()


@pytest.mark.sphinx('html', testroot='local-logo')
def test_html_local_logo(app, status, warning):
app.builder.build_all()

result = (app.outdir / 'index.html').read_text()
assert ('<img class="logo" src="_static/img.png" alt="Logo"/>' in result)
assert (app.outdir / '_static/img.png').exists()


@pytest.mark.sphinx('html', testroot='basic')
def test_html_sidebar(app, status, warning):
ctx = {}
Expand Down

0 comments on commit 939c7bb

Please sign in to comment.