]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/preamble.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / tex2lyx / preamble.C
index 6a62d31aee067cbba7f16cda0d5a0f89a93d9de1..acb066814aeda319778ae5ee5000b572f1158ad8 100644 (file)
@@ -18,6 +18,7 @@
 #include "lyxtextclass.h"
 #include "lyxlex.h"
 #include "support/filetools.h"
+#include "support/lstrings.h"
 
 #include <algorithm>
 #include <iostream>
@@ -26,6 +27,9 @@
 #include <vector>
 #include <map>
 
+
+namespace lyx {
+
 using std::istringstream;
 using std::ostream;
 using std::ostringstream;
@@ -34,7 +38,8 @@ using std::vector;
 using std::cerr;
 using std::endl;
 
-using lyx::support::LibFileSearch;
+using support::FileName;
+using support::libFileSearch;
 
 // special columntypes
 extern std::map<char, int> special_columns;
@@ -82,7 +87,6 @@ string h_tocdepth                = "3";
 string h_paragraph_separation    = "indent";
 string h_defskip                 = "medskip";
 string h_quotes_language         = "english";
-string h_quotes_times            = "2";
 string h_papercolumns            = "1";
 string h_papersides              = string();
 string h_paperpagestyle          = "default";
@@ -233,7 +237,7 @@ void handle_package(string const & name, string const & opts)
 void end_preamble(ostream & os, LyXTextClass const & /*textclass*/)
 {
        os << "#LyX file created by  tex2lyx 0.1.2\n"
-          << "\\lyxformat 243\n"
+          << "\\lyxformat 245\n"
           << "\\begin_document\n"
           << "\\begin_header\n"
           << "\\textclass " << h_textclass << "\n"
@@ -257,7 +261,6 @@ void end_preamble(ostream & os, LyXTextClass const & /*textclass*/)
           << "\\paragraph_separation " << h_paragraph_separation << "\n"
           << "\\defskip " << h_defskip << "\n"
           << "\\quotes_language " << h_quotes_language << "\n"
-          << "\\quotes_times " << h_quotes_times << "\n"
           << "\\papercolumns " << h_papercolumns << "\n"
           << "\\papersides " << h_papersides << "\n"
           << "\\paperpagestyle " << h_paperpagestyle << "\n"
@@ -408,7 +411,8 @@ LyXTextClass const parse_preamble(Parser & p, ostream & os, string const & force
                        ss << '{' << p.verbatim_item() << '}';
                        ss << '{' << p.verbatim_item() << '}';
                        if (name != "lyxcode" && name != "lyxlist" &&
-                           name != "lyxrightadress" && name != "lyxaddress")
+                           name != "lyxrightadress" &&
+                           name != "lyxaddress" && name != "lyxgreyedout")
                                h_preamble << ss.str();
                }
 
@@ -417,7 +421,7 @@ LyXTextClass const parse_preamble(Parser & p, ostream & os, string const & force
                        while (p.next_token().cat() != catBegin)
                                name += p.get_token().asString();
                        h_preamble << "\\def\\" << name << '{'
-                                  << p.verbatim_item() << "}";
+                                  << p.verbatim_item() << "}";
                }
 
                else if (t.cs() == "newcolumntype") {
@@ -474,7 +478,7 @@ LyXTextClass const parse_preamble(Parser & p, ostream & os, string const & force
                        add_package("jurabib", jurabibsetup);
                        if (!jurabibsetup.empty()) {
                                h_preamble << "\\jurabibsetup{"
-                                          << join(jurabibsetup, ",") << '}';
+                                          << join(jurabibsetup, ",") << '}';
                        }
                }
 
@@ -484,16 +488,17 @@ LyXTextClass const parse_preamble(Parser & p, ostream & os, string const & force
        p.skip_spaces();
 
        // Force textclass if the user wanted it
-       if (!forceclass.empty()) {
+       if (!forceclass.empty())
                h_textclass = forceclass;
-       }
-       string layoutfilename = LibFileSearch("layouts", h_textclass, "layout");
+       if (noweb_mode && !lyx::support::prefixIs(h_textclass, "literate-"))
+               h_textclass.insert(0, "literate-");
+       FileName layoutfilename = libFileSearch("layouts", h_textclass, "layout");
        if (layoutfilename.empty()) {
                cerr << "Error: Could not find layout file for textclass \"" << h_textclass << "\"." << endl;
                exit(1);
        }
        LyXTextClass textclass;
-       textclass.Read(layoutfilename);
+       textclass.read(layoutfilename);
        if (h_papersides.empty()) {
                ostringstream ss;
                ss << textclass.sides();
@@ -504,3 +509,6 @@ LyXTextClass const parse_preamble(Parser & p, ostream & os, string const & force
 }
 
 // }])
+
+
+} // namespace lyx