Commit Graph

4949 Commits

Author SHA1 Message Date
Takeshi KOMIYA
af4e615a8a Close #6241: html: Allow to add JS/CSS files to the specific page
Allow to add JS/CSS files to the specific page when an extension calls
`app.add_js_file()` or `app.add_css_file()` on `html-page-context`
event.
2021-01-07 02:12:07 +09:00
Takeshi KOMIYA
5ba5602d71 Merge pull request #8638 from tk0miya/5977_dont_link_var_field
Close #5977: :var: field do not create a cross-reference …
2021-01-06 01:00:12 +09:00
Takeshi KOMIYA
a51c8a5652 Fix #8655: autodoc: Crashes when object raises an exception on hasattr()
autodoc crashes when the target object raises an exception on
`hasattr()`.  The `hasattr()` function internally calls the
`obj.__getattr__()` or `obj.__getattribute__()` of the target object.
Hence the reaction can be changed on the target object.

This starts to use `safe_getattr()` to check the object is mocked or not
and to prevent an unexpected error.
2021-01-05 23:37:40 +09:00
Takeshi KOMIYA
2d53b7cd66 Update CHANGES for PR #8649 2021-01-04 22:18:28 +09:00
Takeshi KOMIYA
8131e03a52 Merge branch '3.4.x' into 3.x 2021-01-04 21:46:40 +09:00
Takeshi KOMIYA
4755557a7d Bump version 2021-01-04 21:43:54 +09:00
Takeshi KOMIYA
83d5a323ef Bump to 3.4.2 final 2021-01-04 21:42:37 +09:00
Takeshi KOMIYA
5b392e3951 refactor: Move CSS tags in basic/layout.html to `css_files` variable
To make CSS customizable, all CSS files in basic/layout.html has their
priority: 200.  Therefore, extensions and users can insert their own
custom CSS files before or just after them.

As a side effect, the CSS tags in basic/layout.html are removed.  These
CSS files will be rendered via `css_files` template variable.

refs: #8634, c5f0398010
2021-01-03 02:41:17 +09:00
Takeshi KOMIYA
a9c7dd7037 Merge branch '3.x' 2021-01-03 00:20:27 +09:00
Takeshi KOMIYA
c5f0398010 Close #8634: html: Allow to change the order of JS/CSS
`Sphinx.add_js_file()` and `Sphinx.add_css_file()` take `priority`
argument to change the order of JS/CSS files.
2021-01-02 02:06:34 +09:00
Takeshi KOMIYA
918086b559 Close #5977: :var: field do not create a cross-reference
Since its beginning, `:var:` field has created a cross-reference to the
attribute having the same name.  It is meaningful only if the attribute
is documented by `py:attribute` directive.  It means the `:var:` field
and `:attr:` role are almost the same and conflicted.  Additionally,
the cross-reference points incorrect variable if the target is not
documented.

Thus, the cross-reference feature of `:var:` field is disabled.
2021-01-01 22:53:23 +09:00
Takeshi KOMIYA
1544097af5 Merge branch '3.x' 2021-01-01 13:55:12 +09:00
Takeshi KOMIYA
54ef601049 Merge pull request #8630 from tk0miya/8629_warning_for_html_use_opensearch_twice
Fix #8629: html: A type warning for html_use_opensearch is shown twice
2021-01-01 13:14:39 +09:00
Takeshi KOMIYA
b2c9297bd2 Merge pull request #8627 from tk0miya/8315_struct.Struct
Fix #8315: autodoc: Failed to resolve struct.Struct type annotation
2021-01-01 13:13:11 +09:00
Takeshi KOMIYA
05b67f2a3e Merge pull request #8633 from tk0miya/merge_3.4.x
Merge 3.4.x to 3.x
2021-01-01 13:11:56 +09:00
Takeshi KOMIYA
9ec65ff039 Merge branch '3.4.x' into merge_3.4.x 2020-12-31 21:33:43 +09:00
Takeshi KOMIYA
1353a7b82f Merge branch '3.4.x' into 8616_AttributeError_for_non_class 2020-12-31 21:12:29 +09:00
Takeshi KOMIYA
b31b8df9bf Merge pull request #8620 from tk0miya/8619_compound_kbd
Close #8619: html: kbd role generates customizable HTML tags for compound keys
2020-12-31 21:11:42 +09:00
Takeshi KOMIYA
60557715d2 Fix #8629: html: A type warning for html_use_opensearch is shown twice 2020-12-31 18:45:00 +09:00
Takeshi KOMIYA
62a0ee3fef Merge branch '3.x' 2020-12-31 14:33:09 +09:00
Takeshi KOMIYA
f1a051fdfc Fix #8315: autodoc: Failed to resolve struct.Struct type annotation
The builtin module, ``struct.Struct`` does not have correct module
name since Python 3.8.  This allows to refer it automatically.
2020-12-31 14:25:05 +09:00
Takeshi KOMIYA
e3b1fdeeeb Merge branch '3.4.x' into 8602_process-docstring_for_nondatadescriptors 2020-12-31 10:13:03 +09:00
Takeshi KOMIYA
0f8debe558 Fix #8616: autodoc: AttributeError when non-class is passed to autoclass
Since 3.4.0, AttributeError is raised when non-class object is passed to
the autoclass directive.  It has built successfully before 3.4.0
release.  So this handles the exception on generating "alias" text.
2020-12-30 23:29:06 +09:00
Takeshi KOMIYA
6a53c53d53 Fix #8618: html: incorrect HTML for single compound-kdb separators 2020-12-30 21:12:00 +09:00
Takeshi KOMIYA
8e5f4e5616 Close #8619: html: kbd role generates customizable HTML tags for compound keys 2020-12-30 20:36:09 +09:00
Takeshi KOMIYA
c0f923ee6c refactor: Deprecate AttributeDocumenter.isinstanceattribute() 2020-12-29 20:06:29 +09:00
Takeshi KOMIYA
a122397b4b Merge branch '3.x' 2020-12-29 18:37:45 +09:00
Takeshi KOMIYA
3f7bf48715 Merge branch '3.4.x' into 3.x 2020-12-29 18:33:36 +09:00
Takeshi KOMIYA
97f36a2d02 Fix #8602: autodoc: The `autodoc-process-docstring` event is emitted to the non-datadescriptors unexpectedly 2020-12-29 18:04:24 +09:00
Takeshi KOMIYA
85567748d9 Fix #8164: autodoc: Classes that inherit mocked class are not documented
Use ismock() to check a module member is a mocked or not. It allows not
to skip subclasses of mocked class.
2020-12-29 00:26:23 +09:00
Takeshi KOMIYA
f18e988dea Merge pull request #8601 from tk0miya/8306_autosummary_mocks_are_documented
Fix #8306: autosummary: mocked modules are documented as empty page
2020-12-28 17:42:22 +09:00
Takeshi KOMIYA
150f788e0e Merge pull request #8600 from tk0miya/8132_project_copyright
Close #8132: Add project_copyright confval as an alias of copyright
2020-12-28 17:26:49 +09:00
Takeshi KOMIYA
05518851d3 Merge branch '3.x' into 8306_autosummary_mocks_are_documented 2020-12-28 17:25:09 +09:00
Takeshi KOMIYA
146092e35a Merge branch '3.x' into 8094_texinfo_images_not_copied 2020-12-28 16:48:02 +09:00
Takeshi KOMIYA
c5a9d04d45 Merge branch '3.x' into 8132_project_copyright 2020-12-28 13:56:11 +09:00
Takeshi KOMIYA
0d84818739 Fix #8594: autodoc: empty __all__ attribute is ignored
An empty `__all__` should be represented as "there is no public items".
But autodoc considers all items on the module are public.  This changes
the behavior to correct one.
2020-12-28 13:53:56 +09:00
Takeshi KOMIYA
b19bce971e Merge pull request #8593 from tk0miya/8592_meta_public_doesnt_affect_to_variables
Fix #8592: autodoc: `:meta public:` does not effect to variables
2020-12-28 13:51:50 +09:00
Takeshi KOMIYA
ce52a90d92 Fix #8592: autodoc: :meta public: does not effect to variables
To control the visibility of variables, ModuleDocumenter have to load
docstring of them on `get_object_members()` phase.  This reimplements
it and `get_module_members()` helper to fetch docstring on earlier
phase (as ClassDocumenter does).
2020-12-27 22:21:34 +09:00
Takeshi KOMIYA
c86e92cb95 Fix #8306: autosummary: mocked modules are documented as empty page
The :recursive: option for autosummary directive creates an empty page
for mocked modules unexpectedly.  This make them ignored.
2020-12-27 21:45:15 +09:00
Takeshi KOMIYA
c7d1536828 Close #8132: Add project_copyright confval as an alias of copyright
Avoid to pylint error, add a new config variable; project_copyright
as an alias of `copyright`.
2020-12-27 18:40:06 +09:00
Takeshi KOMIYA
703813a8c1 Fix #8094: texinfo: images on the different directory with document are not copied 2020-12-27 14:51:56 +09:00
Takeshi KOMIYA
9e9e486e65 Close #8022: autodoc: Allow to hide the value of the variables via metadata
autodata and autoattribute directives does not show right-hand value of
the variable if its docstring contains ``:meta hide-value:`` in
info-field-list.
2020-12-27 12:46:03 +09:00
Takeshi KOMIYA
df29440da8 Fix #741: autodoc: inherited-members doesn't support instance attributes on super class
It was fixed once, but it does not work expectedly on running Sphinx
from command line.  It only works fine on test script because
:inherited-members: option is recognized as expected.

