- tex2lyx/text.cpp:

- bugfix for the parsing of polyglossia's paragraph environments
 - new support for polyglossia's language change commands \textxxx
- XeTeX-polyglossia.tex: add more testcases and add a missing \end
This commit is contained in:
Uwe Stöhr 2012-06-22 03:41:00 +02:00
parent c695e5fb38
commit aa9fed9322
2 changed files with 28 additions and 3 deletions

View File

@ -13,13 +13,13 @@
\part{df}
1
1 Coptic \textgreek{Greek} Coptic
\begin{albanian}%
\part{df}
2
2 Albanian \textgreek{Greek} Albanian
\end{albanian}%
\begin{divehi}%
@ -41,4 +41,10 @@
\part{df}
5
\end{divehi}%
%empty language paragraph
\begin{albanian}%
\end{albanian}%
\end{document}

View File

@ -1252,9 +1252,20 @@ void parse_environment(Parser & p, ostream & os, bool outer,
}
else if (is_known(name, polyglossia_languages)) {
parent_context.check_layout(os);
// We must begin a new paragraph if not already done
if (! parent_context.atParagraphStart()) {
parent_context.check_end_layout(os);
parent_context.new_paragraph(os);
}
// save the language for the case that a
// \textLANGUAGE is used
parent_context.font.language = polyglossia2lyx(name);
os << "\n\\lang " << parent_context.font.language << "\n";
parse_text(p, os, FLAG_END, outer, parent_context);
// Just in case the environment is empty
parent_context.extra_stuff.erase();
// We must begin a new paragraph to reset the language
parent_context.new_paragraph(os);
p.skip_spaces();
}
@ -3457,6 +3468,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
context, "\\lang",
context.font.language, lang);
}
else if (is_known(t.cs().substr(4, string::npos), polyglossia_languages)) {
// scheme is \textLANGUAGE{text} where LANGUAGE is in polyglossia_languages[]
string const lang = polyglossia2lyx(t.cs().substr(4, string::npos));
parse_text_attributes(p, os, FLAG_ITEM, outer,
context, "\\lang",
context.font.language, lang);
}
else if (t.cs() == "inputencoding") {
// nothing to write here