From 3c08472b0c389752c9fe7e74f1fc9d39dffa48f1 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 15 Sep 2010 17:29:51 +0000 Subject: [PATCH] Allow alignment customization in environments. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35398 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_xhtml.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 1c822a9bf5..f7533eee1b 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -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); -- 2.39.5