Commits

Georg Brandl committed ec108ff Merge

merge with 1.0

  • Participants
  • Parent commits 1eac564, 7a34e47

Comments (0)

Files changed (7)

 
 * Added Python 3.x support.
 
+* Added a Texinfo builder.
+
 * Added i18n support for content, a ``gettext`` builder and
   related utilities.
 
 * Added the ``websupport`` library.
 
-* Added a Texinfo builder.
-
 * #460: Allow limiting the depth of section numbers for HTML.
 
 * #138: Add an ``index`` role, to make inline index entries.
 * #526: Added Iranian translation.
 
 
+Release 1.0.5 (in development)
+==============================
+
+* #535: Fix LaTeX output generated for line blocks.
+
+* #544: Allow ``.pyw`` as a source file extension.
+
+
 Release 1.0.4 (Sep 17, 2010)
 ============================
 
-* #544: Allow ``.pyw`` as a source file extension.
-
 * #524: Open intersphinx inventories in binary mode on Windows,
   since version 2 contains zlib-compressed data.
 

sphinx/builders/qthelp.py

 
 
 _idpattern = re.compile(
-    r'(?P<title>.+) (\((?P<id>[\w\.]+)( (?P<descr>\w+))?\))$')
+    r'(?P<title>.+) (\((class in )?(?P<id>[\w\.]+)( (?P<descr>\w+))?\))$')
 
 
 # Qt Help Collection Project (.qhcp).
 
         # keywords
         keywords = []
-        index = self.env.create_index(self)
+        index = self.env.create_index(self, group_entries=False)
         for (key, group) in index:
             for title, (refs, subitems) in group:
                 keywords.extend(self.build_keywords(title, refs, subitems))

sphinx/environment.py

 
         return rewrite_needed
 
-    def create_index(self, builder, _fixre=re.compile(r'(.*) ([(][^()]*[)])')):
+    def create_index(self, builder, group_entries=True,
+                     _fixre=re.compile(r'(.*) ([(][^()]*[)])')):
         """Create the real index from the collected index entries."""
         new = {}
 
         newlist = new.items()
         newlist.sort(key=keyfunc)
 
-        # fixup entries: transform
-        #   func() (in module foo)
-        #   func() (in module bar)
-        # into
-        #   func()
-        #     (in module foo)
-        #     (in module bar)
-        oldkey = ''
-        oldsubitems = None
-        i = 0
-        while i < len(newlist):
-            key, (targets, subitems) = newlist[i]
-            # cannot move if it has subitems; structure gets too complex
-            if not subitems:
-                m = _fixre.match(key)
-                if m:
-                    if oldkey == m.group(1):
-                        # prefixes match: add entry as subitem of the
-                        # previous entry
-                        oldsubitems.setdefault(m.group(2), [[], {}])[0].\
-                                    extend(targets)
-                        del newlist[i]
-                        continue
-                    oldkey = m.group(1)
-                else:
-                    oldkey = key
-            oldsubitems = subitems
-            i += 1
+        if group_entries:
+            # fixup entries: transform
+            #   func() (in module foo)
+            #   func() (in module bar)
+            # into
+            #   func()
+            #     (in module foo)
+            #     (in module bar)
+            oldkey = ''
+            oldsubitems = None
+            i = 0
+            while i < len(newlist):
+                key, (targets, subitems) = newlist[i]
+                # cannot move if it has subitems; structure gets too complex
+                if not subitems:
+                    m = _fixre.match(key)
+                    if m:
+                        if oldkey == m.group(1):
+                            # prefixes match: add entry as subitem of the
+                            # previous entry
+                            oldsubitems.setdefault(m.group(2), [[], {}])[0].\
+                                        extend(targets)
+                            del newlist[i]
+                            continue
+                        oldkey = m.group(1)
+                    else:
+                        oldkey = key
+                oldsubitems = subitems
+                i += 1
 
         # group the entries by letter
         def keyfunc2(item, letters=string.ascii_uppercase + '_'):

