]> git.lyx.org Git - lyx.git/commitdiff
Allow alignment customization in environments.
authorRichard Heck <rgheck@comcast.net>
Wed, 15 Sep 2010 17:29:51 +0000 (17:29 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 15 Sep 2010 17:29:51 +0000 (17:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35398 a592a061-630c-0410-9148-cb99ea01b6c8

src/output_xhtml.cpp

index 1c822a9bf529d4164462ff0e8d752ef4b74ea812..f7533eee1b298bb83ded5b8df8b8181315013299 100644 (file)
@@ -503,7 +503,8 @@ inline void openTag(XHTMLStream & xs, Layout const & lay)
 }
 
 
-void openTag(XHTMLStream & xs, Layout const & lay, ParagraphParameters const & params)
+void openTag(XHTMLStream & xs, Layout const & lay, 
+             ParagraphParameters const & params)
 {
        // FIXME Are there other things we should handle here?
        string const align = alignmentToCSS(params.align());
@@ -540,6 +541,20 @@ inline void openItemTag(XHTMLStream & xs, Layout const & lay)
 }
 
 
+void openItemTag(XHTMLStream & xs, Layout const & lay, 
+             ParagraphParameters const & params)
+{
+       // FIXME Are there other things we should handle here?
+       string const align = alignmentToCSS(params.align());
+       if (align.empty()) {
+               openItemTag(xs, lay);
+               return;
+       }
+       string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
+       xs << html::StartTag(lay.htmlitemtag(), attrs);
+}
+
+
 inline void closeItemTag(XHTMLStream & xs, Layout const & lay)
 {
        xs << html::EndTag(lay.htmlitemtag());
@@ -722,7 +737,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
                                
                                bool const labelfirst = style.htmllabelfirst();
                                if (!labelfirst)
-                                       openItemTag(xs, style);
+                                       openItemTag(xs, style, par->params());
                                
                                // label output
                                if (style.labeltype != LABEL_NO_LABEL && 
@@ -757,7 +772,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
                                } // end label output
 
                                if (labelfirst)
-                                       openItemTag(xs, style);
+                                       openItemTag(xs, style, par->params());
 
                                par->simpleLyXHTMLOnePar(buf, xs, runparams, 
                                        text.outerFont(distance(begin, par)), sep);