]> git.lyx.org Git - features.git/commitdiff
Fix parsing of stuff with ] in \item arguments (part of bug #6127)
authorGeorg Baum <georg.baum@post.rwth-aachen.de>
Sun, 27 Nov 2011 13:29:56 +0000 (13:29 +0000)
committerGeorg Baum <georg.baum@post.rwth-aachen.de>
Sun, 27 Nov 2011 13:29:56 +0000 (13:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40295 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/test/test-structure.tex
src/tex2lyx/text.cpp

index 4182e37aaf1a89abb97866b8a891d74c7a814542..6ca87694a818c5abc3acacb261ee1cd66992da57 100644 (file)
@@ -286,6 +286,7 @@ labelings:
 \begin{lyxlist}{00.00.0000}
 \item [label~1] first item
 \item [label~2] second item
+\item [{$\left[\textrm{ }\right]^{x}$}] Label with space, math and ] in it
 \end{lyxlist}
 and bibliography:
 \begin{thebibliography}{9}
index 71d36a56befa72afe432ede42035bd7ac2ef04aa..cfc019821ad5104279fe0f6a745e184307d3b6b1 100644 (file)
@@ -2241,7 +2241,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                // FIXME: This swallows comments, but we cannot use
                                //        eat_whitespace() since we must not output
                                //        anything before the item.
-                               s = p.getArg('[', ']');
+                               p.skip_spaces(true);
+                               s = p.verbatimOption();
                        } else
                                p.skip_spaces(false);
                        context.set_item();
@@ -2291,7 +2292,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                else if (t.cs() == "bibitem") {
                        context.set_item();
                        context.check_layout(os);
-                       string label = convert_command_inset_arg(p.getArg('[', ']'));
+                       eat_whitespace(p, os, context, false);
+                       string label = convert_command_inset_arg(p.verbatimOption());
                        string key = convert_command_inset_arg(p.verbatim_item());
                        if (contains(label, '\\') || contains(key, '\\')) {
                                // LyX can't handle LaTeX commands in labels or keys