Merge branch '1.8'

This commit is contained in:
Takeshi KOMIYA 2018-09-22 17:16:24 +09:00
commit 98648325aa
13 changed files with 102 additions and 34 deletions

12
CHANGES
View File

@ -45,6 +45,10 @@ Dependencies
Incompatible changes
--------------------
* LaTeX ``\pagestyle`` commands have been moved to the LaTeX template. No
changes in PDF, except possibly if ``\sphinxtableofcontents``, which
contained them, had been customized in :file:`conf.py`. (refs: #5455)
Deprecated
----------
@ -63,6 +67,12 @@ Bugs fixed
* #5437: autodoc: crashed on modules importing eggs
* #5433: latex: ImportError: cannot import name 'DEFAULT_SETTINGS'
* #5431: autodoc: ``autofunction`` emits a warning for callable objects
* #5457: Fix TypeError in error message when override is prohibited
* #5453: PDF builds of 'howto' documents have no page numbers
* #5463: mathbase: math_role and MathDirective was disappeared in 1.8.0
* #5454: latex: Index has disappeared from PDF for Japanese documents
* #5432: py domain: ``:type:`` field can't process ``:term:`` references
* #5426: py domain: TypeError has been raised for class attribute
Testing
--------
@ -221,6 +231,8 @@ Deprecated
* ``sphinx.ext.mathbase.eqref`` node is deprecated
* ``sphinx.ext.mathbase.is_in_section_title()`` is deprecated
* ``sphinx.ext.mathbase.MathDomain`` is deprecated
* ``sphinx.ext.mathbase.MathDirective`` is deprecated
* ``sphinx.ext.mathbase.math_role`` is deprecated
* ``sphinx.ext.mathbase.setup_math()`` is deprecated
* ``sphinx.directives.other.VersionChanges`` is deprecated
* ``sphinx.highlighting.PygmentsBridge.unhighlight()`` is deprecated

View File

@ -183,6 +183,16 @@ The following is a list of deprecated interface.
- 3.0
- ``sphinx.domains.math.MathDomain``
* - ``sphinx.ext.mathbase.MathDirective``
- 1.8
- 3.0
- ``sphinx.directives.patches.MathDirective``
* - ``sphinx.ext.mathbase.math_role()``
- 1.8
- 3.0
- ``docutils.parsers.rst.roles.math_role()``
* - ``sphinx.ext.mathbase.setup_math()``
- 1.8
- 3.0

View File

@ -12,10 +12,12 @@
import warnings
from docutils import nodes
from docutils.parsers.rst.roles import math_role as math_role_base
from sphinx.addnodes import math, math_block as displaymath # NOQA # to keep compatibility
from sphinx.builders.latex.nodes import math_reference as eqref # NOQA # to keep compatibility
from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.directives.patches import MathDirective as MathDirectiveBase
from sphinx.domains.math import MathDomain # NOQA # to keep compatibility
from sphinx.domains.math import MathReferenceRole as EqXRefRole # NOQA # to keep compatibility
@ -26,6 +28,21 @@ if False:
from sphinx.application import Sphinx # NOQA
class MathDirective(MathDirectiveBase):
def run(self):
warnings.warn('sphinx.ext.mathbase.MathDirective is moved to '
'sphinx.directives.patches package.',
RemovedInSphinx30Warning)
return super(MathDirective, self).run()
def math_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
warnings.warn('sphinx.ext.mathbase.math_role() is deprecated. '
'Please use docutils.parsers.rst.roles.math_role() instead.',
RemovedInSphinx30Warning)
return math_role_base(role, rawtext, text, lineno, inliner, options, content)
def get_node_equation_number(writer, node):
# type: (Writer, nodes.Node) -> unicode
warnings.warn('sphinx.ext.mathbase.get_node_equation_number() is moved to '

View File

@ -51,8 +51,11 @@
<%= makeindex %>
\begin{document}
<%= shorthandoff %>
\pagestyle{empty}
<%= maketitle %>
\pagestyle{plain}
<%= tableofcontents %>
\pagestyle{normal}
<%= body %>
<%= atendofbody %>
<%= indices %>

View File

@ -29,8 +29,8 @@ help:
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latex to make LaTeX files (you can set PAPER=a4 or PAPER=letter)"
@echo " latexpdf to make LaTeX files and then PDFs out of them"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " lualatexpdf to make LaTeX files and run them through lualatex"
@echo " xelatexpdf to make LaTeX files and run them through xelatex"

View File

@ -30,8 +30,8 @@ if "%1" == "help" (
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. latexpdf to make LaTeX files and run them through platex/dvipdfmx
echo. latex to make LaTeX files (you can set PAPER=a4 or PAPER=letter)
echo. latexpdf to make LaTeX files and then PDFs out of them
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files

View File

@ -5,11 +5,9 @@ sub mendex {
my ($source, $basename, $destination) = @_;
my $dictfile = $basename . ".dic";
unlink($destination);
if (-f $dictfile) {
system("mendex", "-U", "-f", "-d", $dictfile, "-s", "python.ist", $source);
if ($? > 0) {
print("mendex exited with error code $? (ignored)\n");
}
system("mendex", "-U", "-f", "-d", $dictfile, "-s", "python.ist", $source);
if ($? > 0) {
print("mendex exited with error code $? (ignored)\n");
}
if (!-e $destination) {
# create an empty .ind file if nothing

View File

@ -6,7 +6,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sphinx}[2018/07/18 v1.8 LaTeX package (Sphinx markup)]
\ProvidesPackage{sphinx}[2018/09/18 v1.8.1 LaTeX package (Sphinx markup)]
% provides \ltx@ifundefined
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
@ -499,15 +499,31 @@
\sloppy
\hbadness = 5000 % don't print trivial gripes
\pagestyle{empty} % start this way
% Use \pagestyle{normal} as the primary pagestyle for text.
% Redefine the 'normal' header/footer style when using "fancyhdr" package:
% Note: this presupposes "twoside". If "oneside" class option, there will be warnings.
\ltx@ifundefined{fancyhf}{}{
% Use \pagestyle{normal} as the primary pagestyle for text.
\fancypagestyle{normal}{
\@ifpackageloaded{fancyhdr}{%
\ltx@ifundefined{c@chapter}
{% no \chapter, "howto" (non-Japanese) docclass
\fancypagestyle{plain}{
\fancyhf{}
% (for \py@HeaderFamily cf "TITLES")
\fancyfoot[C]{{\py@HeaderFamily\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
% Same as 'plain', this way we can use it in template
% FIXME: shouldn't this have a running header with Name and Release like 'manual'?
\fancypagestyle{normal}{
\fancyhf{}
\fancyfoot[C]{{\py@HeaderFamily\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
}%
{% classes with \chapter command
\fancypagestyle{normal}{
\fancyhf{}
% FIXME: this presupposes "twoside".
% If "oneside" class option, there are warnings in LaTeX log.
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
@ -517,17 +533,24 @@
% define chaptermark with \@chappos when \@chappos is available for Japanese
\ltx@ifundefined{@chappos}{}
{\def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}}}
}
}
% Update the plain style so we get the page number & footer line,
% but not a chapter or section title. This is to keep the first
% page of a chapter and the blank page between chapters `clean.'
\fancypagestyle{plain}{
% page of a chapter `clean.'
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
}
}
{% no fancyhdr: memoir class
% Provide default for 'normal' style simply as an alias of 'plain' style
% This way we can use \pagestyle{normal} in LaTeX template
\def\ps@normal{\ps@plain}
% Users of memoir class are invited to redefine 'normal' style in preamble
}
}
% geometry
\ifx\kanjiskip\@undefined

View File

@ -3,7 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{sphinxhowto}[2017/03/26 v1.6 Document class (Sphinx HOWTO)]
\ProvidesClass{sphinxhowto}[2018/09/18 v1.8.1 Document class (Sphinx HOWTO)]
% 'oneside' option overriding the 'twoside' default
\newif\if@oneside
@ -66,12 +66,7 @@
\vspace{12pt}
}
\@ifundefined{fancyhf}{
\pagestyle{plain}}{
\pagestyle{normal}} % start this way; change for
\pagenumbering{arabic} % ToC & chapters
\thispagestyle{empty}
\pagenumbering{arabic}
% Fix the bibliography environment to add an entry to the Table of
% Contents.

View File

@ -3,7 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{sphinxmanual}[2017/03/26 v1.6 Document class (Sphinx manual)]
\ProvidesClass{sphinxmanual}[2018/09/18 v1.8.1 Document class (Sphinx manual)]
% chapters starting at odd pages (overridden by 'openany' document option)
\PassOptionsToClass{openright}{\sphinxdocclass}
@ -75,7 +75,6 @@
\newcommand{\sphinxtableofcontents}{%
\pagenumbering{roman}%
\pagestyle{plain}%
\begingroup
\parskip \z@skip
\tableofcontents
@ -83,7 +82,6 @@
% before resetting page counter, let's do the right thing.
\if@openright\cleardoublepage\else\clearpage\fi
\pagenumbering{arabic}%
\ifdefined\fancyhf\pagestyle{normal}\fi
}
% This is needed to get the width of the section # area wide enough in the

View File

@ -305,7 +305,8 @@ class DocFieldTransformer(object):
entries.append(field)
# but if this has a type then we can at least link it
if typedesc and is_typefield and content:
if (typedesc and is_typefield and content and
len(content) == 1 and isinstance(content[0], nodes.Text)):
target = content[0].astext()
xrefs = typedesc.make_xrefs(
typedesc.typerolename,
@ -318,7 +319,8 @@ class DocFieldTransformer(object):
fieldbody.children[0].extend(xrefs)
else:
fieldbody.clear()
fieldbody.extend(xrefs)
fieldbody += nodes.paragraph()
fieldbody[0].extend(xrefs)
continue

View File

@ -38,3 +38,10 @@ module
:type y: tuple(str, float)
:rtype: list
.. py:attribute:: attr1
:type: ModTopLevel
.. py:attribute:: attr2
:type: :doc:`index`

View File

@ -113,7 +113,10 @@ def test_domain_py_xrefs(app, status, warning):
assert_refnode(refnodes[9], False, False, 'str', 'class')
assert_refnode(refnodes[10], False, False, 'float', 'class')
assert_refnode(refnodes[11], False, False, 'list', 'class')
assert len(refnodes) == 12
assert_refnode(refnodes[11], False, False, 'list', 'class')
assert_refnode(refnodes[12], False, False, 'ModTopLevel', 'class')
assert_refnode(refnodes[13], False, False, 'index', 'doc', domain='std')
assert len(refnodes) == 14
doctree = app.env.get_doctree('module_option')
refnodes = list(doctree.traverse(addnodes.pending_xref))