sphinx/quickstart.py

 
 if "%%1" == "html" (
 \t%%SPHINXBUILD%% -b html %%ALLSPHINXOPTS%% %%BUILDDIR%%/html
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished. The HTML pages are in %%BUILDDIR%%/html.
 \tgoto end
 
 if "%%1" == "dirhtml" (
 \t%%SPHINXBUILD%% -b dirhtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/dirhtml
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished. The HTML pages are in %%BUILDDIR%%/dirhtml.
 \tgoto end
 
 if "%%1" == "singlehtml" (
 \t%%SPHINXBUILD%% -b singlehtml %%ALLSPHINXOPTS%% %%BUILDDIR%%/singlehtml
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished. The HTML pages are in %%BUILDDIR%%/singlehtml.
 \tgoto end
 
 if "%%1" == "pickle" (
 \t%%SPHINXBUILD%% -b pickle %%ALLSPHINXOPTS%% %%BUILDDIR%%/pickle
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished; now you can process the pickle files.
 \tgoto end
 
 if "%%1" == "json" (
 \t%%SPHINXBUILD%% -b json %%ALLSPHINXOPTS%% %%BUILDDIR%%/json
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished; now you can process the JSON files.
 \tgoto end
 
 if "%%1" == "htmlhelp" (
 \t%%SPHINXBUILD%% -b htmlhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/htmlhelp
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished; now you can run HTML Help Workshop with the ^
 .hhp project file in %%BUILDDIR%%/htmlhelp.
 
 if "%%1" == "qthelp" (
 \t%%SPHINXBUILD%% -b qthelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/qthelp
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished; now you can run "qcollectiongenerator" with the ^
 .qhcp project file in %%BUILDDIR%%/qthelp, like this:
 
 if "%%1" == "devhelp" (
 \t%%SPHINXBUILD%% -b devhelp %%ALLSPHINXOPTS%% %%BUILDDIR%%/devhelp
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished.
 \tgoto end
 
 if "%%1" == "epub" (
 \t%%SPHINXBUILD%% -b epub %%ALLSPHINXOPTS%% %%BUILDDIR%%/epub
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished. The epub file is in %%BUILDDIR%%/epub.
 \tgoto end
 
 if "%%1" == "latex" (
 \t%%SPHINXBUILD%% -b latex %%ALLSPHINXOPTS%% %%BUILDDIR%%/latex
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished; the LaTeX files are in %%BUILDDIR%%/latex.
 \tgoto end
 
 if "%%1" == "text" (
 \t%%SPHINXBUILD%% -b text %%ALLSPHINXOPTS%% %%BUILDDIR%%/text
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished. The text files are in %%BUILDDIR%%/text.
 \tgoto end
 
 if "%%1" == "man" (
 \t%%SPHINXBUILD%% -b man %%ALLSPHINXOPTS%% %%BUILDDIR%%/man
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Build finished. The manual pages are in %%BUILDDIR%%/man.
 \tgoto end
 
 if "%%1" == "changes" (
 \t%%SPHINXBUILD%% -b changes %%ALLSPHINXOPTS%% %%BUILDDIR%%/changes
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.The overview file is in %%BUILDDIR%%/changes.
 \tgoto end
 
 if "%%1" == "linkcheck" (
 \t%%SPHINXBUILD%% -b linkcheck %%ALLSPHINXOPTS%% %%BUILDDIR%%/linkcheck
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Link check complete; look for any errors in the above output ^
 or in %%BUILDDIR%%/linkcheck/output.txt.
 
 if "%%1" == "doctest" (
 \t%%SPHINXBUILD%% -b doctest %%ALLSPHINXOPTS%% %%BUILDDIR%%/doctest
+\tif errorlevel 1 exit /b 1
 \techo.
 \techo.Testing of doctests in the sources finished, look at the ^
 results in %%BUILDDIR%%/doctest/output.txt.

sphinx/texinputs/sphinx.sty

 \RequirePackage{amsmath} % for \text
 \RequirePackage{makeidx}
 \RequirePackage{framed}
+\RequirePackage{ifthen}
 \RequirePackage{color}
 % For highlighted code.
 \RequirePackage{fancyvrb}
             {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
 \titleformat{\subsubsection}{\py@HeaderFamily}%
             {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
-\titleformat{\paragraph}{\large\py@HeaderFamily}%
+\titleformat{\paragraph}{\small\py@HeaderFamily}%
             {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}
 
 % {fulllineitems} is the main environment for object descriptions.
     {#2}% node content
   }% close "span"
 }
+
+\providecommand*{\DUprovidelength}[2]{
+  \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
+}
+
+\DUprovidelength{\DUlineblockindent}{2.5em}
+\ifthenelse{\isundefined{\DUlineblock}}{
+  \newenvironment{DUlineblock}[1]{%
+    \list{}{\setlength{\partopsep}{\parskip}
+            \addtolength{\partopsep}{\baselineskip}
+            \setlength{\topsep}{0pt}
+            \setlength{\itemsep}{0.15\baselineskip}
+            \setlength{\parsep}{0pt}
+            \setlength{\leftmargin}{#1}}
+    \raggedright
+  }
+  {\endlist}
+}{}

sphinx/writers/latex.py

     visit_doctest_block = visit_literal_block
     depart_doctest_block = depart_literal_block
 
+    def visit_line(self, node):
+        self.body.append('\item[] ')
+    def depart_line(self, node):
+        self.body.append('\n')
+
     def visit_line_block(self, node):
-        """line-block:
-        * whitespace (including linebreaks) is significant
-        * inline markup is supported.
-        * serif typeface
-        """
-        self.body.append('\n{\\raggedright{}')
-        self.literal_whitespace += 1
+        if isinstance(node.parent, nodes.line_block):
+            self.body.append('\\item[]\n'
+                             '\\begin{DUlineblock}{\\DUlineblockindent}\n')
+        else:
+            self.body.append('\n\\begin{DUlineblock}{0em}\n')
     def depart_line_block(self, node):
-        self.literal_whitespace -= 1
-        # remove the last \\
-        del self.body[-1]
-        self.body.append('}\n')
-
-    def visit_line(self, node):
-        self._line_start = len(self.body)
-    def depart_line(self, node):
-        if self._line_start == len(self.body):
-            # no output in this line -- add a nonbreaking space, else the
-            # \\ command will give an error
-            self.body.append('~')
-        if self.table is not None:
-            self.body.append('\\newline\n')
-        else:
-            self.body.append('\\\\\n')
+        self.body.append('\\end{DUlineblock}\n')
 
     def visit_block_quote(self, node):
         # If the block quote contains a single object and that object

tests/root/markup.txt

 -h              help
 --help          also help
 
+Line block:
+
+| line1
+|   line2
+|     line3
+|       line4
+|   line5
+| line6
+|   line7
+
 
 Body directives
 ^^^^^^^^^^^^^^^