summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-06-14 12:21:41 +0000
committergrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-06-14 12:21:41 +0000
commit064403f805a6e52bcb15ac50e907c231d4b5bc2c (patch)
tree0f7b7b321f1634e1be9e00c651f5db2009ef64d8
parentbbae952edb2d6413c5f4beba4879c234eedd5b10 (diff)
downloaddocutils-064403f805a6e52bcb15ac50e907c231d4b5bc2c.tar.gz
Add ``use-part-section``.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils/docutils@5237 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--writers/latex2e/__init__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/writers/latex2e/__init__.py b/writers/latex2e/__init__.py
index d5f67ffd1..ab15c2349 100644
--- a/writers/latex2e/__init__.py
+++ b/writers/latex2e/__init__.py
@@ -76,6 +76,10 @@ class Writer(writers.Writer):
['--use-latex-toc'],
{'default': 0, 'action': 'store_true',
'validator': frontend.validate_boolean}),
+ ('Add parts on top of the section hierarchy.',
+ ['--use-part-section'],
+ {'default': 0, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}),
('Let LaTeX print author and date, do not show it in docutils '
'document info.',
['--use-latex-docinfo'],
@@ -347,8 +351,9 @@ latex_headings = {
class DocumentClass:
"""Details of a LaTeX document class."""
- def __init__(self, document_class):
+ def __init__(self, document_class, with_part=False):
self.document_class = document_class
+ self._with_part = with_part
def section(self, level):
""" Return the section name at the given level for the specific
@@ -360,6 +365,8 @@ class DocumentClass:
'paragraph', 'subparagraph' ]
if self.document_class in ('book', 'report', 'scrartcl', 'scrbook'):
sections.insert(0, 'chapter')
+ if self._with_part:
+ sections.insert(0, 'part')
if level <= len(sections):
return sections[level-1]
else:
@@ -619,7 +626,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.d_options += ',%s' % \
self.babel.get_language()
- self.d_class = DocumentClass(settings.documentclass)
+ self.d_class = DocumentClass(settings.documentclass, settings.use_part_section)
# object for a table while proccessing.
self.table_stack = []
self.active_table = Table('longtable',settings.table_style)