]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.cpp
tex2lyx/text.cpp: a fix and a clarification
[lyx.git] / src / tex2lyx / text.cpp
index e57784fc0782f7963716993b14b0be2076528ef1..2b5656c618a2297455c4c92d7c20503bc7c3c2f5 100644 (file)
@@ -1344,24 +1344,25 @@ void parse_environment(Parser & p, ostream & os, bool outer,
        }
 
        else if (name == "verbatim") {
-               eat_whitespace(p, os, parent_context, false);
                os << "\n\\begin_layout Verbatim\n";
                string const s = p.verbatimEnvironment("verbatim");
                string::const_iterator it2 = s.begin();
                for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
-                       if (*it == '\n') {
+                       if (*it == '\\')
+                               os << "\\backslash ";
+                       else if (*it == '\n') {
                                it2 = it + 1;
                                // avoid adding an empty paragraph at the end
-                               // if there are 2 consecutive spaces at the end ignore it
+                               // FIXME: if there are 2 consecutive spaces at the end ignore it
                                // because LyX will re-add a \n
+                               // This hack must be removed once bug 8049 is fixed!
                                if ((it + 1 != et) && (it + 2 != et || *it2 != '\n'))
                                        os << "\n\\end_layout\n\\begin_layout Verbatim\n";
-                       } else
+                       } else 
                                os << *it;
                }
                os << "\n\\end_layout\n\n";
                p.skip_spaces();
-               skip_braces(p); // eat {} that might by set by LyX behind comments
                // reset to Standard layout
                os << "\n\\begin_layout Standard\n";
        }
@@ -3201,12 +3202,16 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                btprint = key;
                }
 
-               else if (t.cs() == "index") {
+               else if (t.cs() == "index" ||
+                        (t.cs() == "sindex" && preamble.use_indices() == "true")) {
                        context.check_layout(os);
-                       begin_inset(os, "Index idx\n");
-                       os << "status collapsed\n";
+                       string const kind = (t.cs() == "index") ? "idx" : p.getArg('[', ']');
+                       begin_inset(os, "Index ");
+                       os << kind << "\nstatus collapsed\n";
                        parse_text_in_inset(p, os, FLAG_ITEM, false, context, "Index");
                        end_inset(os);
+                       if (t.cs() == "sindex")
+                               preamble.registerAutomaticallyLoadedPackage("splitidx");
                }
 
                else if (t.cs() == "nomenclature") {