diff --git a/CHANGES b/CHANGES index ef27f3c2e..dd810c203 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,8 @@ Incompatible changes 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) * 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:`` option and other options (refs: #3416) @@ -116,6 +118,9 @@ Bugs fixed gets wrong PDF page dimensions * #3399: quickstart: conf.py was not overwritten by template * #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 -------- diff --git a/doc/markup/code.rst b/doc/markup/code.rst index 397836d3d..cb3e55bdc 100644 --- a/doc/markup/code.rst +++ b/doc/markup/code.rst @@ -184,12 +184,12 @@ Includes string option, only lines that precede the first lines containing that string are included. - With lines selected this way it is still possible to use ``lines``, the - numbers being now interpreted relative to the already selected lines. + With lines selected using ``start-after`` it is still possible to use + ``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 - line numbers in ``emphasize-lines`` refer to the selection, with the - line count starting at ``1``. + line numbers in ``emphasize-lines`` also refer to the selection, with the + first selected line having number ``1``. 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 @@ -220,7 +220,9 @@ Includes .. versionadded:: 1.3 The ``diff`` 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 ^^^^^^^^^^^^^^^^ diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 129d142f9..f777ecacc 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -10,6 +10,7 @@ """ import os +import re import sys import zlib import codecs @@ -60,6 +61,7 @@ INVENTORY_FILENAME = 'objects.inv' LAST_BUILD_FILENAME = 'last_build' logger = logging.getLogger(__name__) +return_codes_re = re.compile('[\r\n]+') def get_stable_hash(obj): @@ -348,7 +350,7 @@ class StandaloneHTMLBuilder(Builder): self.globalcontext = dict( embedded = self.embedded, project = self.config.project, - release = self.config.release, + release = return_codes_re.sub('', self.config.release), version = self.config.version, last_updated = self.last_updated, copyright = self.config.copyright, diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 4a27f50b2..8f17cf5aa 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -6,7 +6,22 @@ % \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 % of the need to use \definecolor. @@ -887,13 +902,11 @@ % use of ``notice'' is for backwards compatibility and will be removed in % Sphinx 1.7. \newenvironment{notice} - {\AtEndDocument{\typeout -{**** DEPRECATION WARNING:^^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 -report to extension author to use ``sphinxadmonition'' instead.^^J% -****}}% - \begin{sphinxadmonition}}{\end{sphinxadmonition}} + {\sphinxdeprecationwarning {notice}{1.6}{1.7}{% + This document was probably built with a Sphinx extension using ``notice''^^J + environment. At Sphinx 1.7, ``notice'' environment will be removed. Please^^J + report to extension author to use ``sphinxadmonition'' instead.^^J% + ****}\begin{sphinxadmonition}}{\end{sphinxadmonition}} % Allow the release number to be specified independently of the % \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 \spx@originalcaption } -% by default, also define macros with the no-prefix names \ifspx@opt@dontkeepoldnames\else + \let\spx@alreadydefinedlist\@empty \typeout{** (sphinx) defining (legacy) text style macros without \string\sphinx\space prefix} \typeout{** if clashes with packages, set latex_keep_old_macro_names=False in conf.py} \@for\@tempa:=code,strong,bfcode,email,tablecontinued,titleref,% menuselection,accelerator,crossref,termref,optional\do -{% first, check if command with no prefix already exists - \expandafter\newcommand\csname\@tempa\endcsname{}% + {% first, check if command with no prefix already exists + \spx@ifundefined{\@tempa}{% % give it the meaning defined so far with \sphinx prefix \expandafter\let\csname\@tempa\expandafter\endcsname \csname sphinx\@tempa\endcsname % redefine the \sphinx prefixed macro to expand to non-prefixed one \expandafter\def\csname sphinx\@tempa\expandafter\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 % additional customizable styling diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 3cb795339..58e750a53 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -24,7 +24,7 @@ if False: # relatively import this module 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: