diff options
| author | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-05-25 09:34:16 +0000 |
|---|---|---|
| committer | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-05-25 09:34:16 +0000 |
| commit | 00f677514eaa6c35be27c77f423f34dfcd4a3258 (patch) | |
| tree | c6b5334b826ad64aab40a4da50c70afe71c1b47f | |
| parent | 25f2f5bff9be21f74ae0d0a77014b971becc2b2f (diff) | |
| download | docutils-00f677514eaa6c35be27c77f423f34dfcd4a3258.tar.gz | |
Add table stubs support (boldfont).
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils/docutils@5141 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
| -rw-r--r-- | writers/latex2e/__init__.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/writers/latex2e/__init__.py b/writers/latex2e/__init__.py index cbded8370..d58c9c5eb 100644 --- a/writers/latex2e/__init__.py +++ b/writers/latex2e/__init__.py @@ -384,6 +384,7 @@ class Table: self._attrs = {} self._col_width = [] self._rowspan = [] + self.stubs = [] def open(self): self._open = 1 @@ -396,6 +397,7 @@ class Table: self._col_specs = None self.caption = None self._attrs = {} + self.stubs = [] def is_open(self): return self._open def set_table_style(self, table_style): @@ -431,8 +433,10 @@ class Table: lines = '\\hline\n' return '%s\\end{%s}' % (line,self._latex_type) - def visit_colspec(self,node): + def visit_colspec(self, node): self._col_specs.append(node) + # "stubs" list is an attribute of the tgroup element: + self.stubs.append(node.attributes.get('stub')) def get_colspecs(self): """ @@ -535,6 +539,10 @@ class Table: return self._cell_in_row def visit_entry(self): self._cell_in_row += 1 + def is_stub_column(self): + if len(self.stubs) >= self._cell_in_row: + return self.stubs[self._cell_in_row-1] + return False class LaTeXTranslator(nodes.NodeVisitor): @@ -1318,6 +1326,9 @@ class LaTeXTranslator(nodes.NodeVisitor): if isinstance(node.parent.parent, nodes.thead): self.body.append('\\textbf{') self.context.append('}') + elif self.active_table.is_stub_column(): + self.body.append('\\textbf{') + self.context.append('}') else: self.context.append('') |
