Commit Graph
2415 Commits
Author SHA1 Message Date
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
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