diff options
-rw-r--r-- | HISTORY.txt | 2 | ||||
-rw-r--r-- | docutils/writers/latex2e/__init__.py | 43 | ||||
-rw-r--r-- | test/functional/expected/standalone_rst_latex.tex | 13 |
3 files changed, 11 insertions, 47 deletions
diff --git a/HISTORY.txt b/HISTORY.txt index 5d82c03d3..acc98e0a9 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -93,6 +93,8 @@ Changes Since 0.4 * docutils/writers/latex2e/__init__.py: + - Remove inactive code for use_optionlist_for_option_list. + - Remove latex comments from option_list output. - Fix: bug# 1612270 double qoutes in italian literal. - Fix: output ``hypertarget{ node.get(refid) }{}`` from visit_target. - Add option --use-latex-abstract. diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py index 051402817..c301f9aa0 100644 --- a/docutils/writers/latex2e/__init__.py +++ b/docutils/writers/latex2e/__init__.py @@ -544,8 +544,6 @@ class LaTeXTranslator(nodes.NodeVisitor): use_latex_toc = 0 # TODO: use mixins for different implementations. - # list environment for option-list. else tabularx - use_optionlist_for_option_list = 1 # list environment for docinfo. else tabularx use_optionlist_for_docinfo = 0 # NOT YET IN USE @@ -1114,11 +1112,10 @@ class LaTeXTranslator(nodes.NodeVisitor): pass def visit_definition(self, node): - self.body.append('%[visit_definition]\n') + pass def depart_definition(self, node): self.body.append('\n') - self.body.append('%[depart_definition]\n') def visit_definition_list(self, node): self.body.append( '\\begin{description}\n' ) @@ -1133,10 +1130,7 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append('%[depart_definition_list_item]\n') def visit_description(self, node): - if self.use_optionlist_for_option_list: - self.body.append( ' ' ) - else: - self.body.append( ' & ' ) + self.body.append( ' ' ) def depart_description(self, node): pass @@ -1723,48 +1717,25 @@ class LaTeXTranslator(nodes.NodeVisitor): pass def visit_option_group(self, node): - if self.use_optionlist_for_option_list: - self.body.append('\\item [') - else: - if len(node.astext()) > 14: - self.body.append('\\multicolumn{2}{l}{') - self.context.append('} \\\\\n ') - else: - self.context.append('') - self.body.append('\\texttt{') + self.body.append('\\item [') # flag for first option self.context.append(0) def depart_option_group(self, node): self.context.pop() # the flag - if self.use_optionlist_for_option_list: - self.body.append('] ') - else: - self.body.append('}') - self.body.append(self.context.pop()) + self.body.append('] ') def visit_option_list(self, node): - self.body.append('% [option list]\n') - if self.use_optionlist_for_option_list: - self.body.append('\\begin{optionlist}{3cm}\n') - else: - self.body.append('\\begin{center}\n') - # BUG: use admwidth or make it relative to textwidth ? - self.body.append('\\begin{tabularx}{.9\\linewidth}{lX}\n') + self.body.append('\\begin{optionlist}{3cm}\n') def depart_option_list(self, node): - if self.use_optionlist_for_option_list: - self.body.append('\\end{optionlist}\n') - else: - self.body.append('\\end{tabularx}\n') - self.body.append('\\end{center}\n') + self.body.append('\\end{optionlist}\n') def visit_option_list_item(self, node): pass def depart_option_list_item(self, node): - if not self.use_optionlist_for_option_list: - self.body.append('\\\\\n') + pass def visit_option_string(self, node): ##self.body.append(self.starttag(node, 'span', '', CLASS='option')) diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index dabeac688..83395765e 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -488,37 +488,29 @@ iv \subsection*{2.4~~~Definition Lists} \begin{description} %[visit_definition_list_item] -\item[{Term}] %[visit_definition] - +\item[{Term}] Definition -%[depart_definition] %[depart_definition_list_item] %[visit_definition_list_item] \item[{Term}] (\textbf{classifier}) -%[visit_definition] Definition paragraph 1. Definition paragraph 2. -%[depart_definition] %[depart_definition_list_item] %[visit_definition_list_item] -\item[{Term}] %[visit_definition] - +\item[{Term}] Definition -%[depart_definition] %[depart_definition_list_item] %[visit_definition_list_item] \item[{Term}] (\textbf{classifier one}) (\textbf{classifier two}) -%[visit_definition] Definition -%[depart_definition] %[depart_definition_list_item] \end{description} @@ -560,7 +552,6 @@ doesn't get stripped away.) \subsection*{2.6~~~Option Lists} For listing command-line options: -% [option list] \begin{optionlist}{3cm} \item [-a] command-line option ``a'' |