Commit Graph

1066 Commits

Author SHA1 Message Date
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
Takeshi KOMIYA
ab58bbaed7 Merge pull request #10502 from AA-Turner/ifconfig-fix
`ifconfig`: Add a meta node to fix iteration
2022-06-03 02:15:50 +09:00
Adam Turner
91f90a5fb5 Fix test 2022-06-01 00:50:41 +01:00
Adam Turner
23a4b61415 Add a test 2022-06-01 00:35:28 +01:00
Adam Turner
9fad9d98c2 Fix fake link in test 2022-05-31 17:15:19 +01:00
Adam Turner
d066d23067 Add a test 2022-05-31 17:14:01 +01:00
Takeshi KOMIYA
a904ab563a test: Change URL of testcase 2022-05-30 02:06:30 +09:00
Anselm Kruis
336885c4e2 Add test cases for #8180
The test checks, if ":meta private:" and ":meta public:" have an effect
in attributes of a class. Currently the new test cases fail.
The fix is in the next commit.
2022-05-23 02:04:03 +09:00
Takeshi KOMIYA
06a9139308 Fix #9648: autodoc: *args and **kwargs entries are duplicated
In basic usage of autodoc (docstring), `args` and `kwargs` arguments
are marked up without stars.  But numpydoc style recommends to mark
them up with stars.

This adds support for starred arguments in docstrings to
`autodoc_typehints` feature.
2022-05-15 23:06:49 +09:00
Takeshi KOMIYA
92fcac321b test: Add *args and **kwargs to testcase of target.typehints 2022-05-15 19:05:17 +09:00
Takeshi KOMIYA
e770e2567f Merge pull request #10427 from tk0miya/10421_autodoc_preserve_defaults_for_classmethod
Fix #10421: autodoc_preserve_defaults doesn't work on class methods
2022-05-08 23:19:10 +09:00
Takeshi KOMIYA
10dd5a0e43 Fix #10421: autodoc_preserve_defaults doesn't work on class methods 2022-05-08 22:59:14 +09:00
Takeshi KOMIYA
7134317e49 Merge remote-tracking branch 'origin/5.x' into HEAD 2022-05-07 22:37:58 +09:00
Takeshi KOMIYA
06e5c036b7 Fix an isort warning 2022-05-07 22:20:43 +09:00
Takeshi KOMIYA
5344b1b241 Merge branch '5.x' into 10258_autosummary 2022-05-07 21:27:47 +09:00
Takeshi KOMIYA
425a3e6c09 Merge branch '4.x' into 5.x 2022-05-06 03:32:43 +09:00
Takeshi KOMIYA
3805e0646f Merge pull request #10251 from jbms/fix-inline-syntax-highlight
Make code role highlighting consistent with code-block directive
2022-05-06 02:54:42 +09:00
Takeshi KOMIYA
96b15e9e66 Merge pull request #10353 from tk0miya/10305_optional_forwardref_annotations
Fix #10305: autodoc: Failed to extract optional forwardrefs
2022-05-03 02:03:28 +09:00
Adam Turner
971040b4b7 Merge branch '5.x' into fix-warnings
# Conflicts:
#	tests/test_search.py
2022-05-02 17:05:42 +01:00
Adam Turner
bde47ce679 Add test for duplicated submodules in sphinx.ext.apidoc 2022-05-01 06:12:25 +01:00
Adam Turner
55669f6cfc Specify encoding 2022-04-22 04:21:12 +01:00
Takeshi KOMIYA
a66adb1c32 Fix #10305: autodoc: Failed to extract optional forwardrefs
Autodoc fails to extract optional forwardrefs (ex. `Optional[MyClass]`)
even if `MyClass` is declared in `autodoc_type_aliases`.
2022-04-17 03:09:11 +09:00
zuqq
a450518bb1 Apply autodoc_typehints_format to all type hints
Specifically: attributes, data, properties, and type variable bounds.
2022-04-08 20:27:24 +01:00
Takeshi KOMIYA
f5b3804060 Merge pull request #10285 from jmp1985/master
Fixed singledispatch documentation
2022-04-05 02:30:53 +09:00
James Parkhurst
88b213bbf0 Added test case 2022-04-04 11:45:58 +01:00
Takeshi KOMIYA
21e3a96f09 Close #8417: autodoc: :inherited-members: option now takes multiple classes
It allows to suppress inherited members of several classes on the module at
once by specifying the option to `automodule` directive
2022-04-03 20:17:41 +09:00
Takeshi KOMIYA
0d31fc9614 Merge branch '5.x' into 10266_autodoc_preserve_defaults_crashes_on_kwonlyargs_without_defaults 2022-04-03 16:57:32 +09:00
Takeshi KOMIYA
a78c07ca07 Fix #10280: autodoc_docstring_signature generates needless return typehint
Basically, autodoc suppresses return value typehint for class
constructors.  But it was unexpectedly shown if
`autodoc_docstring_signature` is enabled and docstring has multiple
signatures.
2022-04-03 16:32:35 +09:00
Takeshi KOMIYA
f5e4e70817 Fix #10266: autodoc_preserve_defaults crashes on kwonlyargs w/o defaults 2022-04-02 16:55:48 +09:00
Takeshi KOMIYA
223b1a94f2 Merge branch '4.x' 2022-03-28 01:00:37 +09:00