]> git.lyx.org Git - features.git/blobdiff - src/insets/insetcommand.C
read the Changelog
[features.git] / src / insets / insetcommand.C
index 1595b884dc496e8fc94d2bf262887be9ffe5e2fe..b5758e107c3cb8aee24f592f3abe4bed48ee511c 100644 (file)
@@ -23,15 +23,13 @@ using std::endl;
 
 
 InsetCommand::InsetCommand()
-{
-}
+{}
 
 
 InsetCommand::InsetCommand(string const & cmd, string const & arg, 
                           string const & opt)
        : cmdname(cmd), options(opt), contents(arg)
-{
-}
+{}
 
 
 // In lyxf3 this will be just LaTeX
@@ -107,15 +105,28 @@ void InsetCommand::scanCommand(string const & cmd)
 // This function will not be necessary when lyx3
 void InsetCommand::Read(Buffer const *, LyXLex & lex)
 {    
+       string token;
+
        if (lex.EatLine()) {
-               string t = lex.GetString();
-               scanCommand(t);
+               token = lex.GetString();
+               scanCommand(token);
        } else
                lex.printError("InsetCommand: Parse error: `$$Token'");
+       while (lex.IsOK()) {
+               lex.nextToken();
+               token = lex.GetString();
+               if (token == "\\end_inset")
+                       break;
+       }
+       if (token != "\\end_inset") {
+               lex.printError("Missing \\end_inset at this point. "
+                              "Read: `$$Token'");
+       }
 }
 
 
-int InsetCommand::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool/*fs*/) const
+int InsetCommand::Latex(Buffer const *, ostream & os,
+                       bool /*fragile*/, bool/*fs*/) const
 {
        os << getCommand();
        return 0;