]> git.lyx.org Git - lyx.git/blobdiff - src/output_xhtml.cpp
(finishing patch -- question was restored, but there were still problems)
[lyx.git] / src / output_xhtml.cpp
index 0c6c61b162a34f325881c2b13322f362b4ad0b51..f6ab5a5a02ff72942d4aef3be0d78393e3825bf5 100644 (file)
@@ -286,6 +286,20 @@ XHTMLStream & XHTMLStream::operator<<(char_type c)
 }
 
 
+XHTMLStream & XHTMLStream::operator<<(char c)
+{
+       clearTagDeque();
+       if (nextraw_) {
+               os_ << c;
+               nextraw_ = false;
+       } else {
+               string const d = html::escapeChar(c);
+               os_ << from_ascii(d);
+       }
+       return *this;
+}
+
+
 XHTMLStream & XHTMLStream::operator<<(int i)
 {
        clearTagDeque();
@@ -491,7 +505,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());
@@ -528,6 +543,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());
@@ -710,7 +739,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 && 
@@ -745,7 +774,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);
@@ -808,7 +837,7 @@ void makeCommand(Buffer const & buf,
        if (!style.counter.empty())
                buf.params().documentClass().counters().step(style.counter, OutputUpdate);
 
-       openTag(xs, style);
+       openTag(xs, style, pbegin->params());
 
        // Label around sectioning number:
        // FIXME Probably need to account for LABEL_MANUAL