Commits

arlaneenalra  committed d2c746c

Modify the latex writer to output environments for classes.

  • Participants
  • Parent commits 80c9afc

Comments (0)

Files changed (1)

File sphinx/writers/latex.py

 
 import re
 import sys
+import pprint
 from os import path
 
 from docutils import nodes, writers
     depart_field_body = depart_definition
 
     def visit_paragraph(self, node):
+        # self.body.append(pprint.pformat(node.get('classes', [])))
+        if 'type' in node:
+            self.body.append('\\begin{%s}' % node['type'])
+        
+        classes = node.get('classes', []);
+        if classes != []:
+            self.body.append('\n')
+            for out_class in classes:
+                self.body.append('\\begin{%s}' % out_class)
         self.body.append('\n')
     def depart_paragraph(self, node):
+        if 'type' in node:
+            self.body.append('\\end{%s}' % node['type'])
+        
+        classes = node.get('classes', []);
+        if classes != []:
+            for out_class in classes:
+                self.body.append('\n\\end{%s}' % out_class)
         self.body.append('\n')
 
     def visit_centered(self, node):