Skip to content

Commit 939c7bb

Browse files
committed
Merge branch '4.1.x' into 4.x
2 parents 5559e5a + 9a2c3c4 commit 939c7bb

File tree

7 files changed

+74
-5
lines changed

7 files changed

+74
-5
lines changed

CHANGES

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Bugs fixed
1919
Testing
2020
--------
2121

22-
Release 4.1.1 (in development)
22+
Release 4.1.2 (in development)
2323
==============================
2424

2525
Dependencies
@@ -40,6 +40,20 @@ Bugs fixed
4040
Testing
4141
--------
4242

43+
Release 4.1.1 (released Jul 15, 2021)
44+
=====================================
45+
46+
Dependencies
47+
------------
48+
49+
* #9434: sphinxcontrib-htmlhelp-2.0.0 or above
50+
* #9434: sphinxcontrib-serializinghtml-1.1.5 or above
51+
52+
Bugs fixed
53+
----------
54+
55+
* #9438: html: HTML logo or Favicon specified as file not being found on output
56+
4357
Release 4.1.0 (released Jul 12, 2021)
4458
=====================================
4559

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
'sphinxcontrib-applehelp',
1919
'sphinxcontrib-devhelp',
2020
'sphinxcontrib-jsmath',
21-
'sphinxcontrib-htmlhelp',
22-
'sphinxcontrib-serializinghtml',
21+
'sphinxcontrib-htmlhelp>=2.0.0',
22+
'sphinxcontrib-serializinghtml>=1.1.5',
2323
'sphinxcontrib-qthelp',
2424
'Jinja2>=2.3',
2525
'Pygments>=2.0',

sphinx/builders/html/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,16 @@ def prepare_writing(self, docnames: Set[str]) -> None:
468468
else:
469469
self.last_updated = None
470470

471+
# If the logo or favicon are urls, keep them as-is, otherwise
472+
# strip the relative path as the files will be copied into _static.
473+
logo = self.config.html_logo or ''
474+
favicon = self.config.html_favicon or ''
475+
476+
if not isurl(logo):
477+
logo = path.basename(logo)
478+
if not isurl(favicon):
479+
favicon = path.basename(favicon)
480+
471481
self.relations = self.env.collect_relations()
472482

473483
rellinks: List[Tuple[str, str, str, str]] = []
@@ -510,8 +520,8 @@ def prepare_writing(self, docnames: Set[str]) -> None:
510520
'rellinks': rellinks,
511521
'builder': self.name,
512522
'parents': [],
513-
'logo': self.config.html_logo or '',
514-
'favicon': self.config.html_favicon or '',
523+
'logo': logo,
524+
'favicon': favicon,
515525
'html5_doctype': html5_ready and not self.config.html4_writer,
516526
}
517527
if self.theme:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
latex_documents = [
2+
('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report')
3+
]
4+
html_logo = "images/img.png"
64.7 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
The basic Sphinx documentation for testing
2+
==========================================
3+
4+
Sphinx is a tool that makes it easy to create intelligent and beautiful
5+
documentation for Python projects (or other documents consisting of multiple
6+
reStructuredText sources), written by Georg Brandl. It was originally created
7+
for the new Python documentation, and has excellent facilities for Python
8+
project documentation, but C/C++ is supported as well, and more languages are
9+
planned.
10+
11+
Sphinx uses reStructuredText as its markup language, and many of its strengths
12+
come from the power and straightforwardness of reStructuredText and its parsing
13+
and translating suite, the Docutils.
14+
15+
features
16+
--------
17+
18+
Among its features are the following:
19+
20+
* Output formats: HTML (including derivative formats such as HTML Help, Epub
21+
and Qt Help), plain text, manual pages and LaTeX or direct PDF output
22+
using rst2pdf
23+
* Extensive cross-references: semantic markup and automatic links
24+
for functions, classes, glossary terms and similar pieces of information
25+
* Hierarchical structure: easy definition of a document tree, with automatic
26+
links to siblings, parents and children
27+
* Automatic indices: general index as well as a module index
28+
* Code handling: automatic highlighting using the Pygments highlighter
29+
* Flexible HTML output using the Jinja 2 templating engine
30+
* Various extensions are available, e.g. for automatic testing of snippets
31+
and inclusion of appropriately formatted docstrings
32+
* Setuptools integration

tests/test_build_html.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,15 @@ def test_html_remote_logo(app, status, warning):
13401340
assert not (app.outdir / 'python-logo.png').exists()
13411341

13421342

1343+
@pytest.mark.sphinx('html', testroot='local-logo')
1344+
def test_html_local_logo(app, status, warning):
1345+
app.builder.build_all()
1346+
1347+
result = (app.outdir / 'index.html').read_text()
1348+
assert ('<img class="logo" src="_static/img.png" alt="Logo"/>' in result)
1349+
assert (app.outdir / '_static/img.png').exists()
1350+
1351+
13431352
@pytest.mark.sphinx('html', testroot='basic')
13441353
def test_html_sidebar(app, status, warning):
13451354
ctx = {}

0 commit comments

Comments
 (0)