summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-04-14 17:17:55 +0000
committergrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-04-14 17:17:55 +0000
commitae888573456e8471793fb74564d9d5d28df42737 (patch)
tree88a959f174b70e548a3ea803b3b44ad1902ba2a2
parenta74a744e3aafa5e8a97fd3338df17822e1e2e439 (diff)
downloaddocutils-ae888573456e8471793fb74564d9d5d28df42737.tar.gz
Use section commands down to subparagraph.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils/docutils@5047 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--writers/latex2e/__init__.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/writers/latex2e/__init__.py b/writers/latex2e/__init__.py
index 7f7ef3570..2c9650757 100644
--- a/writers/latex2e/__init__.py
+++ b/writers/latex2e/__init__.py
@@ -21,6 +21,8 @@ from types import ListType
from docutils import frontend, nodes, languages, writers, utils
from docutils.writers.newlatex2e import unicode_map
+from docutils.transforms.references import DanglingReferencesVisitor
+
class Writer(writers.Writer):
supported = ('latex','latex2e')
@@ -336,20 +338,6 @@ latex_headings = {
class DocumentClass:
"""Details of a LaTeX document class."""
- # BUG: LaTeX has no deeper sections (actually paragrah is no
- # section either).
- # BUG: No support for unknown document classes. Make 'article'
- # default?
- _class_sections = {
- 'book': ( 'chapter', 'section', 'subsection', 'subsubsection' ),
- 'scrbook': ( 'chapter', 'section', 'subsection', 'subsubsection' ),
- 'report': ( 'chapter', 'section', 'subsection', 'subsubsection' ),
- 'scrreprt': ( 'chapter', 'section', 'subsection', 'subsubsection' ),
- 'article': ( 'section', 'subsection', 'subsubsection' ),
- 'scrartcl': ( 'section', 'subsection', 'subsubsection' ),
- }
- _deepest_section = 'subsubsection'
-
def __init__(self, document_class):
self.document_class = document_class
@@ -359,11 +347,14 @@ class DocumentClass:
Level is 1,2,3..., as level 0 is the title."""
- sections = self._class_sections[self.document_class]
+ sections = [ 'section', 'subsection', 'subsubsection',
+ 'paragraph', 'subparagraph' ]
+ if self.document_class in ('book', 'report', 'scrartcl', 'scrbook'):
+ sections.insert(0, 'chapter')
if level <= len(sections):
return sections[level-1]
else:
- return self._deepest_section
+ return sections[-1]
class Table:
""" Manage a table while traversing.
@@ -592,6 +583,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
if self.settings.use_bibtex:
self.bibtex = self.settings.use_bibtex.split(",",1)
+ # TODO avoid errors on not declared citations.
else:
self.bibtex = None
# language: labels, bibliographic_fields, and author_separators.