ModuleMap modules;
-bool addModule(string const module, LayoutFile const & baseClass, LayoutModuleList & m, vector<string> & visited)
+bool addModule(string const & module, LayoutFile const & baseClass, LayoutModuleList & m, vector<string> & visited)
{
// avoid endless loop for circular dependency
vector<string>::const_iterator const vb = visited.begin();
// modeled after TeX.
// Unknown tokens are just silently ignored, this helps us to skip some
// reLyX specific things.
- Parser p(is);
+ Parser p(is, string());
while (p.good()) {
Token const & t = p.get_token();
if (t.cat() == catEscape) {
string documentclass;
string default_encoding;
+bool fixed_encoding = false;
string syntaxfile;
bool copy_files = false;
bool overwrite_files = false;
int parse_help(string const &, string const &)
{
- cerr << "Usage: tex2lyx [options] infile.tex [outfile.lyx]\n"
+ cout << "Usage: tex2lyx [options] infile.tex [outfile.lyx]\n"
"Options:\n"
"\t-c textclass Declare the textclass.\n"
"\t-m mod1[,mod2...] Load the given modules.\n"
"\t-copyfiles Copy all included files to the directory of outfile.lyx.\n"
"\t-e encoding Set the default encoding (latex name).\n"
+ "\t-fixedenc encoding Like -e, but ignore encoding changing commands while parsing.\n"
"\t-f Force overwrite of .lyx files.\n"
"\t-help Print this message and quit.\n"
"\t-n translate literate programming (noweb, sweave,... ) file.\n"
int parse_version(string const &, string const &)
{
- lyxerr << "tex2lyx " << lyx_version
- << " (" << lyx_release_date << ")" << endl;
- lyxerr << "Built on " << __DATE__ << ", " << __TIME__ << endl;
+ cout << "tex2lyx " << lyx_version
+ << " (" << lyx_release_date << ")" << endl;
+ cout << "Built on " << lyx_build_date << ", " << lyx_build_time
+ << endl;
- lyxerr << lyx_version_info << endl;
+ cout << lyx_version_info << endl;
exit(error_code);
}
}
+int parse_fixed_encoding(string const & arg, string const &)
+{
+ if (arg.empty())
+ error_message("Missing encoding string after -fixedenc switch");
+ default_encoding = arg;
+ fixed_encoding = true;
+ return 1;
+}
+
+
int parse_syntaxfile(string const & arg, string const &)
{
if (arg.empty())
cmdmap["-c"] = parse_class;
cmdmap["-m"] = parse_module;
cmdmap["-e"] = parse_encoding;
+ cmdmap["-fixedenc"] = parse_fixed_encoding;
cmdmap["-f"] = parse_force;
cmdmap["-s"] = parse_syntaxfile;
cmdmap["-n"] = parse_noweb;
}
+string fixedEncoding()
+{
+ if (fixed_encoding)
+ return default_encoding;
+ return "";
+}
+
+
namespace {
/*!
}
}
- Parser p(is);
+ Parser p(is, fixed_encoding ? default_encoding : string());
p.setEncoding(encoding);
//p.dump();