Merge branch 'master' into refactor_literalinclude

This commit is contained in:
Takeshi KOMIYA 2017-02-18 22:44:41 +09:00
commit 8ba6c6556e
5 changed files with 53 additions and 19 deletions

View File

@ -14,6 +14,8 @@ Incompatible changes
flushed left (no text flow around table.) The position now defaults to center in flushed left (no text flow around table.) The position now defaults to center in
both cases, and it will obey Docutils 0.13 ``:align:`` option (refs #3415, #3377) both cases, and it will obey Docutils 0.13 ``:align:`` option (refs #3415, #3377)
* option directive also allows all punctuations for the option name (refs: #3366) * option directive also allows all punctuations for the option name (refs: #3366)
* #3413: if :rst:dir:`literalinclude`'s ``:start-after:`` is used, make ``:lines:``
relative (refs #3412)
* ``literalinclude`` directive does not allow the combination of ``:diff:`` * ``literalinclude`` directive does not allow the combination of ``:diff:``
option and other options (refs: #3416) option and other options (refs: #3416)
@ -116,6 +118,9 @@ Bugs fixed
gets wrong PDF page dimensions gets wrong PDF page dimensions
* #3399: quickstart: conf.py was not overwritten by template * #3399: quickstart: conf.py was not overwritten by template
* #3366: option directive does not allow punctuations * #3366: option directive does not allow punctuations
* #3410: return code in :confval:`release` breaks html search
* #3427: autodoc: memory addresses are not stripped on Windows
* #3428: xetex build tests fail due to fontspec v2.6 defining ``\strong``
Testing Testing
-------- --------

View File

@ -184,12 +184,12 @@ Includes
string option, only lines that precede the first lines containing that string string option, only lines that precede the first lines containing that string
are included. are included.
With lines selected this way it is still possible to use ``lines``, the With lines selected using ``start-after`` it is still possible to use
numbers being now interpreted relative to the already selected lines. ``lines``, the first allowed line having by convention the line number ``1``.
When lines have been selected in any of the ways described above, the When lines have been selected in any of the ways described above, the
line numbers in ``emphasize-lines`` refer to the selection, with the line numbers in ``emphasize-lines`` also refer to the selection, with the
line count starting at ``1``. first selected line having number ``1``.
When specifying particular parts of a file to display, it can be useful to When specifying particular parts of a file to display, it can be useful to
display the original line numbers. This can be done using the display the original line numbers. This can be done using the
@ -220,7 +220,9 @@ Includes
.. versionadded:: 1.3 .. versionadded:: 1.3
The ``diff`` option. The ``diff`` option.
The ``lineno-match`` option. The ``lineno-match`` option.
.. versionchanged:: 1.6
With both ``start-after`` and ``lines`` in use, the first line as per
``start-after`` is considered to be with line number ``1`` for ``lines``.
Caption and name Caption and name
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^

View File

@ -10,6 +10,7 @@
""" """
import os import os
import re
import sys import sys
import zlib import zlib
import codecs import codecs
@ -60,6 +61,7 @@ INVENTORY_FILENAME = 'objects.inv'
LAST_BUILD_FILENAME = 'last_build' LAST_BUILD_FILENAME = 'last_build'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
return_codes_re = re.compile('[\r\n]+')
def get_stable_hash(obj): def get_stable_hash(obj):
@ -348,7 +350,7 @@ class StandaloneHTMLBuilder(Builder):
self.globalcontext = dict( self.globalcontext = dict(
embedded = self.embedded, embedded = self.embedded,
project = self.config.project, project = self.config.project,
release = self.config.release, release = return_codes_re.sub('', self.config.release),
version = self.config.version, version = self.config.version,
last_updated = self.last_updated, last_updated = self.last_updated,
copyright = self.config.copyright, copyright = self.config.copyright,

View File

@ -6,7 +6,22 @@
% %
\NeedsTeXFormat{LaTeX2e}[1995/12/01] \NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sphinx}[2017/02/06 v1.6 LaTeX package (Sphinx markup)] \ProvidesPackage{sphinx}[2017/02/18 v1.6 LaTeX package (Sphinx markup)]
%% for deprecation warnings
\newcommand\sphinxdeprecationwarning[4]{% #1 the deprecated macro or name,
% #2 = version when deprecated, #3 = version when removed, #4 = message
\edef\spx@tempa{\detokenize{#1}}%
\spx@ifundefined{sphinx_depr_\spx@tempa}{%
\global\expandafter\let\csname sphinx_depr_\spx@tempa\endcsname\spx@tempa
\expandafter\AtEndDocument\expandafter{\expandafter\let\expandafter
\sphinxdeprecatedmacro\csname sphinx_depr_\spx@tempa\endcsname
\PackageWarningNoLine{sphinx}{^^J**** SPHINX DEPRECATION WARNING:^^J
\sphinxdeprecatedmacro\space will be (or has been)
deprecated at Sphinx #2^^J and will be removed at Sphinx #3.^^J
#4^^J****}}%
}{% warning already emitted (at end of latex log), don't repeat
}}
% we delay handling of options to after having loaded packages, because % we delay handling of options to after having loaded packages, because
% of the need to use \definecolor. % of the need to use \definecolor.
@ -887,13 +902,11 @@
% use of ``notice'' is for backwards compatibility and will be removed in % use of ``notice'' is for backwards compatibility and will be removed in
% Sphinx 1.7. % Sphinx 1.7.
\newenvironment{notice} \newenvironment{notice}
{\AtEndDocument{\typeout {\sphinxdeprecationwarning {notice}{1.6}{1.7}{%
{**** DEPRECATION WARNING:^^J This document was probably built with a Sphinx extension using ``notice''^^J
This document was probably built with a Sphinx extension using ``notice''^^J environment. At Sphinx 1.7, ``notice'' environment will be removed. Please^^J
environment. At Sphinx 1.7, ``notice'' environment will be removed. Please^^J report to extension author to use ``sphinxadmonition'' instead.^^J%
report to extension author to use ``sphinxadmonition'' instead.^^J% ****}\begin{sphinxadmonition}}{\end{sphinxadmonition}}
****}}%
\begin{sphinxadmonition}}{\end{sphinxadmonition}}
% Allow the release number to be specified independently of the % Allow the release number to be specified independently of the
% \date{}. This allows the date to reflect the document's date and % \date{}. This allows the date to reflect the document's date and
@ -1183,22 +1196,34 @@ report to extension author to use ``sphinxadmonition'' instead.^^J%
\firstchoice@false\else\firstchoice@true\fi \firstchoice@false\else\firstchoice@true\fi
\spx@originalcaption } \spx@originalcaption }
% by default, also define macros with the no-prefix names
\ifspx@opt@dontkeepoldnames\else \ifspx@opt@dontkeepoldnames\else
\let\spx@alreadydefinedlist\@empty
\typeout{** (sphinx) defining (legacy) text style macros without \string\sphinx\space prefix} \typeout{** (sphinx) defining (legacy) text style macros without \string\sphinx\space prefix}
\typeout{** if clashes with packages, set latex_keep_old_macro_names=False \typeout{** if clashes with packages, set latex_keep_old_macro_names=False
in conf.py} in conf.py}
\@for\@tempa:=code,strong,bfcode,email,tablecontinued,titleref,% \@for\@tempa:=code,strong,bfcode,email,tablecontinued,titleref,%
menuselection,accelerator,crossref,termref,optional\do menuselection,accelerator,crossref,termref,optional\do
{% first, check if command with no prefix already exists {% first, check if command with no prefix already exists
\expandafter\newcommand\csname\@tempa\endcsname{}% \spx@ifundefined{\@tempa}{%
% give it the meaning defined so far with \sphinx prefix % give it the meaning defined so far with \sphinx prefix
\expandafter\let\csname\@tempa\expandafter\endcsname \expandafter\let\csname\@tempa\expandafter\endcsname
\csname sphinx\@tempa\endcsname \csname sphinx\@tempa\endcsname
% redefine the \sphinx prefixed macro to expand to non-prefixed one % redefine the \sphinx prefixed macro to expand to non-prefixed one
\expandafter\def\csname sphinx\@tempa\expandafter\endcsname \expandafter\def\csname sphinx\@tempa\expandafter\endcsname
\expandafter{\csname\@tempa\endcsname}% \expandafter{\csname\@tempa\endcsname}%
}% }{\edef\spx@alreadydefinedlist{\spx@alreadydefinedlist{\@tempa}}}%
}%
\ifx\spx@alreadydefinedlist\@empty\else
\expandafter\@tfor\expandafter\@tempa\expandafter:\expandafter=\spx@alreadydefinedlist\do
{% emit warning now
\PackageWarning{sphinx}{not redefining already existing \@backslashchar\@tempa\space!^^J%
Anyhow, Sphinx mark-up uses only \string\sphinx\@tempa.}%
% and also at end of log for better visibility
\expandafter\sphinxdeprecationwarning\expandafter{\csname\@tempa\endcsname}{1.6}{1.7}
{\sphinxdeprecatedmacro\space already existed at Sphinx loading time! Not redefined!^^J
Sphinx mark-up uses only \string\sphinx\expandafter\@gobble\sphinxdeprecatedmacro.}%
}%
\fi
\fi \fi
% additional customizable styling % additional customizable styling

View File

@ -24,7 +24,7 @@ if False:
# relatively import this module # relatively import this module
inspect = __import__('inspect') inspect = __import__('inspect')
memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>)') memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>)', re.IGNORECASE)
if PY3: if PY3: