mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
preamble.cpp: simplify code and reintroduce code that was accidentally deleted in previous commit
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32449 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
64ede202fa
commit
a831919c0c
@ -318,27 +318,18 @@ void handle_package(Parser &p, string const & name, string const & opts,
|
|||||||
delete_opt(options, known_languages);
|
delete_opt(options, known_languages);
|
||||||
if (is_known(h_language, known_brazilian_languages))
|
if (is_known(h_language, known_brazilian_languages))
|
||||||
h_language = "brazilian";
|
h_language = "brazilian";
|
||||||
else if (is_known(h_language, known_french_languages)) {
|
else if (is_known(h_language, known_french_languages))
|
||||||
h_language = "french";
|
h_language = "french";
|
||||||
h_quotes_language = "french";
|
else if (is_known(h_language, known_german_languages))
|
||||||
} else if (is_known(h_language, known_german_languages)) {
|
|
||||||
h_language = "german";
|
h_language = "german";
|
||||||
h_quotes_language = "german";
|
else if (is_known(h_language, known_ngerman_languages))
|
||||||
} else if (is_known(h_language, known_ngerman_languages)) {
|
|
||||||
h_language = "ngerman";
|
h_language = "ngerman";
|
||||||
h_quotes_language = "german";
|
else if (is_known(h_language, known_portuguese_languages))
|
||||||
} else if (is_known(h_language, known_portuguese_languages))
|
|
||||||
h_language = "portuguese";
|
h_language = "portuguese";
|
||||||
else if (is_known(h_language, known_russian_languages))
|
else if (is_known(h_language, known_russian_languages))
|
||||||
h_language = "russian";
|
h_language = "russian";
|
||||||
else if (is_known(h_language, known_ukrainian_languages))
|
else if (is_known(h_language, known_ukrainian_languages))
|
||||||
h_language = "ukrainian";
|
h_language = "ukrainian";
|
||||||
// LyX only knows the following quotes languages:
|
|
||||||
// english, swedish, german, polish, french and danish
|
|
||||||
// french and german are already handled, english is the default
|
|
||||||
if (h_language == "swedish" || h_language == "polish"
|
|
||||||
|| h_language == "danish")
|
|
||||||
h_quotes_language = h_language;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "fontenc")
|
else if (name == "fontenc")
|
||||||
@ -406,25 +397,18 @@ void handle_package(Parser &p, string const & name, string const & opts,
|
|||||||
h_language = "brazilian";
|
h_language = "brazilian";
|
||||||
else if (is_known(name, known_french_languages))
|
else if (is_known(name, known_french_languages))
|
||||||
h_language = "french";
|
h_language = "french";
|
||||||
h_quotes_language = "french";
|
else if (is_known(name, known_german_languages))
|
||||||
} else if (is_known(name, known_german_languages)) {
|
|
||||||
h_language = "german";
|
h_language = "german";
|
||||||
h_quotes_language = "german";
|
else if (is_known(name, known_ngerman_languages))
|
||||||
} else if (is_known(name, known_ngerman_languages)) {
|
|
||||||
h_language = "ngerman";
|
h_language = "ngerman";
|
||||||
h_quotes_language = "german";
|
else if (is_known(name, known_portuguese_languages))
|
||||||
} else if (is_known(name, known_portuguese_languages))
|
|
||||||
h_language = "portuguese";
|
h_language = "portuguese";
|
||||||
else if (is_known(name, known_russian_languages))
|
else if (is_known(name, known_russian_languages))
|
||||||
h_language = "russian";
|
h_language = "russian";
|
||||||
else if (is_known(name, known_ukrainian_languages))
|
else if (is_known(name, known_ukrainian_languages))
|
||||||
h_language = "ukrainian";
|
h_language = "ukrainian";
|
||||||
// LyX only knows the following quotes languages:
|
else
|
||||||
// english, swedish, german, polish, french and danish
|
h_language = name;
|
||||||
// french and german are already handled, english is the default
|
|
||||||
if (name == "swedish" || name == "polish"
|
|
||||||
|| name == "danish")
|
|
||||||
h_quotes_language = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "natbib") {
|
else if (name == "natbib") {
|
||||||
@ -468,6 +452,22 @@ void handle_package(Parser &p, string const & name, string const & opts,
|
|||||||
|
|
||||||
void end_preamble(ostream & os, TextClass const & /*textclass*/)
|
void end_preamble(ostream & os, TextClass const & /*textclass*/)
|
||||||
{
|
{
|
||||||
|
// set the quote language here to avoid that this is done in
|
||||||
|
// 3 different places in this file where h_language is set.
|
||||||
|
// LyX only knows the following quotes languages:
|
||||||
|
// english, swedish, german, polish, french and danish
|
||||||
|
// english is already set as default
|
||||||
|
// FIXME: for a real solution we need a list what languages use
|
||||||
|
// what quote style
|
||||||
|
if (h_language == "swedish" || h_language == "german"
|
||||||
|
|| h_language == "polish" || h_language == "french"
|
||||||
|
|| h_language == "danish")
|
||||||
|
h_quotes_language = h_language;
|
||||||
|
// there is only the quotes language "german"
|
||||||
|
if (h_language == "ngerman")
|
||||||
|
h_quotes_language = "german";
|
||||||
|
|
||||||
|
// output the LyX file settings
|
||||||
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
|
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
|
||||||
<< "\\lyxformat 264\n"
|
<< "\\lyxformat 264\n"
|
||||||
<< "\\begin_document\n"
|
<< "\\begin_document\n"
|
||||||
@ -668,27 +668,18 @@ void parse_preamble(Parser & p, ostream & os,
|
|||||||
delete_opt(opts, known_languages);
|
delete_opt(opts, known_languages);
|
||||||
if (is_known(h_language, known_brazilian_languages))
|
if (is_known(h_language, known_brazilian_languages))
|
||||||
h_language = "brazilian";
|
h_language = "brazilian";
|
||||||
else if (is_known(h_language, known_french_languages)) {
|
else if (is_known(h_language, known_french_languages))
|
||||||
h_language = "french";
|
h_language = "french";
|
||||||
h_quotes_language = "french";
|
else if (is_known(h_language, known_german_languages))
|
||||||
} else if (is_known(h_language, known_german_languages)) {
|
|
||||||
h_language = "german";
|
h_language = "german";
|
||||||
h_quotes_language = "german";
|
else if (is_known(h_language, known_ngerman_languages))
|
||||||
} else if (is_known(h_language, known_ngerman_languages)) {
|
|
||||||
h_language = "ngerman";
|
h_language = "ngerman";
|
||||||
h_quotes_language = "german";
|
else if (is_known(h_language, known_portuguese_languages))
|
||||||
} else if (is_known(h_language, known_portuguese_languages))
|
|
||||||
h_language = "portuguese";
|
h_language = "portuguese";
|
||||||
else if (is_known(h_language, known_russian_languages))
|
else if (is_known(h_language, known_russian_languages))
|
||||||
h_language = "russian";
|
h_language = "russian";
|
||||||
else if (is_known(h_language, known_ukrainian_languages))
|
else if (is_known(h_language, known_ukrainian_languages))
|
||||||
h_language = "ukrainian";
|
h_language = "ukrainian";
|
||||||
// LyX only knows the following quotes languages:
|
|
||||||
// english, swedish, german, polish, french and danish
|
|
||||||
// french and german are already handled, english is the default
|
|
||||||
if (h_language == "swedish" || h_language == "polish"
|
|
||||||
|| h_language == "danish")
|
|
||||||
h_quotes_language = h_language;
|
|
||||||
// paper orientation
|
// paper orientation
|
||||||
if ((it = find(opts.begin(), opts.end(), "landscape")) != opts.end()) {
|
if ((it = find(opts.begin(), opts.end(), "landscape")) != opts.end()) {
|
||||||
h_paperorientation = "landscape";
|
h_paperorientation = "landscape";
|
||||||
|
Loading…
Reference in New Issue
Block a user