]> git.lyx.org Git - features.git/commitdiff
tex2lyx: Fix import of Arabic polyglossia environment
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 24 Aug 2018 12:20:43 +0000 (14:20 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 9 Sep 2018 17:05:53 +0000 (19:05 +0200)
Part of #10111

(cherry picked from commit 920e26916e760f9196270d1e19d9486412f2fb1e)

src/tex2lyx/text.cpp
status.23x

index f89e5a91acaab18553464cf3abe3c9a312d2de43..d79ad8aba2db1b1b4c007c9d4353c04e3311b9e9 100644 (file)
@@ -528,6 +528,17 @@ string guessQuoteStyle(string in, bool const opening)
 }
 
 
+string const fromPolyglossiaEnvironment(string const s)
+{
+       // Since \arabic is taken by the LaTeX kernel,
+       // the Arabic polyglossia environment is upcased
+       if (s == "Arabic")
+               return "arabic";
+       else
+               return s;
+}
+
+
 } // namespace
 
 
@@ -1597,7 +1608,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                }
        }
 
-       else if (is_known(name, preamble.polyglossia_languages)) {
+       // We need to use fromPolyglossiaEnvironment die to Arabic > arabic
+       else if (is_known(fromPolyglossiaEnvironment(name), preamble.polyglossia_languages)) {
                // We must begin a new paragraph if not already done
                if (! parent_context.atParagraphStart()) {
                        parent_context.check_end_layout(os);
@@ -1605,7 +1617,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                }
                // save the language in the context so that it is
                // handled by parse_text
-               parent_context.font.language = preamble.polyglossia2lyx(name);
+               parent_context.font.language =
+                       preamble.polyglossia2lyx(fromPolyglossiaEnvironment(name));
                parse_text(p, os, FLAG_END, outer, parent_context);
                // Just in case the environment is empty
                parent_context.extra_stuff.erase();
@@ -3324,7 +3337,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        continue;
                }
 
-
                // Starred section headings
                // Must attempt to parse "Section*" before "Section".
                if ((p.next_token().asInput() == "*") &&
index 4844c19a743a069997b4eac916e6da6fbaba38a2..bfeef26b1446d6cbf6cee0e5b00092da6e22c5bb 100644 (file)
@@ -96,9 +96,10 @@ What's new
 
 * TEX2LYX
 
--  Consider required modules when checking for layout definitions in modules
-   (bug 11156).
+- Consider required modules when checking for layout definitions in modules
+  (bug 11156).
 
+- Fix import of Arabic polyglossia environment (part of  bug 10111).
 
 
 * ADVANCED FIND AND REPLACE