]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.cpp
Partially revert r34995, which broke math output. Not sure why yet....
[lyx.git] / src / Layout.cpp
index cd7b5d43233b961f1be4744fd1a8b9afc7ca9fc0..a9a5487b989e624d10203f0bccb20b34d666efd3 100644 (file)
@@ -23,7 +23,7 @@
 #include "support/lassert.h"
 #include "support/lstrings.h"
 
-#include <boost/regex.hpp>
+#include "support/regex.h"
 
 using namespace std;
 using namespace lyx::support;
@@ -149,6 +149,8 @@ Layout::Layout()
        htmlforcecss_ = false;
        htmltitle_ = false;
        spellcheck = true;
+       optargs = 0;
+       reqargs = 0;
 }
 
 
@@ -505,9 +507,15 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                        break;
                }
                        
-               case LT_REFPREFIX:
-                       lex >> refprefix;
+               case LT_REFPREFIX: {
+                       docstring arg;
+                       lex >> arg;
+                       if (arg == "OFF")
+                               refprefix.clear();
+                       else
+                               refprefix = arg;
                        break;
+               }
 
                case LT_HTMLTAG:
                        lex >> htmltag_;
@@ -558,6 +566,12 @@ bool Layout::read(Lexer & lex, TextClass const & tclass)
                }
        }
        lex.popTable();
+       // make sure we only have inpreamble = true for commands
+       if (inpreamble && latextype != LATEX_COMMAND) {
+               LYXERR0("InPreamble not permitted except with Command-type layouts.");
+               LYXERR0("Layout name: " << name());
+               inpreamble = false;
+       }
 
        return !error;
 }
@@ -865,11 +879,11 @@ docstring const i18npreamble(Language const * lang, docstring const & templ)
        LASSERT(false, /**/);
 #else
        // FIXME UNICODE
-       // boost::regex is not unicode-safe.
+       // lyx::regex is not unicode-safe.
        // Should use QRegExp or (boost::u32regex, but that requires ICU)
-       static boost::regex const reg("_\\(([^\\)]+)\\)");
-       boost::smatch sub;
-       while (boost::regex_search(preamble, sub, reg)) {
+       static regex const reg("_\\(([^\\)]+)\\)");
+       smatch sub;
+       while (regex_search(preamble, sub, reg)) {
                string const key = sub.str(1);
                string translated;
                if (isAscii(key))