]> git.lyx.org Git - features.git/commitdiff
Fix #10778 (issue with CJK and language nesting)
authorEnrico Forestieri <forenr@lyx.org>
Wed, 8 Nov 2017 07:44:00 +0000 (08:44 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Wed, 8 Nov 2017 07:44:00 +0000 (08:44 +0100)
When using CJK, don't try to close a language that was never
opened before, such as when it is the main language.

src/Paragraph.cpp
src/output_latex.cpp
src/output_latex.h
status.22x

index 48d0e1737f4a471c8a3a9a967f1ae6aa4a7f15be..3a9dd6ee2726c1b564c969e47156b1400ec74782 100644 (file)
@@ -2486,6 +2486,7 @@ void Paragraph::latex(BufferParams const & bparams,
                bool const using_begin_end = runparams.use_polyglossia ||
                                                !lang_end_command.empty();
                if (!running_lang.empty() &&
+                   (!using_begin_end || running_lang == openLanguageName()) &&
                    font.language()->encoding()->package() == Encoding::CJK) {
                                string end_tag = subst(lang_end_command,
                                                        "$$lang",
index eac0a93f52987fa7e693215c5e86caf5ab4ae177..5e49456929aa4f1588979bb35194cf2e83e11bb0 100644 (file)
@@ -527,6 +527,14 @@ void popLanguageName()
 }
 
 
+string const & openLanguageName()
+{
+       OutputState * state = getOutputState();
+
+       return openLanguageName(state);
+}
+
+
 void latexArgInsets(Paragraph const & par, otexstream & os,
        OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs, string const & prefix)
 {
index 61a9354f6c9dea2599b5f7eaa00383fdb22b8aec..fd3e805fe09f4ffb89c6bde2912437c1c3093ac0 100644 (file)
@@ -39,6 +39,13 @@ void pushLanguageName(std::string const & lang, bool localswitch = false);
  */
 void popLanguageName();
 
+/** Return a reference to the last active language opened with
+    polyglossia or when using begin/end commands. If none or when
+    using babel with only a begin command, return a reference to
+    an empty string.
+ */
+std::string const & openLanguageName();
+
 /** Export optional and required arguments of the paragraph \p par.
     Non-existing required arguments are output empty: {}.
  */
index 0f1e6e56688ef40006ba5c83abf79f9b1e4d97c2..a25c7cfb802b08fcf1224c760585a6cbad83b9c1 100644 (file)
@@ -71,6 +71,8 @@ What's new
   (2013ff.) instead of vietnam.ldf that was shipped with vntex previously
   (bug 10743).
 
+- Fix issue with language nesting when using Asian languages (bug 10778).
+
 
 * LYX2LYX