Commit Graph

4292 Commits

Author SHA1 Message Date
Adam Turner
b5357774a7 Enable Ruff's pylint checks
Also fix two PLW0602 warnings (``global`` without assignment) and
five PLW0120 warnings (else clause on loop without break).
2022-12-29 23:53:48 +00:00
Adam Turner
8634fbce60 Adopt the Ruff code linting tool
https://github.com/charliermarsh/ruff
2022-12-29 17:00:27 +00:00
James Addison
041e5f8268 Add test coverage for 'today_fmt' reference substitution (#10980) 2022-12-29 14:19:43 +00:00
Daniel Eades
1abb24e309 remove blanket 'noqas' 2022-12-16 16:50:24 +01:00
Jean-François B
7418d2ccc4 Deactivate (provisorily) Python12-dev testing (#11035)
* fix flake8 warnings

* Deactivate (provisorily) testing with 3.12-dev

(refs:
https://github.com/sphinx-doc/sphinx/pull/10995#issuecomment-1330310586
)

* Escape # in tox.ini for tox 4 compatibility ('du-latest' tests)

Co-authored-by: Daniel Eades <danieleades@hotmail.com>
2022-12-16 12:41:54 +01: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
Jean-François B
49c48f5aee LaTeX: switch to some nicer defaults for tables and code-blocks (#10924) 2022-10-17 11:19:25 +02:00
Adam Turner
592b46c431 Revert `html_codeblock_linenos_style` removal (#10922) 2022-10-16 16:50:53 +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
Martin Liška
e008e16200 Revert "Fix detection for out of date files (#9360)" (#10908)
This reverts commit b1390c4191.

The change is reverted because some builders don't have
fine-grained support for outdated docs:
https://github.com/sphinx-doc/sphinx/issues/10903#issuecomment-1273199352
2022-10-13 13:16:17 +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
b1390c4191 Fix detection for out of date files (#9360)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-10-05 14:44:41 +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
Adam Turner
2906071198 Merge branch '5.2.x' into 5.x
# Conflicts:
#	CHANGES
#	sphinx/__init__.py
2022-09-30 16:13:11 +01:00
Julien Schueller
66276185ef imgmath: Fix embed mode (#10878) 2022-09-29 15:37: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
bb62d2a2ee Increase minimum Docutils to 0.18 2022-09-27 18:31:47 +01:00
Adam Turner
080517ce55 Increase minimum Docutils to 0.17 2022-09-27 18:31:47 +01:00
Adam Turner
4660b62de0 Drop Python 3.7 2022-09-27 18:31:47 +01:00
Adam Turner
7649eb1505 Clean up after dropping Python 3.6 2022-09-27 18:31:47 +01:00
Adam Turner
51927bb6e4 Merge branch '5.x' 2022-09-27 16:02:52 +01:00
Stephen Finucane
6adbb006f9 Use path2doc rather than reinventing the wheel
We already have a helper function that allows us to convert a filename
to a "docname". Don't reinvent the wheel and simply use this when
building specific files with Sphinx. Note that this does change behavior
slightly, insofar as filenames that don't resolve to valid docnames will
now be ignored rather than being passed with their suffix and silently
ignored later, but that seems sane.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2022-09-26 17:50:57 +01:00
Adam Turner
f01d50d695 Merge branch '5.x'
# Conflicts:
#	CHANGES
#	doc/conf.py
#	sphinx/__init__.py
#	sphinx/builders/html/__init__.py
#	sphinx/domains/python.py
#	tests/test_build_html.py
2022-09-25 21:36:30 +01:00
Adam Turner
9ced736316 Fix highlighting lexers
- Ensure `pycon3` is always normalised to `pycon`
2022-09-25 00:10:59 +01:00
Adam Turner
c7c0e4048d Split out sphinx_highlight.js 2022-09-24 15:10:57 +01:00
Adam Turner
8db24515ea Clear record_dependencies for each document (#10855) 2022-09-24 00:31:26 +01:00
Adam Turner
58a4449707 Deprecate HTML 4 support (#10843) 2022-09-23 18:12:54 +01:00
Adam Turner
56aa3412ef Merge branch '5.x'
# Conflicts:
#	setup.py
#	sphinx/__init__.py
2022-09-23 17:27:00 +01:00
Julien Schueller
ef01c5b6bd imgmath: Allow embedding images in HTML as base64 (#10816)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2022-09-23 17:11:21 +01:00
Adam Turner
8ae81839be Support searching for index entries (#10819) 2022-09-20 22:08:03 +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
Adam Turner
14c9b40f15 Merge branch '5.x'
# Conflicts:
#	setup.py
#	sphinx/application.py
#	sphinx/environment/__init__.py
#	sphinx/ext/autodoc/directive.py
#	tests/test_build_html.py
2022-09-09 09:58:24 +01:00
Adam Turner
f35d2a6cc7 Remove Pygments compatability code (#10812) 2022-09-09 05:08:48 +01:00
Martin Liška
7da60f2353 search: support searching for (sub)titles (#10717)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2022-09-09 02:28:29 +01:00
Jeremy Maitin-Shepard
4cd950e1ba Allow :ref: role to be used with definitions and fields (#10781) 2022-09-06 23:34:20 +01:00
danieleades
12bff8a273 Remove unneeded noqa lint suppression comments (#10772) 2022-08-28 20:03:17 +01:00
danieleades
2b02173617 Further improve type annotations, reduce mypy whitelist (#10770)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2022-08-28 19:50:01 +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
Jean-François B
5c82449eca Merge branch '5.x' 2022-08-06 18:31:14 +02:00
ProGamerGov
b2fe07e1a1 Properly support of in docstring type specifiers (#10738)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-08-02 23:43:32 +01:00
Jean-François B
f72a25ce76 Merge branch '5.1.x' into 5.x 2022-08-01 21:05:47 +02:00
daniel.eades
964fcb2e07 Fix flake8 5.0.0 reported formatting errors 2022-08-01 20:55:47 +02:00
Jakob Lykke Andersen
64c1b2be2e C++, restructure tests 2022-07-29 18:21:34 +02:00
Jakob Lykke Andersen
aa43a37865 C++, fix parsing of certain non-type template parameters
Specifically 'template<int (X::*)(bool)...>'
2022-07-29 18:14:45 +02:00