From 71b9f00d31cd23ea692b6242e8702a7d35843ab1 Mon Sep 17 00:00:00 2001 From: jfbu Date: Fri, 2 Sep 2016 09:48:33 +0200 Subject: [PATCH 1/3] Fix #2873: code-block overflow in latex (due to commas) The potential linebreaks at commas in code lines were not inserted due to latex kernel macro ``\@noligs`` which is issued by fancyvrb.sty during its line processing. From the default `` `<>,'- ``, only the backtick is left to be handled by ``\@noligs`` because the others are either already replaced by a macro by Pygments, or (only the comma) made active by sphinx.sty to insert potential linebreaks. --- sphinx/texinputs/sphinx.sty | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index a64583650..d025a0797 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -290,6 +290,7 @@ \def\PYGZti{\discretionary{\char`\~}{\sphinxafterbreak}{\char`\~}}% } +\def\sphinx@verbatim@nolig@list {\do \`}% % Some characters . , ; ? ! / are not pygmentized. % This macro makes them "active" and they will insert potential linebreaks \newcommand*\sphinxbreaksatpunct {% @@ -387,6 +388,8 @@ % For grid placement from \strut's in \FancyVerbFormatLine \lineskip\z@skip % Breaks at punctuation characters . , ; ? ! and / need catcode=\active + % and the active comma should not be overwritten by \@noligs + \let\verbatim@nolig@list \sphinx@verbatim@nolig@list \OriginalVerbatim[#1,codes*=\sphinxbreaksatpunct]% } \renewcommand{\endVerbatim}{% From 581216e50edf225ebaa42231cc40b607dcc9215d Mon Sep 17 00:00:00 2001 From: jfbu Date: Fri, 2 Sep 2016 10:09:56 +0200 Subject: [PATCH 2/3] Update CHANGES --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index dcd0e5741..a54e7a91c 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ Bugs fixed * #2917: inline code is hyphenated on HTML * #1462: autosummary warns for namedtuple with attribute with trailing underscore * Could not reference equations if ``:nowrap:`` option specified +* #2873: code-block overflow in latex (due to commas) Release 1.4.6 (released Aug 20, 2016) ===================================== From 3eb56b1c6f164ec4557913c17cb720d2e17c33a6 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 7 Sep 2016 15:45:38 +0900 Subject: [PATCH 3/3] doc: Use AutodocReporter at example of nested_parse_with_titles() In detail, please refer following thread: https://groups.google.com/forum/#!topic/sphinx-dev/l4fHrIJfwq4 --- doc/extdev/markupapi.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/extdev/markupapi.rst b/doc/extdev/markupapi.rst index 99a1ae9fb..533660c84 100644 --- a/doc/extdev/markupapi.rst +++ b/doc/extdev/markupapi.rst @@ -125,6 +125,8 @@ Both APIs parse the content into a given node. They are used like this:: node = docutils.nodes.paragraph() # either + from sphinx.ext.autodoc import AutodocReporter + self.state.memo.reporter = AutodocReporter(self.result, self.state.memo.reporter) # override reporter to avoid errors from "include" directive nested_parse_with_titles(self.state, self.result, node) # or self.state.nested_parse(self.result, 0, node)