Commit Graph

2646 Commits

Author SHA1 Message Date
Timotheus Kampik
221614654f
#5605 fix Chinese search index (#5611)
generate search index for Latin words correctly if search language is Chinese
2018-12-25 18:41:52 +01:00
Takeshi KOMIYA
99a7dca216
Merge pull request #5806 from jdufresne/six-text-type
Replace use of six.text_type with str
2018-12-26 01:31:33 +09:00
Takeshi KOMIYA
b5c0edc949 Merge branch '1.8' 2018-12-26 00:37:55 +09:00
Timotheus Kampik
b779975a44 Merge branch 'master' into 5660-version-modified-classes 2018-12-24 14:57:42 +01:00
Takeshi KOMIYA
6ffe549f49 refactor chm_htmlescape() 2018-12-24 13:54:53 +09:00
Timotheus Kampik
edf9d210b6 #5660 adjust expected result to new classes
Also, fix formating glitch
2018-12-23 17:02:31 +01:00
Takeshi KOMIYA
4702086681 Merge branch '1.8' 2018-12-24 00:49:36 +09:00
animalize
9052471e19 don't generate build files inside /tests/roots/ 2018-12-23 22:16:03 +08:00
animalize
cedd94c541 [1.8] htmlhelp: convert hex escaping to decimal escaping in .hhc/.hhk files (#5853)
* htmlhelp: convert hex escaping to decimal escaping in .hhc/.hhk files

.hhc/.hhk files don't recognize hex escaping, we need convert hex escaping to decimal escaping. for example: `'` -> `'`.
2018-12-23 22:39:12 +09:00
jfbu
701b39328f Merge branch '1.8'
(Resolved) Conflicts:
	sphinx/texinputs/sphinxmanual.cls
2018-12-23 11:23:04 +01:00
Takeshi KOMIYA
f06e84ac4f Fix #5800: todo: crashed if todo is defined in TextElement 2018-12-22 01:10:23 +09:00
Jon Dufresne
6978918ffc Replace use of six.text_type with str
This removes the last use of the six package allowing Sphinx to remove
it as a dependency.
2018-12-18 16:23:10 -08:00
Takeshi KOMIYA
3905cb8b7c Merge branch '1.8' 2018-12-18 23:32:52 +09:00
Takeshi KOMIYA
f04e161173
Merge pull request #5826 from tk0miya/refactor_intersphinx
intersphinx: Normalize mapping on config-inited
2018-12-18 23:29:25 +09:00
Takeshi KOMIYA
4c149f6458
Merge pull request #5835 from goerz/1.8
Use mathjax CDN "latest" URL by default
2018-12-18 23:07:42 +09:00
jfbu
bd2ca4763c [tests] LaTeX: use latex engines with `--halt-on-error` option 2018-12-18 13:41:48 +01:00
Michael Goerz
77e617e25a Use mathjax CDN "latest" URL by default
Closes #5725
2018-12-17 22:14:25 -05:00
Jon Dufresne
43ff640b58 Deprecate quickstart.term_decode() and remove internal uses
Per the Python 3 docs, input() always returns a string:

https://docs.python.org/3/library/functions.html#input

> The function then reads a line from input, converts it to a
> string (stripping a trailing newline), and returns that.

The stubs from typeshed say the same:

5c69373890/stdlib/3/builtins.pyi (L835)

Here is the implementation from CPython with also shows a call to
PyUnicode_Decode on the result:

https://github.com/python/cpython/blob/3.7/Python/bltinmodule.c#L1960-L2143

As the value is always a string, there is nothing to decode. Therefore
the call to term_decode() unnecessary and can safely be removed.

With this in mind, must adjust quickstart tests to be more
representative.
2018-12-17 06:44:17 -08:00
Takeshi KOMIYA
556f599e6e intersphinx: Normalize mapping on config-inited 2018-12-17 22:03:47 +09:00
Takeshi KOMIYA
5e5bdb8a64 Remove absolute_import 2018-12-17 20:47:49 +09:00
Takeshi KOMIYA
8ea3f7fad9
Merge pull request #5509 from stephenfin/remove-future-imports
Remove future imports
2018-12-17 20:32:39 +09:00
Takeshi KOMIYA
d8b69c7f98
Merge pull request #5819 from jdufresne/coding-comment
Remove unnecessary encoding cookie from Python source files
2018-12-17 19:15:00 +09:00
Jon Dufresne
e9c87b3d13 Fix invalid escape sequence in test_directive_code.py
Fixes error when running tests:

tests/test_directive_code.py:359
  sphinx/tests/test_directive_code.py:359: DeprecationWarning: invalid escape sequence \s
    includes = '\\end{sphinxVerbatim}\n\sphinxresetverbatimhllines\n'
2018-12-17 11:11:41 +01:00
Takeshi KOMIYA
c7ed4f3ddd
Merge pull request #5814 from jdufresne/str-format-coerce
Remove redundant coerce to str in string formatting
2018-12-17 19:08:28 +09:00
Takeshi KOMIYA
71a7ce1453
Merge branch 'master' into string-classes 2018-12-17 18:58:32 +09:00
Stephen Finucane
5a9033e5aa Specifically request Python 3
If Sphinx is Python 3-only, Sphinx's tooling should be Python 3-only
too.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-12-17 09:46:18 +00:00
Stephen Finucane
d345d0f8c1 py3: Remove (most) __future__ imports
There were two used:

- print_function
- absolute_import

Both of these are mandatory in Python 3.0 onwards [1] and can therefore
be removed...mostly. Unfortunately, mypy is still running in Python 2.7
mode, meaning we need the 'print_function' future wherever we're calling
'print' with the 'file' argument. There's also a single
'absolute_import' future that must be retained as its removal breaks a
test for as-yet unknown reasons.  TODOs are added to resolve both issues
in the future.

[1] https://docs.python.org/3/library/__future__.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-12-17 09:46:15 +00:00
Jon Dufresne
d210da96f6 Fix invalid escape sequence in test_directive_code.py
Fixes error when running tests:

tests/test_directive_code.py:359
  sphinx/tests/test_directive_code.py:359: DeprecationWarning: invalid escape sequence \s
    includes = '\\end{sphinxVerbatim}\n\sphinxresetverbatimhllines\n'
2018-12-16 13:37:47 -08:00
Jon Dufresne
bade33c7e4 Remove unnecessary encoding cookie from Python source files
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:

https://docs.python.org/3/howto/unicode.html#the-string-type

> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...

Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
2018-12-16 12:22:12 -08:00
Jon Dufresne
80861d105b Deprecate sphinx.config.string_classes; remove all internal uses
With only a single text type across supported Python versions, the
string_classes is no longer necessary.

Internally, all uses were converted to the value `[str]`. For
.add_config_value() uses that also supply a default string, the type is
inferred.
2018-12-16 11:35:06 -08:00
Jon Dufresne
2b0096fba9 Remove redundant coerce to str in string formatting
When an object is passed to a string format placeholder '%s', Python
will implicitly call str() on the object. This applies to print() and
logging as well.
2018-12-16 10:03:45 -08:00
jfbu
30ec4b6bba Merge branch '1.8' 2018-12-16 18:34:05 +01:00
Jakob Lykke Andersen
73a8b7e658 Merge branch 'cpp_fix_float_literals' into 1.8 2018-12-16 17:19:57 +01:00
Jakob Lykke Andersen
b3de33deef C++, fix parsing of floating point literals
Fixes sphinx-doc/sphinx#5636
2018-12-16 16:56:55 +01:00
jfbu
88a019dc99 LaTeX: allow sphinxVerbatim usage without explicit "hllines" extra setup
Fixes: #5810
2018-12-16 16:54:28 +01:00
Takeshi KOMIYA
c6bd84a614 refactor: Remove u-prefix from strings 2018-12-16 21:28:51 +09:00
Takeshi KOMIYA
ea1d2d06f8
Merge pull request #5803 from jdufresne/encoding-utf8
Avoid respecifying default encoding for .encode()/.decode() calls
2018-12-16 20:01:43 +09:00
Takeshi KOMIYA
2597c4174e
Merge pull request #5796 from jdufresne/super
Use Python 3 super() argument-less syntax
2018-12-16 19:46:47 +09:00
Jon Dufresne
5bf25eb445 Avoid respecifying default encoding for .encode()/.decode() calls
In Python 3, both .encode() and .decode() default the encoding to
'utf-8'. See the docs:

https://docs.python.org/3/library/stdtypes.html#str.encode
https://docs.python.org/3/library/stdtypes.html#bytes.decode

Simplify and shorten the code by using the default instead of
respecifying it.
2018-12-15 17:19:56 -08:00
Jon Dufresne
49d3a3c0c1 Replace ENOENT errno checks with Python 3 FileNotFoundError
The error is more specific and self documenting.

This removes the last use of sphinx.util.osutil.ENOENT, so it is now
deprecated for removal. sphinx.util.osutil.EEXIST was already unused so
that is deprecated as well.
2018-12-15 09:02:55 -08:00
Jon Dufresne
ade973f4e3 Use Python 3 super() argument-less syntax
The form is less verbose and more idiomatic for Python 3 only code.

https://docs.python.org/3/library/functions.html#super
2018-12-15 08:35:55 -08:00
Takeshi KOMIYA
c70e65fc6c
Merge branch 'master' into 5770_doctest_refers_highlight_language 2018-12-16 00:32:10 +09:00
Takeshi KOMIYA
b56f4f9022 Remove print_function feature 2018-12-15 23:16:10 +09:00
Takeshi KOMIYA
415ebc15c5
Merge pull request #5784 from tk0miya/refactor_hack_for_py2
Refactor hack for py2
2018-12-15 22:40:46 +09:00
Takeshi KOMIYA
66fad4e22d Remove a hack for py2 from testcode 2018-12-15 22:01:22 +09:00
Takeshi KOMIYA
fd1dd13a50 refactor: Replace six.StringIO by io.StringIO 2018-12-15 21:00:38 +09:00
Takeshi KOMIYA
001a557fcf
Merge pull request #5781 from tk0miya/refactor_six.PY2
refactor: Drop six.PY2
2018-12-15 20:57:51 +09:00
Takeshi KOMIYA
e789080b54 refactor: Drop six.PY2 2018-12-15 20:08:39 +09:00
Takeshi KOMIYA
5f8b1ede8e refactor: Replace six.add_metaclass by __metaclass_ attribute 2018-12-15 20:06:26 +09:00
Takeshi KOMIYA
d6d4406ce9 Fix #5770: doctest: Follow highlight_language on highlighting doctest block 2018-12-15 18:35:12 +09:00
Takeshi KOMIYA
389f756f88 refactor: special rubric for footnotes 2018-12-10 00:07:25 +09:00
Takeshi KOMIYA
8a6179aa61 Process prolog and epilog on RSTParser (instead Input component) 2018-12-05 23:11:16 +09:00
Takeshi KOMIYA
5fa8ca492b Add prepend_prolog() and append_epilog() 2018-12-05 23:10:23 +09:00
Takeshi KOMIYA
ab3eb1b61d Add testcases for mock() 2018-12-04 23:57:01 +09:00
Takeshi KOMIYA
825426c841 refactor figure_wrapper() using state.inline_text() 2018-12-04 01:14:53 +09:00
Takeshi KOMIYA
b3d71ca683
Merge branch 'master' into refactor_SphinxTranslator 2018-12-03 23:16:03 +09:00
Takeshi KOMIYA
3863256cb6 Add SphinxTranslator as an abstract class 2018-12-03 22:30:56 +09:00
Takeshi KOMIYA
b76966815c Fix annotations of testing 2018-12-03 22:22:07 +09:00
Takeshi KOMIYA
28add225f2 Merge branch '1.8' 2018-12-02 22:26:12 +09:00
Takeshi KOMIYA
e8ea448474
Merge pull request #5699 from tk0miya/smart_manpage_conf_py
quickstart: Simplify generated conf.py (for manpage)
2018-12-02 18:18:55 +09:00
Takeshi KOMIYA
a5e7e85e92 quickstart: Simplify generated conf.py (for manpage) 2018-12-02 17:57:20 +09:00
Takeshi KOMIYA
5e1c45355e quickstart: Simplify generated conf.py (for htmlhelp) 2018-12-02 11:30:40 +09:00
Takeshi KOMIYA
e527be396a
Merge pull request #5607 from tk0miya/smart_texinfo_conf_py
quickstart: Simplify generated conf.py (for texinfo)
2018-12-02 01:30:51 +09:00
Takeshi KOMIYA
8608102da6 Refactor metadata handling 2018-11-30 17:56:19 +09:00
Takeshi KOMIYA
3808405b50 Fix #5659: linkcheck: crashes for a hyperlink containing multibyte character 2018-11-25 01:37:32 +09:00
Takeshi KOMIYA
722c92250c Fix #5648: NodeMatcher matches Text node on attribute match 2018-11-25 01:16:17 +09:00
Takeshi KOMIYA
b2f069ba6e Add testcase for default_texinfo_documents 2018-11-24 01:23:27 +09:00
Jon Dufresne
d99e2cae19 Deprecate evaluating Python 2 syntax in configuration files 2018-11-22 19:05:14 -08:00
Takeshi KOMIYA
4761e70c37 Merge branch '1.8' 2018-11-22 22:14:32 +09:00
Jean-François B
8412bdf9d6
Merge pull request #5645 from jfbu/latex_greek_cyrillic_letters
LaTeX: support for Greek and Cyrillic
2018-11-21 23:11:15 +01:00
Jon Dufresne
77849f0ef6 Simplify ensuredir() with Python3 stdlib features
- Simplify ensuredir() to equivalent os.makedir(name, exist_ok=True)
- Do not check if a directory exists before calling
  ensuredir() (ensuredir() already handles it)
- Add exist_ok argument to path.makedirs() to follow same pattern
- Drop unnecessary .exists() check immediately before .isdir()
- Add tests for ensuredir
2018-11-20 18:37:05 -08:00
jfbu
4457038550 LaTeX: compatibility with caption package, 2nd part
Ensure same vertical spaces above caption for tabular(y) and longtable
rendered tables.

Fixes: #5520
2018-11-18 00:40:28 +01:00
jfbu
2825e338c2 LaTeX: support for Greek and Cyrillic
0. do not escape Unicode Greek letters via LaTeX math mark-up: pass them
   through un-modified to LaTeX document,

1. if "fontenc" receives extra option LGR, then pdflatex will support
   Unicode Greek letters (not in math), and with extra option T2A it
   will support (most) Unicode Cyrillic letters.

2. for pdflatex with LGR, this will use "textalpha" LaTeX package and
   "substitutefont" package to set up some automatic font substitution
   to work around the unavailability of Greek with "times"
   package (which is default font package chosen by Sphinx for
   pdflatex), same with T2A and "substitutefont" for Cyrillic.

3. for xelatex/lualatex, set up Computer Modern Unicode as default font,
   as it supports Cyrillic and Greek scripts,

4. for platex, don't do anything special as the engine already has
   its default font supporting Cyrillic and Greek (even in math mode!)

Closes: #5251
Fixes:  #5248
Fixes:  #5247
2018-11-16 21:14:51 +01:00
Takeshi KOMIYA
6c94801ec2
Merge pull request #5621 from jdufresne/str-bytes
Fix all BytesWarning identified through tests
2018-11-14 20:05:48 +09:00
Jon Dufresne
4cda774566 Improve JS handling in test_search.py
- Reuse jsload() in all tests to reduce duplication.
- Fix -2 index to -1, to include the entire JSON string. Was previously
  chopping off the final '}'.
- Assert the serialized string ends with a closing parenthesis
2018-11-13 21:25:46 -08:00
Jon Dufresne
41ad0d5347 Fix all BytesWarning identified through tests
Code should not arbitrarily mix bytes & str values. The values should be
understood and deliberate. When Python is run with the -b option, this
change fixes warnings of the form:

  BytesWarning: str() on a bytes instance
2018-11-13 18:08:49 -08:00
Jean-François B
3a512ef68c
Merge branch '1.8' into 5520_latex_caption_package 2018-11-14 00:12:27 +01:00
jfbu
7f19885641 LaTeX: compatibility with caption package
This compatibility is mainly re-instored for convenience of user to
style the fonts used for the caption, and also possibly influence the
horizontal position via "width" or "margin" option of caption package
(attention that caption package obeys the document class tacit "twoside"
option, so if left and right margins are not set-up to be the same,
positioning of caption will depend on parity of the page number).

Regarding vertical skips, for captions placed on top (which is the table
templates default and also the literalblockcappos default), this commit
ensures that the vertical spacing separating the caption last baseline
to the top of framing is governed by \sphinxbelowcaptionspace in all
these three cases: tabular(y), longtable, literal blocks; the "skip"
option of caption package is ignored for them.

The "skip" is obeyed for the spacing between an image and its caption,
which currently in Sphinx is always below the image (no customization of
the figure caption vertical placement is currently available).

If literalblockcappos is "b" (captions follow code-blocks), this commit
removes the caption-package added \abovecaptionskip, so that "skip" is
also ignored for code-blocks in this case. This looks better due to the
extra space already added by the framing of the code-block and achieves
same spacing as without caption package (presumably loaded mainly to
style the fonts used for the caption). However in future maybe caption's
package "skip" should be obeyed for "literalblock" caption type.

Fixes: 5520
2018-11-13 23:55:11 +01:00
Jon Dufresne
555960d668 Deprecate and drop internal use of force_decode()
In the Python 3 only code base, this function is no longer necessary.
The type of values is well understood and deliberate. Code should avoid
arbitrary mixing of bytes & str.

By removing force_decode() calls from docstring values, can deprecate
the now unused 'encoding' arguments to various autodoc methods.
2018-11-13 07:16:39 -08:00
Jon Dufresne
444a7212b6 Fix "invalid escape sequence" warnings emitted during tests
sphinx/tests/test_quickstart.py:221: DeprecationWarning: invalid escape sequence '\*'
    content = filename.bytes().decode('unicode-escape')
  sphinx/tests/test_quickstart.py:221: DeprecationWarning: invalid escape sequence '\`'
    content = filename.bytes().decode('unicode-escape')
2018-11-13 07:14:24 -08:00
Jon Dufresne
0137b0287a Remove dead code or '.'
The expression `os.path.dirname(__file__)` always evaluates as a truthy
value. The `or '.'` is never evaluated.
2018-11-12 14:31:29 -08:00
Takeshi KOMIYA
33a60ee80e Fix #5614: autodoc: incremental build is broken when builtin modules are imported 2018-11-13 01:05:13 +09:00
Jon Dufresne
710ca3d7c3 Use super() to call parent class's method 2018-11-11 13:07:12 -08:00
Takeshi KOMIYA
0ccc64d9ea test: Filter warnings on testing 2018-11-12 00:37:51 +09:00
Takeshi KOMIYA
bdaedbcbe4 quickstart: Simplify generated conf.py (for texinfo) 2018-11-11 21:57:14 +09:00
Takeshi KOMIYA
9c4e5b244a test: Replace call_autodoc() by do_autodoc() 2018-11-11 21:22:11 +09:00
Takeshi KOMIYA
2810f77edd Merge branch '1.8' 2018-11-09 22:10:35 +09:00
Takeshi KOMIYA
b28ab1e103
Merge pull request #5600 from tk0miya/3080_invalid_texinfo
Fix #3080: multiline rubrics and citations are broken in texinfo builder
2018-11-09 22:08:51 +09:00
Takeshi KOMIYA
feba53ff55 Fix #3080: texinfo: multiline citations are broken 2018-11-08 23:33:00 +09:00
Takeshi KOMIYA
84f781252f Fix #3080: texinfo: multiline rubric is broken 2018-11-08 23:33:00 +09:00
jfbu
16f47cded9 Merge branch '1.8' 2018-11-06 18:30:21 +01:00
Takeshi KOMIYA
dcc4ac55bb latex: Move \pageautorefname to sphinxmessages.sty 2018-11-01 22:47:15 +09:00
jfbu
4df3b067b7 LaTeX: add styling to general index, similar to domain indices
Closes: #5579. Also closes #5576.
2018-10-31 19:22:34 +01:00
Takeshi KOMIYA
8b687ac304 Merge branch '1.8' 2018-11-01 01:24:12 +09:00
Takeshi KOMIYA
e3574a6f78 Fix #3002: i18n: multiple footnote_references referring same footnote causes duplicated node_ids 2018-11-01 00:54:25 +09:00
Takeshi KOMIYA
08aadcffcd
Merge pull request #5559 from JulienPalard/text-colspan-rowspan
Working on text colspan and rowspan.
2018-11-01 00:42:02 +09:00
jfbu
f4d7b2e60e Fix invalid escape sequence \d in test (refs #5513) 2018-10-30 17:47:59 +01:00
Julien Palard
dfa1824f19 Removing unnecessary indent. 2018-10-28 08:42:36 +01:00
Takeshi KOMIYA
a4cce3e561
Merge pull request #5546 from tk0miya/refactor_test_root
test: Move autodoc_missing_imports to test-ext-autodoc
2018-10-25 23:55:07 +09:00
Takeshi KOMIYA
1af1d8a82b
Merge pull request #5536 from tk0miya/5497_install_mathjax_only_if_needed
Fix #5497: Do not include MathJax.js and jsmath.js unless it is really needed
2018-10-25 23:03:38 +09:00
Julien Palard
d527497b1f Moar tests 2018-10-23 18:41:08 +02:00
Julien Palard
9b30fc938d Working on text colspan and rowspan. 2018-10-22 23:38:01 +02:00
Takeshi KOMIYA
ca8bc8ca49 refactor: Deprecate app._setting_up_extension 2018-10-17 11:56:11 +09:00
Takeshi KOMIYA
ea03286647 test: Move autodoc_missing_imports to test-ext-autodoc 2018-10-17 11:36:11 +09:00
Takeshi KOMIYA
4ed5c51cff logging: Add prefixed_warnings() helper 2018-10-17 11:21:22 +09:00
Takeshi KOMIYA
44b385e2c9
Merge pull request #5533 from ericvw/autodoc_member-only_default-options
autodoc: Respect `member-order` in `autodoc_default_options` as documented
2018-10-17 11:12:56 +09:00
Takeshi KOMIYA
2e6e940df8 Fix #5497: Do not include MathJax.js and jsmath.js unless it is really needed 2018-10-17 01:42:17 +09:00
Takeshi KOMIYA
7e23a061b3 Fix typo 2018-10-16 10:34:59 +09:00
Takeshi KOMIYA
84e1eeb8a2 Move env.doc2path() and env.path2doc() to Project class 2018-10-16 10:34:59 +09:00
Takeshi KOMIYA
eaec3bd916 Add sphinx.project; a manipulator for project and documents 2018-10-16 10:34:58 +09:00
Takeshi KOMIYA
e7e07fd697 Merge branch '1.8' 2018-10-16 09:57:54 +09:00
Takeshi KOMIYA
793792fafc Fix #5480: autodoc: unable to find type hints for unresolvable Forward references 2018-10-15 23:40:05 +09:00
Eric N. Vander Weele
d6b9db9581 tests: Ensure 'member-only' autodoc_default_options is respected
When specifying the 'member-only' option to `autodoc_default_options`,
ensure it is respected.
2018-10-14 20:18:59 -04:00
Takeshi KOMIYA
b2cc425909 Fix #5498: autodoc: unable to find type hints for a `functools.partial` 2018-10-14 16:29:04 +09:00
jfbu
7ab09b5065 Fix #3704: wrong `\label` positioning for figures with a legend 2018-10-07 10:16:11 +02:00
Takeshi KOMIYA
6eb5b29484 Merge branch 'master' into refactor_latex 2018-10-07 13:33:55 +09:00
Paul Melnikow
e792279791 Improve error message when config fails type check
The old message printed wrapped brackets around the type name, which would make you think it required an array.
2018-10-02 14:20:36 -04:00
Takeshi KOMIYA
973c3ffa25
Merge branch 'master' into change_master_doc_to_index 2018-09-29 21:12:40 +09:00
Takeshi KOMIYA
67e9f87a54
Merge branch 'master' into bytesio 2018-09-25 08:29:37 +09:00
Jon Dufresne
65da8a08ac Remove plistlib workaround for unsupported Pythons 2018-09-23 20:25:36 -07:00
Jon Dufresne
4f4e225775 Replace all six.BytesIO with io.BytesIO 2018-09-23 18:38:06 -07:00
Takeshi KOMIYA
ff8df59ac1
Merge pull request #5479 from jdufresne/https
Prefer https:// links where available
2018-09-24 09:04:54 +09:00
Jon Dufresne
dd383ec472 Prefer https:// links where available 2018-09-23 11:50:42 -07:00
Jon Dufresne
02d06bdaf0 Remove uses of six.moves that did not cause any type errors
Removal of the remaining imports may require passing "--python-version
3.5" to the mypy command.
2018-09-23 09:22:06 -07:00
Rob Ruana
e547a6a0d2
Fixes #5426: [Napoleon] Better handling of inline attributes (#5470)
* Fixes #5426: [Napoleon] Better handling of inline attributes

* Removes uneeded NOQA comments

* Fixes imports
2018-09-23 09:26:17 -04:00
Antony Lee
dbb7c38220 Rendering of exceptions by napoleon. (#4046)
This lets napoleon render exceptions using the standard info field
syntax
```
:raises FooException: Some condition.
```
rather than the nonstandard
```
:raises: :exc:`FooException` -- Some condition.
```

Note that the previous approach was more forgiving if an explanatory
text was given in the Raises section without an actual exception class:
```
Raises
------
If something occurs.
```
would be rendered as
```
:raises: *If something occurs*
```
which is OK-ish but is now rendered as
```
:raises If something occurs.:
```
which is somewhat more nonsensical.

However neither the Google style guide nor numpydoc actually support
this form (they always have both the type and the description) so I
think the change is reasonable.
2018-09-23 08:31:27 -04:00
Jon Dufresne
a3bc49dd64 Remove Python 2.6 compat shim for ElementTree.itertext 2018-09-22 10:32:28 -07:00
Takeshi KOMIYA
dc44b0d2a9 Merge branch 'master' into HEAD 2018-09-22 22:54:15 +09:00
Takeshi KOMIYA
6f25bd3680
Merge branch 'master' into drop-iteritems 2018-09-22 22:17:38 +09:00
Takeshi KOMIYA
3a2418a827 refactoring: Drop PY2 and PY3 flags 2018-09-22 21:27:59 +09:00
Takeshi KOMIYA
98648325aa Merge branch '1.8' 2018-09-22 17:16:24 +09:00
Takeshi KOMIYA
48c634e623 test: Merge py35/test_autodoc_py35.py to test_autodoc.py 2018-09-22 16:41:44 +09:00
Takeshi KOMIYA
40a2fdf315 test: Merge py3/test_util_inspect_py3.py to test_util_inspect.py 2018-09-22 16:36:10 +09:00
Takeshi KOMIYA
b18fe13f55 Drop branches for sys.version_info < (3, 4) 2018-09-22 16:31:07 +09:00
Takeshi KOMIYA
c0fffb9e8b Fix #5432: py domain: :type: field can't process :term: references 2018-09-22 15:24:14 +09:00
Takeshi KOMIYA
522105b79b Merge branch '1.8' 2018-09-20 20:01:14 +09:00
Takeshi KOMIYA
c7f3933612
Merge branch '1.8' into 5431_warnings_for_callable 2018-09-18 23:34:33 +09:00
Takeshi KOMIYA
5c3a0e4e40 Fix #5431: autodoc: `autofunction` emits a warning for callable objects 2018-09-18 13:02:01 +09:00
Takeshi KOMIYA
9e8434f902 Fix #5436: Autodoc does not work with enum subclasses with properties/methods 2018-09-18 13:01:10 +09:00
Takeshi KOMIYA
6d55e98da1 test: Move EnumCls to target.enum package 2018-09-18 13:01:10 +09:00
Takeshi KOMIYA
efdc95ef8b Merge branch '1.8' 2018-09-13 00:53:09 +09:00
Jon Dufresne
490e4aed41 Remove unnecessary object from class definitions
In Python 3, all classes are new-style classes. The object in the
definition is redundant and unnecessary.
2018-09-11 07:07:01 -07:00
Jon Dufresne
0d6be504ea Remove use of six.iteritems()
In Python 3, dict.items() is always an iterator.
2018-09-11 06:03:34 -07:00
Jon Dufresne
9d6deec4ca Fix AttributeError in ExtensionError
In Python 3, the attribute BaseException.message doesn't exist.

$ python3
>>> from sphinx.errors import ExtensionError
>>> e = ExtensionError('foo')
>>> repr(e)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sphinx/sphinx/errors.py", line 65, in __repr__
    return '%s(%r)' % (self.__class__.__name__, self.message)
AttributeError: 'ExtensionError' object has no attribute 'message'
2018-09-09 11:50:56 -07:00
Takeshi KOMIYA
ffaa528c98
Merge pull request #5390 from tk0miya/4018_htmlhelp_file_suffix
Fix #4018: htmlhelp: Add htmlhelp_file_suffix and htmlhelp_link_suffix
2018-09-09 19:35:49 +09:00
Takeshi KOMIYA
02afc357ef Merge branch '1.8' 2018-09-09 19:26:48 +09:00
Takeshi KOMIYA
d1eecb1307 Merge branch '1.7' into 1.8 2018-09-09 19:22:35 +09:00
Takeshi KOMIYA
973986cfdb Add $DO_EPUBCHECK envvar as a workaround for #4611 2018-09-09 19:09:56 +09:00
Takeshi KOMIYA
07fd1c0680 Fix #4018: htmlhelp: Add htmlhelp_file_suffix and htmlhelp_link_suffix 2018-09-08 23:11:14 +09:00
Takeshi KOMIYA
8e729b419e Fix #5399: Sphinx crashes if unknown po file exists 2018-09-08 22:21:59 +09:00
Max
61f9005b73 _MockModule and _MockObject now display meaningful names in type annotations and superclass names 2018-09-07 15:14:01 +03:00
Takeshi KOMIYA
35e1764025 Fix #5290: autodoc: failed to analyze source code in egg package 2018-09-06 22:22:01 +09:00
Takeshi KOMIYA
a2d5c79114
Merge branch '1.8' into 4034_fix_download_url2 2018-09-06 02:00:37 +09:00
Takeshi KOMIYA
750e037ce6
Merge pull request #5388 from lamby/reproducbible-frozenset
Ensure frozen object descriptions are reproducible
2018-09-06 01:08:32 +09:00
Takeshi KOMIYA
f7e556c1db
Merge pull request #5376 from tk0miya/2401_members_conflicts_with_special_members
Fix #2401: autodoc: ``:members:`` causes ``:special-members:`` not to be shown
2018-09-06 00:06:25 +09:00
Chris Lamb
17d32d625b Ensure frozenset object descriptions are reproducible
Whilst working on the Reproducible Builds effort [0], we noticed
that sphinx could generate output that is not reproducible.

In particular, the rendering of `frozenset` objects in default
arguments and elsewhere is currently non-determinstic.

For example:

    frozenset(['a', 'b', 'c'])

Might be rendered as any of:

    frozenset({'a', 'b', 'c'})
    frozenset({'a', 'c', 'b'})
    frozenset({'b', 'a', 'c'})
    frozenset({'b', 'c', 'a'})
    frozenset({'c', 'a', 'b'})
    frozenset({'c', 'b', 'a'})

Patch attached that sorts the contents of frozensets whilst rendering.
This is parallel to the `dict` and `set` type logic

  [0] https://reproducible-builds.org/
2018-09-05 15:58:54 +01:00
Takeshi KOMIYA
342de4f0fd Merge branch '1.8' 2018-09-05 23:10:20 +09:00
Takeshi KOMIYA
3d35723f6d Merge branch '1.7' into 1.8 2018-09-05 23:09:48 +09:00
Takeshi KOMIYA
abcb5bd5ec The default setting for master_doc is changed to 'index' 2018-09-04 01:14:16 +09:00
Takeshi KOMIYA
06aa1a7864 Fix #2401: autodoc: `:members: causes :special-members:` not to be shown 2018-09-03 01:26:31 +09:00
Takeshi KOMIYA
34cc1b5c95 Fix #2720, #4034: Incorrect links with `:download:`, duplicate names, and parallel builds 2018-09-03 01:01:55 +09:00
Takeshi KOMIYA
a7cab001d9 Drop APIs deprecated in 2.0 2018-09-03 00:31:33 +09:00
Takeshi KOMIYA
219f024595 Add testcase for pygments 2018-09-02 16:17:02 +09:00
Dmitry Shachnev
561199e5e8 Make generated texinfo files reproducible by sorting the anchors 2018-08-30 13:03:49 +03:00
Takeshi KOMIYA
db1582833d
Merge pull request #5346 from tk0miya/add_NodeMatcher
[Proposal] Add a helper class for Node.traverse()
2018-08-29 23:49:59 +09:00
Takeshi KOMIYA
63dc6afb62
Merge branch '1.8' into 5348_support_remote_download_file 2018-08-27 01:21:19 +09:00
Takeshi KOMIYA
c5c023cb68
Merge pull request #5352 from tk0miya/improve_pytest_header
Improve pytest header
2018-08-27 01:20:42 +09:00
Takeshi KOMIYA
aee5fd04d4 Fix #5348: download reference to remote file is not displayed 2018-08-26 22:25:35 +09:00
Jakob Lykke Andersen
2a544b4ec3 C++, conditionally disable test on sys.maxunicode 2018-08-26 13:17:53 +02:00
Takeshi KOMIYA
9f7afa161e Add NodeMatcher; a helper class for Node.traverse() 2018-08-26 18:14:07 +09:00
Takeshi KOMIYA
48427ae57a Improve pytest header 2018-08-26 11:28:06 +09:00
Takeshi KOMIYA
8eb44a40ab
Merge branch '1.8' into 5321_invalid_lineno_for_i18n_warnings 2018-08-25 11:45:16 +09:00
Takeshi KOMIYA
ea3d0b3768 Merge branch '1.7' into 1.8 2018-08-25 03:07:35 +09:00
Takeshi KOMIYA
520797a5e8 test: Upgrade python on Circle CI to 3.5 2018-08-25 02:53:17 +09:00
Takeshi KOMIYA
328ff6eeae Fix i18n: warnings for translation catalogs have wrong line numbers 2018-08-22 21:01:50 +09:00
Takeshi KOMIYA
59a766d7d6 Fix #5322: autodoc: `Any` typehint causes formatting error 2018-08-22 19:57:27 +09:00
Takeshi KOMIYA
db8865a46d
Merge pull request #5063 from jakobandersen/search_use_dispname
Search: make a difference between fullname and dispname
2018-08-20 22:15:03 +09:00
Takeshi KOMIYA
e3f383ad7c
Merge pull request #5315 from tk0miya/add_autodoc_default_options
Add autodoc_default_options
2018-08-20 00:26:08 +09:00
Takeshi KOMIYA
7f52ef7512 Merge branch '1.7' 2018-08-19 02:19:06 +09:00
Takeshi KOMIYA
3d9e2cf831 Add autodoc_default_options 2018-08-18 18:22:16 +09:00
Lewis Haley
f196a92055 autodoc: add 'exclude-members' to user global options
As the previous commit explains, it is now possible to specify arguments
to the global options in config files. This means that we can now include
the `exclude-members` option in this global configuration.

Previously, there was no point including this option because it makes no
sense without arguments. Including this option means users have the
flexibility of explicitly including which special methods they want using
(e.g.):

  :special-members: __init__, __iter__

or explicitly excluding which special-members (or other members) they want
using (e.g.):

  :exclude-members: __weakref__, __hash__
2018-08-17 16:02:11 +01:00
Lewis Haley
6e1e35c98a autodoc: allow specifying values to global arguments
Previously, users could specify a *list* of flags in their config files.
The flags were directive names that would otherwise be present in the
.rst files. However, as a list, it was not possible to specify values
to those flags, which *is* possible in .rst files.

For example, in .rst you could say

  :special-members: __init__, __iter__

And this would cause autodoc to generate documents for these methods that
it would otherwise ignore.

This commit changes the config option to instead accept a dictionary.
This is a dictionary whose keys can contain the same flag-names as before,
but whose values can contain the arguments as seen in .rst files.

The old list is still supported, for backwards compatibility, but the data
is transformed into a dictionary when the user's config is loaded.
2018-08-17 15:51:00 +01:00
Lewis Haley
87029392fd test_autodoc: fix mutable function default argument in do_autodoc
Setting mutable types as default arguments is bad practice because the
value is only initialised once. This means that defaults arguments of
lists and dictionaries which are modified during code execution *stay*
modified between calls.

In this case, the `options` dictionary accumulated options as more and
more test cases were executed. Without this change, the tests added in
the next commit do not pass.

See: https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument
2018-08-17 15:33:58 +01:00
Jakob Lykke Andersen
9cddc344db
Merge pull request #5311 from jakobandersen/cpp_new_delete_expr
C++, add parsing of new and delete expressions
2018-08-17 14:33:06 +02:00
Jakob Lykke Andersen
73ae1ac834 C++, add parsing of basic new expressions. 2018-08-17 13:49:44 +02:00
Takeshi KOMIYA
c4fa1aed34 Fix #5211: autodoc: No docs generated for functools.partial functions 2018-08-17 01:24:19 +09:00
Takeshi KOMIYA
11331c5923 Merge branch '1.7' 2018-08-17 00:56:35 +09:00
Takeshi KOMIYA
28131df93e
Merge pull request #5307 from akaihola/5273_doctest_conditional_skip
Feature: skip doctests conditionally
2018-08-17 00:33:29 +09:00
Antti Kaihola
098f37fddf Ref #5273: doctest: add test for skipif calling global setup/cleanup
Ensure that `doctest_global_setup` and `doctest_global_cleanup` are executed
before and after evaluating each `:skipif:` option.
2018-08-16 17:56:29 +03:00
Antti Kaihola
5ffc924940 Ref #5273: doctest: added a missing final newline 2018-08-16 14:09:06 +03:00
Antti Kaihola
9185c2c356 Ref #5273: doctest: add tests for the :skipif: option 2018-08-16 13:22:59 +03:00
Takeshi KOMIYA
91650d89c9 Fix #5291: autodoc crashed by ForwardRef types 2018-08-15 21:30:49 +09:00
Jakob Lykke Andersen
6433e08069 C++, add parsing of delete expressions. 2018-08-15 10:08:31 +02:00
Takeshi KOMIYA
955c3d388b test Signature annotations in py34 too 2018-08-15 01:22:52 +09:00
Takeshi KOMIYA
e26dc81272 Fix autodoc: Optional types are wrongly rendered 2018-08-15 01:22:52 +09:00
Takeshi KOMIYA
848224f641 Add LaTeXBuilder.context: Build context object by builder 2018-08-13 23:52:44 +09:00
Jakob Lykke Andersen
349890266c C++, parse attributes on declerators as well.
Fixes sphinx-doc/sphinx#5187
2018-08-11 16:39:27 +02:00
Jakob Lykke Andersen
ef5448e8bc
Merge pull request #5284 from jakobandersen/cpp_char_lit_5147
C++, add support for (most) character literals.
2018-08-10 22:59:22 +02:00
Jakob Lykke Andersen
44127fd13b C++, add support for (most) character literals.
Fixes sphinx-doc/sphinx#5147
2018-08-10 22:13:18 +02:00
Terence D. Honles
da45604485 handle NoneType as None 2018-08-10 11:58:08 -07:00
Takeshi KOMIYA
b09c54e669
Merge branch 'master' into graphviz_width_of_svg 2018-08-07 23:16:37 +09:00
Takeshi KOMIYA
b01256dbaf
Merge pull request #5253 from tk0miya/enable_epub_by_default
Enable epub by default
2018-08-07 01:05:07 +09:00
Timotheus Kampik
97fd09177c #5258 add tests for highlightText() 2018-08-05 10:45:21 +02:00
Takeshi KOMIYA
7e546c0e0b refactor: Remove duplicated testcase 2018-08-05 08:18:21 +09:00
Takeshi KOMIYA
de73ee5902 refactor: test_autodoc 2018-08-05 08:18:21 +09:00
Takeshi KOMIYA
f591cba27f Fix #5002: graphviz: SVGs do not adapt to the column width 2018-08-05 08:16:46 +09:00
Takeshi KOMIYA
dc4f8d4836 conf.py: Drop epub_author, epub_publisher and epub_copyright
The default values of them are same as conf.py's. So it is not
needed to override the setting.
2018-08-05 08:16:00 +09:00
Takeshi KOMIYA
206395121d
Merge pull request #5250 from tk0miya/refactor_math4
Add :rst:role:`math:numref` role to refer equations (Same as :rst:role:`eq`)
2018-08-04 21:03:49 +09:00
Takeshi KOMIYA
ec7ee91dd3
Merge pull request #5230 from tk0miya/726_mathjax_config
#726, #969: Add mathjax_config
2018-08-04 19:21:01 +09:00
Takeshi KOMIYA
8e56f86383 Add :rst:role:math:numref role to refer equations (Same as :rst:role:eq) 2018-08-02 01:52:40 +09:00
Takeshi KOMIYA
5fd62810b9
Merge pull request #5229 from tk0miya/refactor_latex2
Check latex_elements at config-inited event
2018-07-30 23:16:02 +09:00
Takeshi KOMIYA
90246b82b5 Check latex_elements at config-inited event 2018-07-29 22:43:13 +09:00
Takeshi KOMIYA
da7a06b323 WIP: #726, #969: Add mathjax_config 2018-07-29 22:36:53 +09:00
Timotheus Kampik
33d09e1c33
Merge pull request #5207 from TimKam/5186-js-test-infrastructure
5186 set up JavaScript test infrastructure
2018-07-29 08:52:37 +02:00
Takeshi KOMIYA
104bd42f51
Merge branch 'master' into refactor_highlighter 2018-07-29 11:21:36 +09:00
Timotheus Kampik
afe46ef74c #5186 add tests for getQueryParameters()
and fix test description of `urldecode()`
2018-07-28 21:12:05 +02:00
Takeshi KOMIYA
7ee868fb18 Add testcases for autodoc_default_flags 2018-07-28 22:37:32 +09:00
Takeshi KOMIYA
f969edfaa8 Fix flake8 violations on tests 2018-07-28 20:19:30 +09:00
Takeshi KOMIYA
4165c8dd62
Merge pull request #4988 from tk0miya/refactor_math
Implement math_renderer framework
2018-07-28 19:27:55 +09:00
Takeshi KOMIYA
c657f1c1c2 test: Validate whole of generated docs by autodoc 2018-07-28 18:46:13 +09:00
Takeshi KOMIYA
7dad01d18f test: Add do_autodoc() helper 2018-07-28 18:30:27 +09:00
Takeshi KOMIYA
dd65d00f29 Implement math_renderer framework 2018-07-28 18:20:11 +09:00
Takeshi KOMIYA
9bb1e83668
Merge branch 'master' into refactor_highlighter 2018-07-24 01:11:57 +09:00
Takeshi KOMIYA
250e6dbc6c
Merge pull request #5203 from tk0miya/2820_autoclass_supports_nested_class
Close #2820: autoclass directive supports nested class
2018-07-23 23:18:31 +09:00
Timotheus Kampik
5fdf81fe2d #5186 configure karma
and add first karma test
2018-07-22 12:27:39 +02:00
Antony Lee
732ebb5d1e Capitalization: "Table Of Contents" -> "Table of Contents".
This is consistent with "Complete Table of Contents" (which is already
in the database), as well as e.g. "Indices and Tables" where "and" is
not capitalized.

This is also fairly standard title-case practice.
2018-07-22 12:12:48 +02:00
Takeshi KOMIYA
8c29801f27 Close #2820: autoclass directive supports nested class 2018-07-22 01:06:17 +09:00
Takeshi KOMIYA
f3019ee197 Apply :confval:trim_doctest_flags to all builders (cf. text, manpages) 2018-07-21 13:54:51 +09:00
Takeshi KOMIYA
2bafb53179 Add testcase for trim_doctest_flags 2018-07-21 11:46:08 +09:00
Timotheus Kampik
f605012617 #4886 remove obsolete * 2018-07-17 20:40:49 +02:00
Timotheus Kampik
c126067f4e #4886 add tests
to better cover the current link check ignore configuration
 behavior
2018-07-16 23:17:44 +02:00
Takeshi KOMIYA
3e57ea0a52 Merge branch '1.7' 2018-07-17 00:37:40 +09:00
Takeshi KOMIYA
922e218214 Fix #5158: autosummary: module summary has been broken when it starts with heading 2018-07-16 18:45:28 +09:00
Takeshi KOMIYA
d3cc565749
Merge branch 'master' into 4976_location_for_logger.info 2018-07-16 17:18:24 +09:00
Jean-François B
82a7a2235f
Merge branch 'master' into latex_xindy 2018-07-16 09:26:23 +02:00
Takeshi KOMIYA
6753b24877
Merge branch '1.7' into 3329_i18n_autosymbol_footnotes 2018-07-16 16:25:55 +09:00
Takeshi KOMIYA
9734bf5a77
Merge pull request #5167 from mitya57/long-tuples
Fix formatting type annotations for tuples with more than two arguments
2018-07-16 15:17:17 +09:00
jfbu
3c3dca8203 Fix failed test (changed \sphinxleftcurlybrace) 2018-07-16 01:06:27 +02:00
Takeshi KOMIYA
52bb8e7428
Merge branch '1.7' into 3329_i18n_autosymbol_footnotes 2018-07-15 23:43:09 +09:00
Takeshi KOMIYA
aad56c0361 Fix #3329: i18n: crashed by auto-symbol footnote references 2018-07-15 20:48:39 +09:00
Takeshi KOMIYA
b1acc54cf9 Fix #5139: autodoc: Enum argument missing if it shares value with another 2018-07-15 18:53:53 +09:00
Takeshi KOMIYA
bfe7bb819d Merge branch '1.7' 2018-07-15 14:55:15 +09:00
Dmitry Shachnev
1e11634d51 Add a failing test for formatting Tuple[int, str, int] 2018-07-13 21:21:49 +03:00
Takeshi KOMIYA
a2f6de88c1 Fix #5146: autosummary: warning is emitted when the first line of docstring ends with literal notation 2018-07-08 21:14:01 +09:00
Takeshi KOMIYA
910be1e2a2 Close #4976: `SphinxLoggerAdapter.info() now supports location` parameter 2018-06-26 01:02:37 +09:00
Takeshi KOMIYA
f518d26e45 Merge branch 'master' into 1431_latex_enumlist 2018-06-22 00:27:49 +09:00
Takeshi KOMIYA
3d180f9385 Merge branch '1.7' 2018-06-21 23:23:30 +09:00
jfbu
dbb04d0a33 Obide by Docutils `node['prefix'] and node['suffix']` 2018-06-20 18:11:11 +02:00
Takeshi KOMIYA
2f91a2c22e
Merge branch 'master' into 5035_qthelp_namespace_allows_dashes 2018-06-20 00:45:34 +09:00
Takeshi KOMIYA
d7bf78f3ff Fix #5070: epub: Wrong internal href fragment links 2018-06-19 23:37:37 +09:00