]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/tex2lyx.C
hopefully fix tex2lyx linking.
[lyx.git] / src / tex2lyx / tex2lyx.C
index 09dcf7cbbcf35c7678056ef9b73df038005e3d31..1175754ec2241028ddfc34dfb500f9ffc0bd4261 100644 (file)
@@ -25,6 +25,7 @@
 #include "support/lyxlib.h"
 #include "support/os.h"
 #include "support/package.h"
+#include "support/unicode.h"
 
 #include <boost/function.hpp>
 #include <boost/filesystem/operations.hpp>
@@ -38,6 +39,9 @@
 #include <vector>
 #include <map>
 
+
+namespace lyx {
+
 using std::endl;
 using std::cout;
 using std::cerr;
@@ -63,6 +67,13 @@ using lyx::support::isFileReadable;
 namespace fs = boost::filesystem;
 
 
+IconvProcessor & utf8ToUcs4()
+{
+       static IconvProcessor iconv(ucs4_codeset, "UTF-8");
+       return iconv;
+}
+
+
 // Hacks to allow the thing to link in the lyxlayout stuff
 LyXErr lyxerr(std::cerr.rdbuf());
 
@@ -161,6 +172,9 @@ void add_known_command(string const & command, string const & o1,
 }
 
 
+bool noweb_mode = false;
+
+
 namespace {
 
 
@@ -275,6 +289,7 @@ int parse_help(string const &, string const &)
                "\t-userdir dir       try to set user directory to dir\n"
                "\t-sysdir dir        try to set system directory to dir\n"
                "\t-c textclass       declare the textclass\n"
+               "\t-n                 translate a noweb (aka literate programming) file.\n"
                "\t-s syntaxfile      read additional syntax file" << endl;
        exit(0);
 }
@@ -337,6 +352,13 @@ int parse_force(string const &, string const &)
 }
 
 
+int parse_noweb(string const &, string const &)
+{
+       noweb_mode = true;
+       return 0;
+}
+
+
 void easyParse(int & argc, char * argv[])
 {
        map<string, cmd_helper> cmdmap;
@@ -346,6 +368,7 @@ void easyParse(int & argc, char * argv[])
        cmdmap["-s"] = parse_syntaxfile;
        cmdmap["-help"] = parse_help;
        cmdmap["--help"] = parse_help;
+       cmdmap["-n"] = parse_noweb;
        cmdmap["-sysdir"] = parse_sysdir;
        cmdmap["-userdir"] = parse_userdir;
 
@@ -478,9 +501,12 @@ bool tex2lyx(string const &infilename, string const &outfilename)
        return tex2lyx(infilename, os);
 }
 
+} // namespace lyx
+
 
 int main(int argc, char * argv[])
 {
+       using namespace lyx;
        fs::path::default_name_check(fs::no_check);
 
        easyParse(argc, argv);