AuthorList authorlist;
BranchList branchlist;
+ WordLangTable spellignore;
Bullet temp_bullets[4];
Bullet user_defined_bullets[4];
IndicesList indiceslist;
fontcolor = lyx::rgbFromHexName("#000000");
isfontcolor = false;
// light gray is the default font color for greyed-out notes
- isnotefontcolor = false;
notefontcolor = lyx::rgbFromHexName("#cccccc");
+ isnotefontcolor = false;
boxbgcolor = lyx::rgbFromHexName("#ff0000");
+ isboxbgcolor = false;
compressed = lyxrc.save_compressed;
for (int iter = 0; iter < 4; ++iter) {
user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
html_math_img_scale = 1.0;
html_css_as_file = false;
docbook_table_output = HTMLTable;
+ docbook_mathml_prefix = MPrefix;
display_pixel_ratio = 1.0;
shell_escape = false;
}
+WordLangTable & BufferParams::spellignore()
+{
+ return pimpl_->spellignore;
+}
+
+
+WordLangTable const & BufferParams::spellignore() const
+{
+ return pimpl_->spellignore;
+}
+
+
+bool BufferParams::spellignored(WordLangTuple const & wl) const
+{
+ bool has_item = false;
+ vector<WordLangTuple> il = spellignore();
+ vector<WordLangTuple>::const_iterator it = il.begin();
+ for (; it != il.end(); ++it) {
+ if (it->lang()->code() != wl.lang()->code())
+ continue;
+ if (it->word() == wl.word()) {
+ has_item = true;
+ break;
+ }
+ }
+ return has_item;
+}
+
+
Bullet & BufferParams::temp_bullet(lyx::size_type const index)
{
LASSERT(index < 4, return pimpl_->temp_bullets[0]);
string BufferParams::readToken(Lexer & lex, string const & token,
- FileName const & filepath)
+ FileName const & filename)
{
string result;
+ FileName const & filepath = filename.onlyPath();
if (token == "\\textclass") {
lex.next();
color = lcolor.getX11HexName(Color_background);
// FIXME UNICODE
if (!shortcut.empty())
- lcolor.setColor(to_utf8(shortcut), color);
+ lcolor.setColor(to_utf8(shortcut)+ "@" + filename.absFileName(), color);
}
}
+ } else if (token == "\\spellchecker_ignore") {
+ lex.eatLine();
+ docstring wl = lex.getDocString();
+ docstring language;
+ docstring word = split(wl, language, ' ');
+ Language const * lang = languages.getLanguage(to_ascii(language));
+ if (lang)
+ spellignore().push_back(WordLangTuple(word, lang));
} else if (token == "\\author") {
lex.eatLine();
istringstream ss(lex.getString());
notefontcolor = lyx::rgbFromHexName(color);
lcolor.setColor("notefontcolor", color);
lcolor.setLaTeXName("notefontcolor", "note_fontcolor");
+ lcolor.setGUIName("notefontcolor", N_("greyedout inset text"));
+ // set a local name for the painter
+ lcolor.setColor("notefontcolor@" + filename.absFileName(), color);
isnotefontcolor = true;
} else if (token == "\\boxbgcolor") {
lex.eatLine();
string color = lex.getString();
boxbgcolor = lyx::rgbFromHexName(color);
- lcolor.setColor("boxbgcolor", color);
+ lcolor.setColor("boxbgcolor@" + filename.absFileName(), color);
+ isboxbgcolor = true;
} else if (token == "\\paperwidth") {
lex >> paperwidth;
} else if (token == "\\paperheight") {
int temp;
lex >> temp;
docbook_table_output = static_cast<TableOutput>(temp);
+ } else if (token == "\\docbook_mathml_prefix") {
+ int temp;
+ lex >> temp;
+ docbook_mathml_prefix = static_cast<MathMLNameSpacePrefix>(temp);
} else if (token == "\\output_sync") {
lex >> output_sync;
} else if (token == "\\output_sync_macro") {
os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
if (isnotefontcolor)
os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
- if (boxbgcolor != lyx::rgbFromHexName("#ff0000"))
+ if (isboxbgcolor)
os << "\\boxbgcolor " << lyx::X11hexname(boxbgcolor) << '\n';
for (auto const & br : branchlist()) {
<< "\n";
}
+ for (auto const & si : spellignore()) {
+ os << "\\spellchecker_ignore " << si.lang()->lang()
+ << " " << to_utf8(si.word())
+ << "\n";
+ }
+
if (!paperwidth.empty())
os << "\\paperwidth "
<< VSpace(paperwidth).asLyXCommand() << '\n';
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
os << "\\docbook_table_output " << docbook_table_output << '\n';
+ os << "\\docbook_mathml_prefix " << docbook_mathml_prefix << '\n';
if (html_math_img_scale != 1.0)
os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n';
}
-string const BufferParams::bibtexCommand() const
+string const BufferParams::getBibtexCommand(string const cmd, bool const warn) const
+{
+ // split from options
+ string command_in;
+ split(cmd, command_in, ' ');
+
+ // Look if the requested command is available. If so, use that.
+ for (auto const & alts : lyxrc.bibtex_alternatives) {
+ string command_prov;
+ split(alts, command_prov, ' ');
+ if (command_in == command_prov)
+ return cmd;
+ }
+
+ // If not, find the most suitable fallback for the current cite framework,
+ // and warn. Note that we omit options in any such case.
+ string fallback;
+ if (useBiblatex()) {
+ // For Biblatex, we prefer biber (also for Japanese)
+ // and try to fall back to bibtex8
+ if (lyxrc.bibtex_alternatives.find("biber") != lyxrc.bibtex_alternatives.end())
+ fallback = "biber";
+ else if (lyxrc.bibtex_alternatives.find("bibtex8") != lyxrc.bibtex_alternatives.end())
+ fallback = "bibtex8";
+ }
+ // For classic BibTeX and as last resort for biblatex, try bibtex
+ if (fallback.empty()) {
+ if (lyxrc.bibtex_alternatives.find("bibtex") != lyxrc.bibtex_alternatives.end())
+ fallback = "bibtex";
+ }
+
+ if (!warn)
+ return fallback;
+
+ if (fallback.empty()) {
+ frontend::Alert::warning(
+ _("No bibliography processor found!"),
+ support::bformat(
+ _("The bibliography processor requested by this document "
+ "(%1$s) is not available and no appropriate "
+ "alternative has been found. "
+ "No bibliography and references will be generated.\n"
+ "Please fix your installation!"),
+ from_utf8(cmd)));
+ } else {
+ frontend::Alert::warning(
+ _("Requested bibliography processor not found!"),
+ support::bformat(
+ _("The bibliography processor requested by this document "
+ "(%1$s) is not available. "
+ "As a fallback, '%2$s' will be used, options are omitted. "
+ "This might result in errors or unwanted changes in "
+ "the bibliography. Please check carefully!\n"
+ "It is suggested to install the missing processor."),
+ from_utf8(cmd), from_utf8(fallback)));
+ }
+ return fallback;
+}
+
+
+string const BufferParams::bibtexCommand(bool const warn) const
{
// Return document-specific setting if available
if (bibtex_command != "default")
- return bibtex_command;
+ return getBibtexCommand(bibtex_command, warn);
// If we have "default" in document settings, consult the prefs
// 1. Japanese (uses a specific processor)
// 2. All other languages
else if (lyxrc.bibtex_command != "automatic")
// Return the specified program, if "automatic" is not set
- return lyxrc.bibtex_command;
+ return getBibtexCommand(lyxrc.bibtex_command, warn);
// 3. Automatic: find the most suitable for the current cite framework
if (useBiblatex()) {