]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.cpp
tex2lyx: improve CJK handling
[lyx.git] / src / tex2lyx / text.cpp
index cebc6fbf4013b670b3d794e054d07d33e1ae508b..62d5e8df9ebfaf80c6d3458a94bf37d5ffdba6af 100644 (file)
@@ -119,6 +119,9 @@ char const * const known_coded_ref_commands[] = { "ref", "pageref", "vref",
 
 /**
  * supported CJK encodings
+ * SJIS anf Bg5 cannot be supported as this is not
+ * supported by iconv
+ * JIS does not work with LyX's encoding conversion
  */
 const char * const supported_CJK_encodings[] = {
 "EUC-JP", "KS", "GB", "UTF8", 0};
@@ -1428,9 +1431,9 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                // store the encoding to be able to reset it
                string const encoding_old = p.getEncoding();
                string const encoding = p.getArg('{', '}');
-               // SJIS and BIG5 don't work with LaTeX according to the comment in unicode.cpp
+               // SJIS and Bg5 cammopt be handled by iconv
                // JIS does not work with LyX's encoding conversion
-               if (encoding != "SJIS" && encoding != "BIG5" && encoding != "JIS")
+               if (encoding != "Bg5" && encoding != "JIS" && encoding != "SJIS")
                        p.setEncoding(encoding);
                else
                        p.setEncoding("utf8");
@@ -1442,7 +1445,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                        parent_context.check_layout(os);
                        handle_ert(os, "\\begin{" + name + "}{" + encoding + "}{" + mapping + "}",
                                       parent_context);
-                       // we must parse the content as verbatim because e.g. SJIS can contain
+                       // we must parse the content as verbatim because e.g. JIS can contain
                        // normally invalid characters
                        string const s = p.plainEnvironment("CJK");
                        for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
@@ -1453,7 +1456,6 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                                else 
                                        os << *it;
                        }
-                       p.skip_spaces();
                        handle_ert(os, "\\end{" + name + "}",
                                       parent_context);
                } else {
@@ -3909,7 +3911,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                arg += p.getFullOpt();
                                eat_whitespace(p, os, context, false);
                                handle_ert(os, arg + '{', context);
-                               eat_whitespace(p, os, context, false);
                                parse_text(p, os, FLAG_ITEM, outer, context);
                                handle_ert(os, "}", context);
                        } else {
@@ -3922,7 +3923,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                else {
                                        eat_whitespace(p, os, context, false);
                                        handle_ert(os, "\\framebox{", context);
-                                       eat_whitespace(p, os, context, false);
                                        parse_text(p, os, FLAG_ITEM, outer, context);
                                        handle_ert(os, "}", context);
                                }
@@ -3939,7 +3939,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                arg += p.getFullOpt();
                                eat_whitespace(p, os, context, false);
                                handle_ert(os, arg + '{', context);
-                               eat_whitespace(p, os, context, false);
                                parse_text(p, os, FLAG_ITEM, outer, context);
                                handle_ert(os, "}", context);
                        } else