The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit fe5a4c8c81ef2e5dca844732c7f24545b5edaca9
Author: Uwe Stöhr <uwesto...@lyx.org>
Date:   Sat Jul 7 13:37:26 2012 +0200

    tex2lyx: improve CJK handling
    
    - tex2lyx/text.cpp:
     - fix bug that swallowed valid braces
     - the encoding is "Bg5" not "BIG5"
     - add and update comments
    
    - CJK.tex: add an example for the Bg5 encoding

diff --git a/src/tex2lyx/test/CJK.tex b/src/tex2lyx/test/CJK.tex
index 49ee35f..b469b89 100644
--- a/src/tex2lyx/test/CJK.tex
+++ b/src/tex2lyx/test/CJK.tex
@@ -18,6 +18,10 @@ hello
 Chinese simplified \end{CJK}\begin{CJK}{EUC-JP}{hei} Japanese \end{CJK} 
\begin{CJK}{GB}{}Chinese simplified
 \end{CJK}
 
+\begin{CJK}{Bg5}{}
+Big5 文鼎楷書
+\end{CJK}
+
 \inputencoding{latin9}%
 \selectlanguage{english}%
 English
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 0d1a3d0..62d5e8d 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -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 {

-----------------------------------------------------------------------

Summary of changes:
 src/tex2lyx/test/CJK.tex |    4 ++++
 src/tex2lyx/text.cpp     |   10 ++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to