]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.cpp
Fix typo.
[lyx.git] / src / tex2lyx / text.cpp
index a7c857f7a073807823d54de7ea4ad7818674dee1..eb88a9695810b32c9809eb5034eeffba54bafc91 100644 (file)
@@ -252,7 +252,7 @@ bool splitLatexLength(string const & len, string & value, string & unit)
 }
 
 
-/// A simple function to translate a latex length to something lyx can
+/// A simple function to translate a latex length to something LyX can
 /// understand. Not perfect, but rather best-effort.
 bool translate_len(string const & length, string & valstring, string & unit)
 {
@@ -354,7 +354,7 @@ void begin_inset(ostream & os, string const & name)
        os << "\n\\begin_inset " << name;
 }
 
-/*// use this voi when format 288 is supported
+/*// use this void when format 288 is supported
 void begin_command_inset(ostream & os, string const & name,
                                                 string const & latexname)
 {
@@ -645,7 +645,7 @@ void parse_box(Parser & p, ostream & os, unsigned flags, bool outer,
                parse_text_in_inset(p, os, flags, outer, parent_context);
                end_inset(os);
 #ifdef PRESERVE_LAYOUT
-               // lyx puts a % after the end of the minipage
+               // LyX puts a % after the end of the minipage
                if (p.next_token().cat() == catNewline && p.next_token().cs().size() > 1) {
                        // new paragraph
                        //handle_comment(os, "%dummy", parent_context);
@@ -1434,7 +1434,7 @@ 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]
+                                       // LyX does not support \item[\mybullet]
                                        // in itemize environments
                                        handle_ert(os, "[", context);
                                        os << s;
@@ -1453,8 +1453,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        context.check_layout(os);
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
-                       os << p.getOpt();
-                       os << "key " << '"' << p.verbatim_item() << '"' << "\n";
+                       os << "label \"" << p.getOptContent() << "\"\n";
+                       os << "key \"" << p.verbatim_item() << "\"\n";
                        end_inset(os);
                }
 
@@ -1573,11 +1573,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");
@@ -1928,7 +1933,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        context.check_layout(os);
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
-                       // lyx cannot handle newlines in a latex command
+                       // LyX cannot handle newlines in a latex command
                        // FIXME: Move the substitution into parser::getOpt()?
                        os << subst(p.getOpt(), "\n", " ");
                        os << "reference " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
@@ -2038,7 +2043,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
 
                else if (t.cs() == "cite") {
                        context.check_layout(os);
-                       // lyx cannot handle newlines in a latex command
+                       // LyX cannot handle newlines in a latex command
                        string after = subst(p.getOptContent(), "\n", " ");
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
@@ -2051,7 +2056,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        context.check_layout(os);
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
-                       // lyx cannot handle newlines in a latex command
+                       // LyX cannot handle newlines in a latex command
                        os << "name " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
                        end_inset(os);
                }
@@ -2060,7 +2065,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        context.check_layout(os);
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
-                       // lyx cannot handle newlines in a latex command
+                       // LyX cannot handle newlines in a latex command
                        string prefix = subst(p.getOptContent(), "\n", " ");
                        if (!prefix.empty())
                                os << "prefix " << '"' << prefix << '"' << "\n";
@@ -2073,7 +2078,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        context.check_layout(os);
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
-                       // lyx cannot handle newlines in a latex command
+                       // LyX cannot handle newlines in a latex command
                        os << "name " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
                        end_inset(os);
                }
@@ -2098,7 +2103,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        context.check_layout(os);
                        begin_inset(os, "LatexCommand ");
                        os << t.cs() << "\n";
-                       // lyx cannot handle newlines in a latex command
+                       // LyX cannot handle newlines in a latex command
                        os << "target " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n";
                        end_inset(os);
                }
@@ -2232,6 +2237,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        string const enc = subst(p.verbatim_item(), "\n", " ");
                        p.setEncoding(enc);
                }
+
                else if (t.cs() == "LyX" || t.cs() == "TeX"
                         || t.cs() == "LaTeX") {
                        context.check_layout(os);
@@ -2365,8 +2371,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        }
                }
 
-               else if (t.cs() == "newline" ||
-                       t.cs() == "linebreak") {
+               else if (t.cs() == "newline") {
                        context.check_layout(os);
                        os << "\n\\" << t.cs() << "\n";
                        skip_braces(p); // eat {}
@@ -2484,7 +2489,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                else if (t.cs() == "newpage" ||
-                       t.cs() == "pagebreak" ||
                        t.cs() == "clearpage" ||
                        t.cs() == "cleardoublepage") {
                        context.check_layout(os);