Commits

Wilfried Huss committed b3a08ab

fix left, right and center aligment of paragraphs

  • Participants
  • Parent commits f78d4a7

Comments (0)

Files changed (2)

conversion.sws

Binary file modified.
             if style_text is not None:
                 style = self.parse_style(style_text)
                 if style.has_key('align'):
+                    if style['align'] == "left":
+                        self.latex[-1] += '\n\n\\begin{flushleft}\n'
                     if style['align'] == "right":
-                        self.latex[-1] += '\n\n{\\leftskip 0 pt plus 1 fill \\rightskip 0 pt\n '
+                        self.latex[-1] += '\n\n\\begin{flushright}\n'
                     elif style['align'] == "center":
-                        self.latex[-1] += '\n\n{\\leftskip 0 pt plus 1 fill \\rightskip 0 pt plus 1 fill\n '
+                        self.latex[-1] += '\n\n\\begin{center}\n'
                     else:
-                        self.latex[-1] += '\n\n{\n '                
+                        self.latex[-1] += '\n\n'
             else:
-                self.latex[-1] += '\n\n{\n '                
+                self.latex[-1] += '\n\n '
+            self.stack.append(attrs)
         elif tag == 'ul':
             self.latex[-1] += '\\begin{itemize}\n'
         elif tag == 'ol':
             self.latex[-1] += '$$'
         elif tag == 'p':
             self.add_data()
-            self.latex[-1] += '\par}\n\n'
+            attrs = self.stack.pop()
+            style_text = dict(attrs).get('style')
+            if style_text is not None:
+                style = self.parse_style(style_text)
+                if style.has_key('align'):
+                    if style['align'] == "left":
+                        self.latex[-1] += '\n\\end{flushleft}\n'
+                    if style['align'] == "right":
+                        self.latex[-1] += '\n\\end{flushright}\n'
+                    elif style['align'] == "center":
+                        self.latex[-1] += '\n\n\\end{center}\n'
+                    else:
+                        self.latex[-1] += '\n\n'
+            else:
+                self.latex[-1] += '\n\n'
         elif tag == 'ul':
             self.add_data()
             self.latex[-1] += '\\end{itemize}\n'