At once, we added $SPHINX_TEST_TEMPDIR to keep intermediate files of
testing to investigate the failures. At present, we've used pytest
as a test runner. And it keeps temporary directories of last 3
testings. So this starts to use it instead of $SPHINX_TEST_TEMPDIR.
https://docs.pytest.org/en/latest/tmpdir.html#the-default-base-temporary-directory
Since python3.5, subprocess.run() has been introduced. It works a
wrapper of Popen, and it looks much simple and better. This uses it
instead of Popen to make our code simple.
* #5258 add tests for highlightText()
* #5258 fix SVG search highlight issue in Firefox
Use `node.parentElement.getBBox()` instead of `span.getBBox()`:
* Same highlighting behavior in Chrome, Opera
* Avoid issue with getBBox() in FF, see:
https://bugzilla.mozilla.org/show_bug.cgi?id=612118
* Microsoft browsers to be tested
* #5258 update package-lock.json
* #5258 test after control merge & polish
* #5258 allow for some variability in test
commits are squashed.
* Add PathComparer for testing and fix 2 test failure on Windows.
* fix flake8
* add type information by f2f review. Thanks to @tk0miya!
* fix mypy, flake8 again..
- Hyperlinks for declarations involving east cv-qualifiers.
- Duplicate declaration error on function templates with constraints
in the return type.
Fixessphinx-doc/sphinx#5755
Only for figure and table, currently. Code-bloks have some FIXME code to
still be handled.
PDF output should remain unchanged so this is backwards compatible. The
`\nobreakspace` from LaTeX default `\fnum@figure` is removed by a normal
space. If figname is an abbreviation, the dot is followed by a `\@` to
avoid double space. At the location where the `\@` is inserted the `@`
has catcode non-letter so a space after it is not swallowed.
MEMO: when this is will be moved to sphinxmessages.sty on master branch
it is needed to use `\@{}` or to modify locally catcode of `@` to avoid
space swallowing..
Closes: #5889
* 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: `'` -> `'`.
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.
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>
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.
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.
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.
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.
- 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
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
- 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
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
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
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.
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.
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'