commit 920e26916e760f9196270d1e19d9486412f2fb1e
Author: Juergen Spitzmueller <[email protected]>
Date: Fri Aug 24 14:20:43 2018 +0200
tex2lyx: Fix import of Arabic polyglossia environment
Part of #10111
---
src/tex2lyx/text.cpp | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 919f454..ed86635 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -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
@@ -1602,7 +1613,8 @@ void parse_environment(Parser & p, ostream & os, bool
outer,
break;
}
- if (is_known(name, preamble.polyglossia_languages)) {
+ // We need to use fromPolyglossiaEnvironment die to Arabic >
arabic
+ 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);
@@ -1610,7 +1622,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();
@@ -3497,7 +3510,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() == "*") &&