]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
Add missing revert routine to lyx_2_0.py
[lyx.git] / src / Layout.cpp
index f782c12d9b01a8ef6a5b943fb19ed75d4e991fd2..c54e121d23add7f3c9091ce5dcf66fd19fed06c7 100644 (file)
@@ -94,6 +94,7 @@ enum LayoutTags {
        LT_ITEMTAG,
        LT_HTMLTAG,
        LT_HTMLATTR,
+       LT_HTMLCLASS,
        LT_HTMLITEM,
        LT_HTMLITEMATTR,
        LT_HTMLLABEL,
@@ -110,6 +111,7 @@ enum LayoutTags {
        LT_DOCBOOKINNERTAGTYPE,
        LT_DOCBOOKININFO,
        LT_DOCBOOKABSTRACT,
+       LT_DOCBOOKGENERATETITLE,
        LT_DOCBOOKWRAPPERTAG,
        LT_DOCBOOKWRAPPERATTR,
        LT_DOCBOOKWRAPPERTAGTYPE,
@@ -239,6 +241,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
                { "docbookabstract",           LT_DOCBOOKABSTRACT },
                { "docbookattr",               LT_DOCBOOKATTR },
                { "docbookforceabstracttag",   LT_DOCBOOKFORCEABSTRACTTAG },
+               { "docbookgeneratetitle",      LT_DOCBOOKGENERATETITLE },
                { "docbookininfo",             LT_DOCBOOKININFO },
                { "docbookinnerattr",          LT_DOCBOOKINNERATTR },
                { "docbookinnertag",           LT_DOCBOOKINNERTAG },
@@ -271,6 +274,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
                { "forcelocal",     LT_FORCELOCAL },
                { "freespacing",    LT_FREE_SPACING },
                { "htmlattr",       LT_HTMLATTR },
+               { "htmlclass",      LT_HTMLCLASS },
                { "htmlforcecss",   LT_HTMLFORCECSS },
                { "htmlintoc",      LT_HTMLINTOC },
                { "htmlitem",       LT_HTMLITEM },
@@ -513,7 +517,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
 
                case LT_LATEXPARAM:
                        lex >> latexparam_;
-                       latexparam_ = subst(latexparam_, """, "\"");
+                       latexparam_ = subst(latexparam_, """, "\"");
                        break;
 
                case LT_LEFTDELIM:
@@ -718,6 +722,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
                        lex >> htmlattr_;
                        break;
 
+               case LT_HTMLCLASS:
+                       lex >> htmlclass_;
+                       break;
+
                case LT_HTMLITEM:
                        lex >> htmlitemtag_;
                        break;
@@ -866,6 +874,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
             lex >> docbooknofontinside_;
             break;
 
+        case LT_DOCBOOKGENERATETITLE:
+            lex >> docbookgeneratetitle_;
+            break;
+
                case LT_SPELLCHECK:
                        lex >> spellcheck;
                        break;
@@ -1449,7 +1461,7 @@ void Layout::write(ostream & os) const
        if (!latexname_.empty())
                os << "\tLatexName \"" << latexname_ << "\"\n";
        if (!latexparam_.empty())
-               os << "\tLatexParam \"" << subst(latexparam_, "\"", "&quot;")
+               os << "\tLatexParam \"" << subst(latexparam_, "\"", "&#34;")
                   << "\"\n";
        if (!leftdelim_.empty())
                os << "\tLeftDelim "
@@ -1668,6 +1680,10 @@ void Layout::write(ostream & os) const
                os << "\tHTMLTag " << htmltag_ << '\n';
        if (!htmlattr_.empty())
                os << "\tHTMLAttr " << htmlattr_ << '\n';
+       if (!htmlclass_.empty())
+               os << "\tHTMLClass " << htmlclass_ << '\n';
+       if (!htmlintoc_)
+               os << "\tHTMLInToc " << htmlintoc_ << '\n';
        if (!htmlitemtag_.empty())
                os << "\tHTMLItem " << htmlitemtag_ << '\n';
        if (!htmlitemattr_.empty())
@@ -1807,13 +1823,25 @@ string const & Layout::htmltag() const
 }
 
 
-string const & Layout::htmlattr() const
+string const & Layout::htmlclass() const
 {
-       // If it's an enumeration, then we recalculate the class each time through
-       // unless it has been given explicitly
-       if (htmlattr_.empty() && labeltype != LABEL_ENUMERATE)
-               htmlattr_ = "class=\"" + defaultCSSClass() + "\"";
-       return htmlattr_;
+       // If it's an enumeration or itemize list, then we recalculate the class each
+       // time through (unless it has been given explicitly). So we do nothing here.
+       if (htmlclass_.empty() && labeltype != LABEL_ENUMERATE && labeltype != LABEL_ITEMIZE)
+               htmlclass_ = defaultCSSClass();
+       return htmlclass_;
+}
+
+
+string const & Layout::htmlGetAttrString() const {
+       if (!htmlfullattrs_.empty())
+               return htmlfullattrs_;
+       htmlfullattrs_ = htmlclass();
+       if (!htmlfullattrs_.empty())
+               htmlfullattrs_ = "class='" + htmlfullattrs_ + "'";
+       if (!htmlattr_.empty())
+               htmlfullattrs_ += " " + htmlattr_;
+       return htmlfullattrs_;
 }