]> 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 8e8fadd6ed1848b5c952a022fe1128e71dd6fc20..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;
@@ -406,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();
                }
 
@@ -415,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") {
@@ -472,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, ",") << '}';
                        }
                }
 
@@ -482,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();
@@ -502,3 +509,6 @@ LyXTextClass const parse_preamble(Parser & p, ostream & os, string const & force
 }
 
 // }])
+
+
+} // namespace lyx