Commit Graph

1095 Commits

Author SHA1 Message Date
TLouf
86b07d4a97 Allow multi-line object description signatures (#11011)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com>
Co-authored-by: TLouf <loufthomas@gmail.com>
2023-05-11 14:28:57 +01:00
Adam Turner
706f5f9cc8 Warn on deprecated Python-specific index types (#11412) 2023-05-09 22:57:39 +01:00
James Addison
c9d0933e5d linkcheck: Use context managers for HTTP requests (#11318)
This closes HTTP responses when no content reads are required, as
when requests are made in streaming mode, ``requests`` doesn't know
whether the caller may intend to later read content from a streamed
HTTP response object and holds the socket open.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-05-09 17:09:35 +01:00
Adam Turner
2a9e805206 Remove the deprecated Setuptools integration (#11363) 2023-04-27 01:22:04 +01:00
James Addison
59de8d5202 Revert "Support and prefer `.jinja to _t` for static templates (#11165)" (#11329)
This reverts commit 5d13215b58.
2023-04-23 19:06:44 +01:00
James Addison
d8f15c7361 Increase timeout threshold for `linkcheck` tests (#11326) 2023-04-21 02:08:14 +01:00
Bénédikt Tran
61576516d4 Fix duplicated labels in TeX output (#11093) 2023-04-17 12:07:32 +02:00
Jean-François B
b95fc0e88b Use leaner TeX syntax (follow-up to #11319)
Because it is cool.  And avoids overhead.  Matter of principle.
2023-04-11 20:41:58 +02:00
Jean-François B
509cc4533c LaTeX: get aligned longtable obey current list indent
Fix #11268.

Thanks to @picnixz.
2023-04-11 20:32:31 +02:00
James Addison
5d13215b58 Support and prefer `.jinja to _t` for static templates (#11165)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-07 18:07:15 +01:00
James Addison
f82c3c9912 Disable localisation when `SOURCE_DATE_EPOCH` is set (#10949)
This commit disables Sphinx's localisation features when reproducible
builds are requested, as determined by a non-empty SOURCE_DATE_EPOCH_
environment variable.

The `Reproducible Builds`_ project aims to provide confidence to
consumers of packaged software that the artefacts they're downloading
and installing have not been altered by the environment they were
built in, and can be replicated at a later date if required.

Builds of localised documentation using Sphinx currently account for
a large category of reproducible build testing failures, because the
builders intentionally use varying environment locales at build-time.
This can affect the contents of the ``objects.inv`` file.

During investigation, it turned out that many ``gettext``-localised
values (particularly in Python modules under ``sphinx.domains``) were
being translated at module-load-time and would not subsequently be
re-localised.

This creates two unusual effects:

1. Attempting to write a test case to build the same application in
   two different languages was not initially possible, as the
   first-loaded translation catalogue (as found in the 
   ``sphinx.locale.translators`` global variable) would remain in-use
   for subsequent application builds under different locales.

2. Localisation of strings could vary depending on whether the
   relevant modules were loaded before or after the resource
   catalogues were populated.

We fix this by performing all translations lazily so that module
imports can occur in any order and localisation of inventory entries
should occur only when translations of those items are requested.

Localisation can then be disabled by configuring the ``gettext``
language to the ISO-639-3 'undetermined' code (``'und'``), as this
should not have an associated translation catalogue. We also want to
prevent ``gettext`` from  attempting to determine the host's locale
from environment variables (including ``LANGUAGE``).

.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/
.. _Reproducible Builds: https://www.reproducible-builds.org/
2023-04-07 17:49:36 +01:00
Jens Hedegaard Nielsen
3edae68904 autosummary: Support documenting inherited attributes (#10691)
The current implementation of ``import_ivar_by_name`` filters
attributes if the name of the object that the attribute belongs to
does not match the object being documented. However, for inherited
attributes this is not the case. Filtering only on the attribute name
seems to resolve the issue. It is not clear to me if there are any
unwanted sideeffects of this and we should filter on the list of
qualnames for the object and all its super classes (if any).

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-04-06 23:33:43 +01:00
picnixz
aba392d87f Support type comments in `PropertyDocumenter` (#11298) 2023-04-06 22:56:17 +01:00
Clément Pinard
9299003d40 Autosummary: Extend `__all__` members to template rendering (#10811)
When ``False``, the ``autosummary_ignore_module_all`` option adds
members to the module's members entry that will be used for autodoc,
but otherwise ignores it. As such, if a class is available in the 
``__all__``, it won't be generated.

This commit aims to extend the ``__all__`` handling not only to
members, but also to corresponding attribute types (function,
classes, exceptions, modules)

The ``imported_members`` option is set to ``True`` if the object has
an ``__all__`` member and ``autosummary_ignore_module_all`` is ``False``
2023-04-06 00:02:37 +01:00
Martin Liška
8e26d78b79 Remove hidden state from `test_nosearch` (#11291)
Currently, ``test_nosearch`` depends on ``html_search_language='de'``
from a previous test and thus fails if run individually.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-04-05 13:43:24 +01:00
Jean-François B
126737c3cd Add unit test for issue #11110 as fixed by #11113 2023-04-03 18:26:34 +02:00
Jean-François B
89a4cdb673 Let the #11276 test actually be one which would have failed earlier 2023-03-31 19:27:54 +02:00
Jean-François B
8f6ad4a3e5 Fix #11274: external links may break PDF build if under \sphinxupquote 2023-03-31 18:19:35 +02:00
Dimitri Papadopoulos
669bcc0a19 Fix typos found by codespell 2023-03-27 07:22:07 +02:00
Adam Turner
7d928b3e79 Increase `test_linkcheck` timeouts 2023-03-24 01:07:25 +00:00
Adam Turner
97f07ca83c Speed up `test_linkcheck` 2023-03-24 00:29:27 +00:00
Adam Turner
44326fe247 Remove tests that rely on setuptools 2023-03-05 19:03:06 +00:00
Adam Turner
43e681e88f Remove `.egg support from pycode ModuleAnalyser`
Python eggs are a now-obsolete binary distribution format.
2023-03-05 19:03:06 +00:00
Jean-François B
7945aeb22d LaTeX: fix 5.1.0 bugs related to topic and contents boxes (#11102)
* Fix #11095 (PDF wrong placement of shadow of topic boxes since 5.1.0)

* Fix #11096 (LaTeX shadowsize regression at 5.1.0)

* Fix #11099 (shadowrule legacy sphinxsetup key vanished at 5.1.0)

* Fix #11101 (LaTeX div.topic_padding of sphinxsetup had wrong name)

* Add some checks that various sphinxsetup keys do not break PDF build

* Update LaTeX docs

* Update CHANGES

* Can not use :dudir:`contents` has it links to wrong place
2023-01-06 23:52:19 +01:00
Adam Turner
4032070e81 Run pyupgrade (#11070) 2023-01-02 00:01:14 +00:00
Adam Turner
f4c8a0a68e Insert `from __future__ import annotations` 2023-01-01 20:48:37 +00:00
Adam Turner
a1c10f5d5e Happy New Year! 2023-01-01 19:40:01 +00:00
Adam Turner
a6257fc83b Make copyright text inclusion test date-independent
Improve clarity on what the test is looking for in the footer
2023-01-01 19:38:55 +00:00
Adam Turner
bf06d7ef4d Factor out HTML 4 translator (#11051)
Move the HTML 4 translator into a private module.
2022-12-30 00:53:04 +00:00
James Addison
041e5f8268 Add test coverage for 'today_fmt' reference substitution (#10980) 2022-12-29 14:19:43 +00:00
Adam Turner
920828fe35 Run the `pyupgrade` tool 2022-10-17 22:39:09 +01:00
Adam Turner
dd7f65c98f Prefer `raise SystemExit to sys.exit` 2022-10-17 15:22:06 +01:00
Adam Turner
e70a0fac6d Merge branch '5.x'
# Conflicts:
#	.github/workflows/main.yml
#	CHANGES
#	sphinx/__init__.py
#	sphinx/domains/c.py
2022-10-16 11:24:18 +01:00
Adam Turner
10db540e98 Allow sections in object description directives (#10919) 2022-10-15 23:01:25 +01:00
Eric Wieser
fa6d42597f URI-escape image filenames (#10268)
Without this change, local images with `#` in their name result in incorrect URLs

There is already a similar call to `urllib.parse.quote` for file downloads, suggesting this is a sensible approach.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Takeshi KOMIYA <i.tkomiya@gmail.com>
2022-10-13 17:37:07 +01:00
Jean-François B
e7c0881992 LaTeX: support for booktabs-style and zebra-striped tables (#10759)
This is a combination of 2 + 28 + 7 + and some more commits...

* Cherry-pick: Add support for booktabs-style tables to LaTeX builder

* Cherry-pick: Add support for zebra-striped tables to LaTeX builder

Co-authored-by: Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com>

Above work originally initiated by @sephalon (thanks!)

Development refactored and continued by @jfbu

* latex_table_style configuration, support booktabs, colorrows, borderless

Some details:

- Simplify a bit a conditional in the longtable template

  This also puts the target for a longtable with a label but no caption
  above the toprule for better hyperlinking (testing shows hyperlink
  target can not end up alone at bottom of previous page).

- Extend allowed syntax for colour assignments via 'sphinxsetup'

- latex_table_style new configuration value and coloured rows

  For the user interface I tried to look for inspiration in
  https://docutils.sourceforge.io/docs/user/config.html#table-style
  which mentions booktabs and borderless.  They also mention
  captionbelow which we can implement later, now that architecture
  is here.  They don't mention coloured rows.

- Test on our own document... looks fine!

- Work-around an incompatibility of \cline with row colours

- Reverse priority of classes to allow overruling booktabs by standard
  after parsing source but before letting LaTeX writer act

- Closes #8220

  Commit
  bb859c6696
  already improved a bit, this finishes it (as :rst:dir:`rst-class` was
  actually not linking to anywhere).

- Let booktabs style defaults to *not* using \cmidrule.  They actually
  don't make much sense there, as all \hline's are removed.

- Add \sphinxnorowcolor which allows construct such as this one in
  a tabularcolumns directive:

    >{\columncolor{blue}\sphinxnorowcolor}

  else LaTeX always overrides column colour by row colour

- Add TableMergeColorHeader, TableMergeColorOdd, TableMergeColorEven
  so single-row merged cells can be styled especially

- Extend row colours to all header rows not only the first one
  (all header rows will share same colour settings)

- Auto-adjust to a no '|'-colspec for optimal handling of merged cell

- Add \sphinxcolorblend

- Workaround LaTeX's \cline features and other grid tables matters

- Add \sphinxbuildwarning for important warnings

- Fix some white gaps in merged cells of tables with vlines and
  colorrows

- Work around LaTeX's \cline serious deficiencies for complex grid
  tables

  This commit corrects \cline badly impacting vertical spacing and
  making tables look even more cramped as they usually are in LaTeX
  (although one sees it clearly only with \arrarrulewidth a bit more
  than the LaTeX default of 0.4pt).

  Most importantly this commit solves the problem that \cline's got
  masked by colour panels from the row below.

- Update CHANGES for PR #10759

- Improve documentation of new latex_table_style regarding colours
2022-10-12 17:15:40 +02:00
Anthony Sottile
6ed4bbba39 Don't display 'replaceable hardcoded link' when link has a slash (#10137) 2022-10-05 14:47:16 +01:00
Martin Liška
0a91adb64d Extend cross referencing options with values (#10883)
This change means that text following `=`, `[=`, or ` ` is ignored when
searching for a corresponding option directive to an option cross reference
role. These are commonly used options, for example `--profile=path`, 
`--profile[=path]` or `--profile path`.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-10-02 15:50:53 +01:00
Adam Turner
63dea6172a Merge branch '5.x'
# Conflicts:
#	sphinx/locale/__init__.py
2022-09-30 16:15:24 +01:00
Martin Liska
29e6adab12 extend option directive syntax
One can cross-reference an option value: :option:`--module=foobar`.
2022-09-27 19:02:45 +01:00
Adam Turner
4660b62de0 Drop Python 3.7 2022-09-27 18:31:47 +01:00
Adam Turner
8db24515ea Clear record_dependencies for each document (#10855) 2022-09-24 00:31:26 +01:00
Adam Turner
f57177de89 Add contents entries for domain objects (#10807)
- Add entries in the table of contents for domain objects (e.g. 
  `py:function`, `rst:role`, etc). Supported domains are Javascript,
  Python, and reStructuredText.
- Support content in `py:module` and `js:module` directives.
- Add the `noindexentry` and `noindex` flags to more domains.
- Add `toc_object_entries_show_parents` configuration setting
- Update documentation and tests
2022-09-13 20:20:02 +01:00
Brecht Machiels
d924acfdb9 Make toctree accept special docnames (#10673)
The `.. toctree::` directive now supports the reserved special docnames
'genindex', 'modindex', and 'search'.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2022-09-12 20:13:14 +01:00
danieleades
12bff8a273 Remove unneeded noqa lint suppression comments (#10772) 2022-08-28 20:03:17 +01:00
n-peugnet
1553cc3b36 linkcheck: Check the source URL of raw directives
Add raw directives' source URL to the list of links to check with linkcheck.
By the way, refactor HyperlinkCollector by adding `add_uri` function.
Add test for linkcheck raw directives source URL
2022-08-17 14:57:58 +02:00
Takeshi KOMIYA
e7fc03bce2 Allow specifying multiple CSS files in themes (#10465)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2022-07-17 12:27:43 +01:00
Joachim Jablon
663a5b7781 py domain: Ignore aliases for resolving :any: cross-references (#10089)
Co-authored-by: Joachim Jablon <joachim.jablon@people-doc.com>
2022-06-26 13:04:15 +01:00
Martin Liška
f789148fa2 Allow emphasising placeholders in option directives (#10366)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-06-16 20:46:01 +01:00
Takeshi KOMIYA
29edce9243 test: Add testcase for autodoc_inherit_docstring and attributes (refs: #10539) 2022-06-14 02:49:07 +09:00