]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
Unbreak citing from bibliography environment
[lyx.git] / src / Layout.cpp
index 285511a104c78ff1191cb28a74ee5434c2f15065..4813854b48aa59d03c35c30a148e4d4cdc2eaf86 100644 (file)
@@ -40,6 +40,8 @@ enum LayoutTags {
        LT_ALIGN = 1,
        LT_ALIGNPOSSIBLE,
        LT_ARGUMENT,
+       LT_AUTONESTS,
+       LT_AUTONESTEDBY,
        LT_MARGIN,
        LT_BOTTOMSEP,
        LT_CATEGORY,
@@ -118,7 +120,7 @@ enum LayoutTags {
 /////////////////////
 
 Layout::Layout()
-       : add_to_toc_(false), is_toc_caption_(false)
+       : add_to_toc_(false), is_toc_caption_(true)
 {
        unknown_ = false;
        margintype = MARGIN_STATIC;
@@ -191,6 +193,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
                { "align",          LT_ALIGN },
                { "alignpossible",  LT_ALIGNPOSSIBLE },
                { "argument",       LT_ARGUMENT },
+               { "autonests",      LT_AUTONESTS },
                { "babelpreamble",  LT_BABELPREAMBLE },
                { "bottomsep",      LT_BOTTOMSEP },
                { "category",       LT_CATEGORY },
@@ -217,6 +220,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
                { "innertag",       LT_INNERTAG },
                { "inpreamble",     LT_INPREAMBLE },
                { "intitle",        LT_INTITLE },
+               { "isautonestedby", LT_AUTONESTEDBY },
                { "istoccaption",   LT_ISTOCCAPTION },
                { "itemcommand",    LT_ITEMCOMMAND },
                { "itemsep",        LT_ITEMSEP },
@@ -592,6 +596,30 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
                        break;
                }
 
+               case LT_AUTONESTS: {
+                       docstring autonest = lex.getLongString(from_ascii("EndAutoNests"));
+                       autonest = subst(autonest, from_ascii("\n"), docstring());
+                       autonest = subst(autonest, from_ascii("\t"), docstring());
+                       autonest = subst(autonest, from_ascii("\""), docstring());
+                       autonest = subst(autonest, '_', ' ');
+                       vector<docstring> const autonests =
+                               getVectorFromString(autonest, from_ascii(","), false, true);
+                       autonests_.insert(autonests.begin(), autonests.end());
+                       break;
+               }
+
+               case LT_AUTONESTEDBY: {
+                       docstring autonest = lex.getLongString(from_ascii("EndIsAutoNestedBy"));
+                       autonest = subst(autonest, from_ascii("\n"), docstring());
+                       autonest = subst(autonest, from_ascii("\t"), docstring());
+                       autonest = subst(autonest, from_ascii("\""), docstring());
+                       autonest = subst(autonest, '_', ' ');
+                       vector<docstring> const autonests =
+                               getVectorFromString(autonest, from_ascii(","), false, true);
+                       autonested_by_.insert(autonests.begin(), autonests.end());
+                       break;
+               }
+
                case LT_REFPREFIX: {
                        docstring arg;
                        lex >> arg;
@@ -1387,6 +1415,26 @@ void Layout::write(ostream & os) const
                }
                os << '\n';
        }
+       if (!autonests_.empty()) {
+               os << "\tAutoNests\n\t";
+               for (set<docstring>::const_iterator it = autonests_.begin();
+                    it != autonests_.end(); ++it) {
+                       if (it != autonests_.begin())
+                               os << ',';
+                       os << to_utf8(*it);
+               }
+               os << "\n\tEndAutoNests\n";
+       }
+       if (!autonested_by_.empty()) {
+               os << "\tIsAutoNestedBy\n\t";
+               for (set<docstring>::const_iterator it = autonested_by_.begin();
+                    it != autonested_by_.end(); ++it) {
+                       if (it != autonested_by_.begin())
+                               os << ',';
+                       os << to_utf8(*it);
+               }
+               os << "\n\tIsAutoNestedBy\n";
+       }
        if (refprefix.empty())
                os << "\tRefPrefix OFF\n";
        else
@@ -1506,13 +1554,8 @@ string const & Layout::htmlitemattr() const
 
 string const & Layout::htmllabeltag() const
 {
-       if (htmllabeltag_.empty()) {
-               if (labeltype != LABEL_ABOVE &&
-                   labeltype != LABEL_CENTERED)
+       if (htmllabeltag_.empty())
                        htmllabeltag_ = "span";
-               else
-                       htmllabeltag_ = "div";
-       }
        return htmllabeltag_;
 }