]> git.lyx.org Git - features.git/commitdiff
LyX does not support optional arguments of ref commands
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 18 Feb 2011 20:39:58 +0000 (20:39 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 18 Feb 2011 20:39:58 +0000 (20:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37730 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/text.cpp

index b82d1686e89c2e0b5a195f17f43e20f06bad548c..01c1775c581c81361573ab49031ece0ad1bc2305 100644 (file)
@@ -2348,13 +2348,22 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                else if (is_known(t.cs(), known_ref_commands)) {
-                       context.check_layout(os);
-                       begin_command_inset(os, "ref", t.cs());
-                       // LyX cannot handle newlines in a latex command
-                       // FIXME: Move the substitution into parser::getOpt()?
-                       os << subst(p.getOpt(), "\n", " ");
-                       os << "reference " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
-                       end_inset(os);
+                       string const opt = p.getOpt();
+                       if (opt.empty()) {
+                               context.check_layout(os);
+                               begin_command_inset(os, "ref", t.cs());
+                               // LyX cannot handle newlines in a latex command
+                               // FIXME: Move the substitution into parser::getOpt()?
+                               os << "reference \""
+                                  << subst(p.verbatim_item(), "\n", " ")
+                                  << "\"\n";
+                               end_inset(os);
+                       } else {
+                               // LyX does not support optional arguments of ref commands
+                               handle_ert(os, t.asInput() + '[' + opt + "]{" +
+                                              p.verbatim_item() + "}", context);
+                       }
+
                }
 
                else if (use_natbib &&