tex2lyx/preamble.cpp: - code simplification: don't evaluate synonym languages at three different places. Do this right before writing the LyX file header; no status entry necessary

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@32863 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-01-07 23:36:10 +00:00
parent 97037fba02
commit 233dc0ac1b

View File

@ -314,24 +314,6 @@ void handle_package(Parser &p, string const & name, string const & opts,
// last language in the documentclass options is used.
handle_opt(options, known_languages, h_language);
delete_opt(options, known_languages);
if (is_known(h_language, known_brazilian_languages))
h_language = "brazilian";
else if (is_known(h_language, known_french_languages))
h_language = "french";
else if (is_known(h_language, known_german_languages))
h_language = "german";
else if (is_known(h_language, known_ngerman_languages))
h_language = "ngerman";
else if (is_known(h_language, known_portuguese_languages))
h_language = "portuguese";
else if (is_known(h_language, known_russian_languages))
h_language = "russian";
else if (is_known(h_language, known_ukrainian_languages))
h_language = "ukrainian";
h_quotes_language = h_language;
// there is only the quotes language "german"
if (h_quotes_language == "ngerman")
h_quotes_language = "german";
}
else if (name == "fontenc")
@ -388,28 +370,8 @@ void handle_package(Parser &p, string const & name, string const & opts,
; // Ignore this, the geometry settings are made by the \geometry
// command. This command is handled below.
else if (is_known(name, known_languages)) {
if (is_known(h_language, known_brazilian_languages))
h_language = "brazilian";
else if (is_known(name, known_french_languages))
h_language = "french";
else if (is_known(name, known_german_languages))
h_language = "german";
else if (is_known(name, known_ngerman_languages))
h_language = "ngerman";
else if (is_known(h_language, known_portuguese_languages))
h_language = "portuguese";
else if (is_known(name, known_russian_languages))
h_language = "russian";
else if (is_known(name, known_ukrainian_languages))
h_language = "ukrainian";
else
h_language = name;
h_quotes_language = h_language;
// there is only the quotes language "german"
if (h_quotes_language == "ngerman")
h_quotes_language = "german";
}
else if (is_known(name, known_languages))
h_language = name;
else if (name == "natbib") {
h_cite_engine = "natbib_authoryear";
@ -452,7 +414,21 @@ void handle_package(Parser &p, string const & name, string const & opts,
void end_preamble(ostream & os, TextClass const & /*textclass*/)
{
// output the LyX file settings
// merge synonym languages
if (is_known(h_language, known_brazilian_languages))
h_language = "brazilian";
else if (is_known(h_language, known_french_languages))
h_language = "french";
else if (is_known(h_language, known_german_languages))
h_language = "german";
else if (is_known(h_language, known_ngerman_languages))
h_language = "ngerman";
else if (is_known(h_language, known_portuguese_languages))
h_language = "portuguese";
else if (is_known(h_language, known_russian_languages))
h_language = "russian";
else if (is_known(h_language, known_ukrainian_languages))
h_language = "ukrainian";
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
<< "\\lyxformat 264\n"
<< "\\begin_document\n"
@ -655,21 +631,7 @@ void parse_preamble(Parser & p, ostream & os,
// options.
handle_opt(opts, known_languages, h_language);
delete_opt(opts, known_languages);
if (is_known(h_language, known_brazilian_languages))
h_language = "brazilian";
else if (is_known(h_language, known_french_languages))
h_language = "french";
else if (is_known(h_language, known_german_languages))
h_language = "german";
else if (is_known(h_language, known_ngerman_languages))
h_language = "ngerman";
else if (is_known(h_language, known_portuguese_languages))
h_language = "portuguese";
else if (is_known(h_language, known_russian_languages))
h_language = "russian";
else if (is_known(h_language, known_ukrainian_languages))
h_language = "ukrainian";
h_quotes_language = h_language;
// paper orientation
if ((it = find(opts.begin(), opts.end(), "landscape")) != opts.end()) {
h_paperorientation = "landscape";