This fixes the option_spec handler and autodoc itself.

refs: #8548
2020-12-25 22:37:20 +09:00
Takeshi KOMIYA
b1a47f879b Merge branch '3.4.x' into 3.x 2020-12-25 00:06:41 +09:00
Takeshi KOMIYA
7ae7eab65d Bump version 2020-12-25 00:05:29 +09:00
Takeshi KOMIYA
f5406b9187 Bump to 3.4.1 final 2020-12-25 00:04:05 +09:00
Takeshi KOMIYA
5c39d0c068 Fix #8583: autodoc: Unnecessary object comparision via `__eq__` method
It should be compared by `is` keyword instead.
2020-12-24 23:42:32 +09:00
Takeshi KOMIYA
df8ab215c0 Fix #8566: autodoc-process-docstring is emitted to the alias classes
On the refactoring of Documenter.add_content() method, the
autodoc-process-docstring event is emitted to the alias classes (called
as doc_as_attr in our code) unexpectedly.  Before the change, it has
never been emitted.

The event causes that extensions (ex. numpydoc) confused.  So this
reverts the change temporarily (during 3.4.x).

refs: https://github.com/sphinx-doc/sphinx/pull/8533
2020-12-24 01:34:23 +09:00
Takeshi KOMIYA
4496259bc0 Merge branch '3.4.x' into 3.x 2020-12-23 23:18:06 +09:00
François Freitag
a1b8b1febb Ensure linkcheck items are comparable
Linkcheck organizes the URLs to checks in a PriorityQueue. The items are
tuples (priority, url, docname, lineno).

Tuples where the lineno is `None` are not comparable with tuples that
have an integer lineno, and PriorityQueue items must be comparable (see
https://bugs.python.org/issue31145).

Fixes an issue when a document contains two links to the same URL, one
with an int line number and the other without line number metadata (such
as an image :target: attribute).

Using 0 instead of None to represent no line number should not lead to
observable changes, the result logger only logs the line number when it
is truthy.

Close #8565
2020-12-22 21:18:31 +01:00