]> git.lyx.org Git - features.git/commitdiff
tex2lyx: support for \item with opt arg in itemize environment
authorUwe Stöhr <uwestoehr@lyx.org>
Tue, 11 Nov 2014 00:20:03 +0000 (01:20 +0100)
committerUwe Stöhr <uwestoehr@lyx.org>
Tue, 11 Nov 2014 00:20:03 +0000 (01:20 +0100)
src/tex2lyx/TODO.txt
src/tex2lyx/test/test-structure.lyx.lyx
src/tex2lyx/test/test-structure.tex
src/tex2lyx/text.cpp

index 1de2a31d89ded7d41791351a8ea7589179918270..974dcce9bf3d88e74bd98730a1a6dc8945e08843 100644 (file)
@@ -62,7 +62,6 @@ Format LaTeX feature                        LyX feature
 446    Optional and required arguments      InsetArgument
        now numbered by order
 448
-449    \item[<arg>]                         \begin_inset Argument item:<nr>
 450    ugm LaTeX font,                      \font_roman, \font_osf,
 451    beamer overlay arguments             InsetArgument
        \command<arg>, \begin{env}<arg>
index e8e1b8a58e3d0f8b477da7a1a107a753ed026052..6a52a847eef38ad664bc08099611970e8cc84252 100644 (file)
@@ -877,7 +877,17 @@ the second item
 \end_layout
 
 \begin_layout Itemize
-the third item
+
+\begin_inset Argument item:1
+status open
+
+\begin_layout Plain Layout
+custom label
+\end_layout
+
+\end_inset
+
+the third item has a custom label
 \end_layout
 
 \begin_deeper
index 745872b363392d3583f365d9dc345857a65e8e87..824994eb1270ad80548da4442aa62ae9d52603f9 100644 (file)
@@ -285,7 +285,7 @@ and a second paragraph for good measure
 
 \item the second item
 
-\item the third item
+\item[custom label] the third item has a custom label
 
 \subsubsection*{and a sssection heading inside it (why not?)}
 \end{itemize}
index 009b8b490f3f699e95f14b11d4dc5285fb0431d7..2c212a425fffbc7afc57b8171e0a591c94baf0fa 100644 (file)
@@ -2628,11 +2628,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        }
                        if (optarg) {
                                if (context.layout->labeltype != LABEL_MANUAL) {
-                                       // LyX does not support \item[\mybullet]
-                                       // in itemize environments
+                                       // handle option of itemize item
+                                       begin_inset(os, "Argument item:1\n");
+                                       os << "status open\n";
+                                       os << "\n\\begin_layout Plain Layout\n";
                                        Parser p2(s + ']');
                                        os << parse_text_snippet(p2,
                                                FLAG_BRACK_LAST, outer, context);
+                                       // we must not use context.check_end_layout(os)
+                                       // because that would close the outer itemize layout
+                                       os << "\n\\end_layout\n";
+                                       end_inset(os);
+                                       eat_whitespace(p, os, context, false);
                                } else if (!s.empty()) {
                                        // LyX adds braces around the argument,
                                        // so we need to remove them here.
@@ -2648,8 +2655,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                        } else {
                                                Parser p2(s + ']');
                                                os << parse_text_snippet(p2,
-                                                       FLAG_BRACK_LAST,
-                                                       outer, context);
+                                                       FLAG_BRACK_LAST, outer, context);
                                        }
                                        // The space is needed to separate the
                                        // item from the rest of the sentence.