]> git.lyx.org Git - features.git/blobdiff - src/tex2lyx/text.cpp
Merge branch 'master' of git.lyx.org:lyx
[features.git] / src / tex2lyx / text.cpp
index f9888df654a14b192351c6d6bdedbb3303c71f06..46cc347db75d8429a47028fedad1ed4e22da659a 100644 (file)
@@ -1480,6 +1480,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                                        output_ert_inset(os, "\\", parent_context);
                                else if (*it == '$')
                                        output_ert_inset(os, "$", parent_context);
+                               else if (*it == '\n' && it + 1 != et && s.begin() + 1 != it)
+                                       os << "\n ";
                                else
                                        os << *it;
                        }
@@ -1698,7 +1700,14 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                begin_inset(os, "Flex ");
                os << to_utf8(newinsetlayout->name()) << '\n'
                   << "status collapsed\n";
-               parse_text_in_inset(p, os, FLAG_END, false, parent_context, newinsetlayout);
+               if (newinsetlayout->isPassThru()) {
+                       string const arg = p.verbatimEnvironment(name);
+                       Context context(true, parent_context.textclass, 
+                                       &parent_context.textclass.plainLayout(),
+                                       parent_context.layout);
+                       output_ert(os, arg, parent_context);
+               } else
+                       parse_text_in_inset(p, os, FLAG_END, false, parent_context, newinsetlayout);
                end_inset(os);
        }
 
@@ -3250,8 +3259,15 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                // the TIPA Combining diacritical marks
-               else if (is_known(t.cs(), known_tipa_marks)) {
+               else if (is_known(t.cs(), known_tipa_marks) || t.cs() == "textvertline") {
+                       preamble.registerAutomaticallyLoadedPackage("tipa");
+                       preamble.registerAutomaticallyLoadedPackage("tipx");
                        context.check_layout(os);
+                       if (t.cs() == "textvertline") {
+                               os << "|";
+                               skip_braces(p);
+                               continue;
+                       }
                        // try to see whether the string is in unicodesymbols
                        bool termination;
                        docstring rem;
@@ -3267,10 +3283,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                             << ", result is " << to_utf8(s)
                                             << "+" << to_utf8(rem) << endl;
                                os << content << to_utf8(s);
-                               // tipa is already registered because of the surrounding IPA environment
-                               // or \textipa but it does not harm to register it again if necessary
-                               for (set<string>::const_iterator it = req.begin(); it != req.end(); ++it)
-                                       preamble.registerAutomaticallyLoadedPackage(*it);
                        } else
                                // we did not find a non-ert version
                                output_ert_inset(os, command, context);
@@ -3305,14 +3317,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                output_ert_inset(os, command, context);
                }
 
-               else if (t.cs() == "textvertline" ) {
-                       // this TIPA character does not occur in
-                       // unicodesymbols because it is in the ASCII range
-                       context.check_layout(os);
-                       os << "|";
-                       skip_braces(p);
-               }
-
                else if (t.cs() == "phantom" || t.cs() == "hphantom" ||
                             t.cs() == "vphantom") {
                        context.check_layout(os);
@@ -4476,7 +4480,20 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        begin_inset(os, "Flex ");
                        os << to_utf8(newinsetlayout->name()) << '\n'
                           << "status collapsed\n";
-                       parse_text_in_inset(p, os, FLAG_ITEM, false, context, newinsetlayout);
+                       if (newinsetlayout->isPassThru()) {
+                               // set catcodes to verbatim early, just in case.
+                               p.setCatcodes(VERBATIM_CATCODES);
+                               string delim = p.get_token().asInput();
+                               if (delim != "{")
+                                       cerr << "Warning: bad delimiter for command " << t.asInput() << endl;
+                               string const arg = p.verbatimStuff("}");
+                               Context newcontext(true, context.textclass);
+                               if (newinsetlayout->forcePlainLayout())
+                                       newcontext.layout = &context.textclass.plainLayout();
+                               output_ert(os, arg, newcontext);
+                       } else
+                               
+                               parse_text_in_inset(p, os, FLAG_ITEM, false, context, newinsetlayout);
                        end_inset(os);
                }