|
From: <mi...@us...> - 2020-12-01 09:38:05
|
Revision: 8582
http://sourceforge.net/p/docutils/code/8582
Author: milde
Date: 2020-12-01 09:38:02 +0000 (Tue, 01 Dec 2020)
Log Message:
-----------
Do not write Docutils-generated ToC, when ``use_latex_toc`` is True.
This did happen when publishing from a doctree.
Thanks to Thomas Krug for the report.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
Added Paths:
-----------
trunk/docutils/test/test_writers/test_latex2e_misc.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2020-11-27 09:22:49 UTC (rev 8581)
+++ trunk/docutils/HISTORY.txt 2020-12-01 09:38:02 UTC (rev 8582)
@@ -89,7 +89,6 @@
.. _legacy_class_functions: docs/user/config.html#legacy-class-functions
-
- Remove backwards compatibility code for the deprecated
`styling command`__ prefix ``\docutilsrole``.
@@ -96,7 +95,7 @@
__ docs/user/latex.html#custom-interpreted-text-roles
- Support the `memoir` LaTeX document class.
- Fixes #390, #391, and #392.
+ Fixes bugs #390, #391, and #392.
- The special value "auto" for the `graphicx_option`_ setting
is no longer supported (it never worked for xetex/luatex).
@@ -115,10 +114,13 @@
- Fix bug #408 "Incorrect assert in latex writer
for multiple citation references".
-
+
- Apply patch #175 "Fix alignment of nested tables",
additional fixes to table alignment.
-
+
+ - Do not write Docutils-generated ToC, when ``use_latex_toc``
+ is True. (This did happen when publishing from a doctree.)
+
* docutils/writers/manpage.py
- Fix #394 fix missing new line after rubric.
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2020-11-27 09:22:49 UTC (rev 8581)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2020-12-01 09:38:02 UTC (rev 8582)
@@ -3132,6 +3132,8 @@
title)
self.out.append('\n\\tableofcontents\n')
self.has_latex_toc = True
+ # ignore rest of node content
+ raise nodes.SkipNode
else: # Docutils generated contents list
# set flag for visit_bullet_list() and visit_title()
self.is_toc_list = True
Added: trunk/docutils/test/test_writers/test_latex2e_misc.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e_misc.py (rev 0)
+++ trunk/docutils/test/test_writers/test_latex2e_misc.py 2020-12-01 09:38:02 UTC (rev 8582)
@@ -0,0 +1,59 @@
+#! /usr/bin/env python
+# coding: utf-8
+
+# $Id$
+# Author: Günter Milde
+# Maintainer: doc...@li...
+# :Copyright: 2020 Günter Milde,
+# :License: Released under the terms of the `2-Clause BSD license`_, in short:
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+# This file is offered as-is, without any warranty.
+#
+# .. _2-Clause BSD license: https://opensource.org/licenses/BSD-2-Clause
+
+"""
+Miscellaneous LaTeX writer tests.
+"""
+from __future__ import absolute_import
+
+import os
+
+if __name__ == '__main__':
+ import __init__
+from test_writers import DocutilsTestSupport
+from docutils import core
+
+contents_test_input = """\
+.. contents:: TOC
+
+foo
+---
+
+bar
+---
+
+"""
+
+class TocTestCase(DocutilsTestSupport.StandardTestCase):
+
+ def test_publish_from_doctree(self):
+ """Ignore the Docutils-generated ToC, when ``use_latex_toc``
+ is True. (This did happen when publishing from a doctree.)
+ """
+ settings_overrides={'output_encoding': 'unicode',
+ '_disable_config': True,}
+ doctree = core.publish_doctree(contents_test_input,
+ settings_overrides=settings_overrides)
+ result = core.publish_from_doctree(doctree,
+ writer_name='latex',
+ settings_overrides=settings_overrides)
+ self.assertNotIn(r'\item \hyperref[foo]{foo}', result)
+ # self.assertIn(r'\tableofcontents', result)
+
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main()
Property changes on: trunk/docutils/test/test_writers/test_latex2e_misc.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|