]> git.lyx.org Git - lyx.git/blobdiff - src/output_xhtml.cpp
Update Win installer for new dictionary links. Untested.
[lyx.git] / src / output_xhtml.cpp
index 3fb292e4dacbacae6bf95876665720003c672128..f01b0b8e62d04692277661fbba77f8df7b958767 100644 (file)
@@ -159,7 +159,7 @@ namespace {
 inline void openParTag(XMLStream & xs, Layout const & lay,
                        std::string const & parlabel)
 {
-       string attrs = lay.htmlattr();
+       string attrs = lay.htmlGetAttrString();
        if (!parlabel.empty())
                attrs += " id='" + parlabel + "'";
        xs << xml::ParTag(lay.htmltag(), attrs);
@@ -185,7 +185,7 @@ void openParTag(XMLStream & xs, Layout const & lay,
                openParTag(xs, lay, parlabel);
                return;
        }
-       string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
+       string attrs = lay.htmlGetAttrString() + " style='text-align: " + align + ";'";
        if (!parlabel.empty())
                attrs += " id='" + parlabel + "'";
        xs << xml::ParTag(lay.htmltag(), attrs);
@@ -212,27 +212,33 @@ inline void closeLabelTag(XMLStream & xs, Layout const & lay)
 
 inline void openItemTag(XMLStream & xs, Layout const & lay)
 {
-       xs << xml::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
+       if (lay.htmlitemtag() != "NONE") {
+               xs << xml::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
+       }
 }
 
 
 void openItemTag(XMLStream & 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;
+       if (lay.htmlitemtag() != "NONE") {
+               // 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.htmlGetAttrString() + " style='text-align: " + align + ";'";
+               xs << xml::StartTag(lay.htmlitemtag(), attrs);
        }
-       string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
-       xs << xml::StartTag(lay.htmlitemtag(), attrs);
 }
 
 
 inline void closeItemTag(XMLStream & xs, Layout const & lay)
 {
-       xs << xml::EndTag(lay.htmlitemtag());
+       if (lay.htmlitemtag() != "NONE") {
+               xs << xml::EndTag(lay.htmlitemtag());
+       }
 }
 
 // end of convenience functions
@@ -408,16 +414,19 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
        depth_type const origdepth = pbegin->params().depth();
 
        // open tag for this environment
-       if (bstyle.labeltype == LABEL_ENUMERATE && bstyle.htmlattr().empty()) {
+       if ((bstyle.labeltype == LABEL_ENUMERATE || bstyle.labeltype == LABEL_ITEMIZE)
+               && bstyle.htmlclass().empty()) {
                // In this case, we have to calculate the CSS class ourselves, each time
                // through
-               // FIXME We assume in these cases that the standard enumeration counter
-               // is being used. (We also do not deal with 'resume' counters, though I'm
-               // not sure that can be done at all.)
+               // FIXME We assume in these cases that the standard counters are being used.
+               // (We also do not deal with 'resume' counters, though I'm not sure that can
+               // be done at all in HTML.)
 
-               // Code borrowed from Buffer::Impl::setLabel
+               // Code adapated from Buffer::Impl::setLabel
+               bool const isenum = bstyle.labeltype == LABEL_ENUMERATE;
                docstring enumcounter = bstyle.counter.empty() ?
-                                       from_ascii("enum") : bstyle.counter;
+                                       ( isenum ? from_ascii("enum") : from_ascii("lyxitem") ) :
+                                       bstyle.counter;
                switch (par->itemdepth) {
                case 2:
                        enumcounter += 'i';
@@ -435,7 +444,9 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
                        // not a valid enumdepth...
                        break;
                }
-               openParTag(xs, bstyle, to_utf8(enumcounter), pbegin->magicLabel());
+               openParTag(xs, bstyle,
+                                  string( isenum ? "lyxenum" : "lyxitem" ) + " "
+                                       + to_utf8(enumcounter), pbegin->magicLabel());
        }
        else
                openParTag(xs, bstyle, pbegin->magicLabel());