]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.cpp
* doxy
[lyx.git] / src / tex2lyx / text.cpp
index 558462e593075e43d7bb0298eb75e8b0c9aac9f3..b70e1e4686b0787906bbf64c94b4e809a252c774 100644 (file)
@@ -1121,8 +1121,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                Context & context)
 {
        Layout const * newlayout = 0;
-       // store the current selectlanguage to be used after \foreignlanguage
-       string selectlang;
        // Store the latest bibliographystyle (needed for bibtex inset)
        string bibliographystyle;
        bool const use_natbib = used_packages.find("natbib") != used_packages.end();
@@ -1484,9 +1482,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                                else
                                                        simple = false;
                                        } else
-                                               paramtext += p.get_token().asString();
+                                               paramtext += p.get_token().cs();
                                } else {
-                                       paramtext += p.get_token().asString();
+                                       paramtext += p.get_token().cs();
                                        simple = false;
                                }
                        }
@@ -1573,11 +1571,16 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                else if (t.cs() == "caption") {
+                       // FIXME: this should get some cleanup. All
+                       // the \begin_layout:s are output by the
+                       // Context class!
                        p.skip_spaces();
                        context.check_layout(os);
                        p.skip_spaces();
                        begin_inset(os, "Caption\n\n");
-                       os << "\\begin_layout Standard";
+                       os << "\\begin_layout " 
+                          << to_utf8(context.textclass.defaultLayout().name()) 
+                          << '\n';
                        if (p.next_token().character() == '[') {
                                p.get_token(); // eat '['
                                begin_inset(os, "OptArg\n");
@@ -1811,7 +1814,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
 
                else if (t.cs() == "listof") {
                        p.skip_spaces(true);
-                       string const name = p.get_token().asString();
+                       string const name = p.get_token().cs();
                        if (context.textclass.floats().typeExist(name)) {
                                context.check_layout(os);
                                begin_inset(os, "FloatList ");
@@ -2210,10 +2213,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        // save the language for the case that a
                        // \foreignlanguage is used 
 
-                       //FIXME: this is wrong, the language should
-                       // be saved in the context. (JMarc)
-                       selectlang = subst(p.verbatim_item(), "\n", " ");
-                       os << "\\lang " << selectlang << "\n";
+                       context.font.language = subst(p.verbatim_item(), "\n", " ");
+                       os << "\\lang " << context.font.language << "\n";
                }
 
                else if (t.cs() == "foreignlanguage") {
@@ -2224,7 +2225,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        // has to be parsed (like for \textsf, for
                        // example). 
                        // set back to last selectlanguage
-                       os << "\n\\lang " << selectlang << "\n";
+                       os << "\n\\lang " << context.font.language << "\n";
                }
 
                else if (t.cs() == "inputencoding") {