]> git.lyx.org Git - lyx.git/blobdiff - src/factory.cpp
Fix broken layout file syntax
[lyx.git] / src / factory.cpp
index 858e53f138de902f1d0823688d070a588f03b9e1..b640c6b2ae09a60412fe9540254d538c0aca5be4 100644 (file)
@@ -154,8 +154,14 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
                case LFUN_MARGINALNOTE_INSERT:
                        return new InsetMarginal(buf);
 
-               case LFUN_ARGUMENT_INSERT:
-                       return new InsetArgument(buf);
+               case LFUN_ARGUMENT_INSERT: {
+                       string arg = cmd.getArg(0);
+                       if (arg.empty()) {
+                               LYXERR0("argument-insert needs an argument!");
+                               return 0;
+                       }
+                       return new InsetArgument(buf, arg);
+               }
 
                case LFUN_FLOAT_INSERT: {
                        string argument = to_utf8(cmd.argument());
@@ -564,12 +570,15 @@ Inset * readInset(Lexer & lex, Buffer * buf)
                }
                inset->setBuffer(*buf);
        } else { 
-               // FIXME This branch should be made to use inset codes as the preceding 
-               // branch does. Unfortunately, that will take some doing. It requires
-               // converting the representation of the insets in LyX files so that they
-               // use the inset names listed in Inset.cpp. Then, as above, the inset names
-               // can be translated to inset codes using insetCode(). And the insets'
-               // write() routines should use insetName() rather than hardcoding it.
+               // FIXME This branch should be made to use inset codes
+               // as the preceding branch does. Unfortunately, that
+               // will take some doing. It requires converting the
+               // representation of the insets in LyX files so that
+               // they use the inset names listed in Inset.cpp. Then,
+               // as above, the inset names can be translated to
+               // inset codes using insetCode(). And the insets'
+               // write() routines should use insetName() rather than
+               // hardcoding it.
                if (tmptok == "Quotes") {
                        inset.reset(new InsetQuotes(buf));
                } else if (tmptok == "External") {
@@ -615,7 +624,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
                } else if (tmptok == "Newline") {
                        inset.reset(new InsetNewline);
                } else if (tmptok == "Argument") {
-                       inset.reset(new InsetArgument(buf));
+                       inset.reset(new InsetArgument(buf, tmptok));
                } else if (tmptok == "Float") {
                        inset.reset(new InsetFloat(buf, string()));
                } else if (tmptok == "Wrap") {