diff options
author | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-04-18 14:02:16 +0000 |
---|---|---|
committer | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-04-18 14:02:16 +0000 |
commit | e5437c565fbc71706dc18fda6be26313351339be (patch) | |
tree | a2e9b6f37127a1a06c73166d737b8cc019bc4631 | |
parent | c3dd8ab2cbd383d6eaae0d9b38f98031521d1fd8 (diff) | |
download | docutils-e5437c565fbc71706dc18fda6be26313351339be.tar.gz |
Add simply support for nested tables.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils/docutils@5049 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | writers/latex2e/__init__.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/writers/latex2e/__init__.py b/writers/latex2e/__init__.py index 0d10a657e..3db4cf418 100644 --- a/writers/latex2e/__init__.py +++ b/writers/latex2e/__init__.py @@ -478,7 +478,8 @@ class Table: # a.append('\\hline\n') if self._table_style == 'booktabs': a.append('\\midrule\n') - a.append('\\endhead\n') + if self._latex_type == 'longtable': + a.append('\\endhead\n') # for longtable one could add firsthead, foot and lastfoot self._in_thead = 0 return a @@ -598,6 +599,7 @@ class LaTeXTranslator(nodes.NodeVisitor): self.d_class = DocumentClass(settings.documentclass) # object for a table while proccessing. + self.table_stack = [] self.active_table = Table('longtable',settings.table_style) # HACK. Should have more sophisticated typearea handling. @@ -1911,8 +1913,9 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_table(self, node): if self.active_table.is_open(): - print 'nested tables are not supported' - raise AssertionError + self.table_stack.append(self.active_table) + # nesting longtable does not work (e.g. 2007-04-18) + self.active_table = Table('tabular',self.settings.table_style) self.active_table.open() for cl in node['classes']: self.active_table.set_table_style(cl) @@ -1921,7 +1924,10 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_table(self, node): self.body.append(self.active_table.get_closing() + '\n') self.active_table.close() - self.active_table.set_table_style(self.settings.table_style) + if len(self.table_stack)>0: + self.active_table = self.table_stack.pop() + else: + self.active_table.set_table_style(self.settings.table_style) def visit_target(self, node): # BUG: why not (refuri or refid or refname) means not footnote ? |