def revert_nomentbl(document):
"""Revert nomentbl inset to ERT."""
- i = find_token(document.header, "\\use_nomentbl", 0)
+ # intermediate format
+ i = find_token(document.header, "\\nomencl_options", 0)
if i == -1:
- document.warning("Malformed document! Missing \\use_nomentbl")
- return
- if get_value(document.header, "\\use_nomentbl", i) == 0:
- # just remove header
- del document.header[i]
+ # nothing to do
return
+ opts = get_value(document.header, "\\nomencl_options", i)
# remove header
del document.header[i]
+ # store options
+ document.append_local_layout([r"### Inserted by lyx2lyx (nomencl) ###",
+ r"PackageOptions nomencl %s" % opts])
+
+ if opts.find("nomentbl") == -1:
+ return
+
# revert insets to ERT
have_nomencl = False
i = 0
document.body[i : j + 1] = res
i += 1
-
- if have_nomencl:
- document.append_local_layout([r"### Inserted by lyx2lyx (nomencl) ###",
- r"PackageOptions nomencl nomentbl"])
##
params().biblatex_citestyle.erase();
params().multibib.erase();
params().lineno_opts.clear();
+ params().nomencl_opts.clear();
params().spellignore().clear();
for (int i = 0; i < 4; ++i) {
use_formatted_ref = false;
use_minted = false;
use_lineno = false;
- use_nomentbl = false;
// map current author
author_map_[pimpl_->authorlist.get(0).bufferId()] = 0;
lex >> use_formatted_ref;
} else if (token == "\\use_minted") {
lex >> use_minted;
- } else if (token == "\\use_nomentbl") {
- lex >> use_nomentbl;
+ } else if (token == "\\nomencl_options") {
+ lex.eatLine();
+ nomencl_opts = trim(lex.getString());
} else if (token == "\\use_lineno") {
lex >> use_lineno;
} else if (token == "\\lineno_options") {
<< "\n\\use_refstyle " << use_refstyle
<< "\n\\use_formatted_ref " << use_formatted_ref
<< "\n\\use_minted " << use_minted
- << "\n\\use_nomentbl " << use_nomentbl
<< "\n\\use_lineno " << use_lineno
<< '\n';
if (!lineno_opts.empty())
os << "\\lineno_options " << lineno_opts << '\n';
+ if (!nomencl_opts.empty())
+ os << "\\nomencl_options " << nomencl_opts << '\n';
+
if (isbackgroundcolor)
os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
if (isfontcolor)
bool use_lineno;
/// optional params for lineno package
std::string lineno_opts;
- /// use nomentbl nomenclature sty
- bool use_nomentbl;
+ /// options for nomencl package
+ std::string nomencl_opts;
/// Return true if language could be set to lang,
/// otherwise return false and do not change language
if (mustProvide("nomencl")) {
packages << "\\usepackage";
- if (params_.use_nomentbl)
- packages << "[nomentbl]";
+ if (!params_.nomencl_opts.empty())
+ packages << "[" << params_.nomencl_opts << "]";
packages << "{nomencl}\n";
// Make it work with the new and old version of the package,
// but don't use the compatibility option since it is
indexOptionsLE->clear();
}
- pos = (params.use_nomentbl) ? 1 : 0;
+ pos = (contains(params.nomencl_opts, "nomentbl")) ? 1 : 0;
nomenclStyleCO->setCurrentIndex(pos);
updateView();
params.use_indices = multipleIndicesCB->isChecked();
params.indiceslist() = indiceslist_;
- params.use_nomentbl = nomenclStyleCO->currentIndex() == 1;
+ if (nomenclStyleCO->currentIndex() == 1)
+ params.nomencl_opts = "nomentbl";
string const index_command =
fromqstr(indexCO->itemData(
docstring InsetNomencl::layoutName() const
{
- return (buffer().params().use_nomentbl) ?
+ return (contains(buffer().params().nomencl_opts, "nomentbl")) ?
from_ascii("Nomenclature:nomentbl")
: from_ascii("Nomenclature");
}
h_use_lineno = "false";
h_use_refstyle = false;
h_use_minted = false;
- h_use_nomentbl = false;
h_use_packages["amsmath"] = "1";
h_use_packages["amssymb"] = "0";
h_use_packages["cancel"] = "0";
}
else if (name == "nomencl") {
- vector<string>::iterator it =
- find(options.begin(), options.end(), "nomentbl");
- if (it != options.end()) {
- h_use_nomentbl = true;
- options.erase(it);
- }
- // Add the package options to the global document options
- if (!options.empty()) {
- if (h_options.empty())
- h_options = join(options, ",");
- else
- h_options += ',' + join(options, ",");
- }
+ h_nomencl_options = join(options, ",");
+ options.clear();
}
else if (name == "geometry")
<< "\\justification " << h_justification << '\n'
<< "\\use_refstyle " << h_use_refstyle << '\n'
<< "\\use_minted " << h_use_minted << '\n'
- << "\\use_nomentbl " << h_use_nomentbl << '\n'
<< "\\use_lineno " << h_use_lineno << '\n';
if (!h_lineno_options.empty())
os << "\\lineno_options " << h_lineno_options << '\n';
+ if (!h_nomencl_options.empty())
+ os << "\\nomencl_options " << h_nomencl_options << '\n';
if (!h_fontcolor.empty())
os << "\\fontcolor " << h_fontcolor << '\n';
if (!h_notefontcolor.empty())
///
bool minted() const { return h_use_minted; }
///
- bool nomentbl() const { return h_use_nomentbl; }
+ std::string nomenclOpts() const { return h_nomencl_options; }
/// The document language
std::string docLanguage() const { return h_language; }
/// The language of text which is not explicitly marked
std::vector<std::string> h_includeonlys;
bool h_use_refstyle;
bool h_use_minted;
- bool h_use_nomentbl;
+ std::string h_nomencl_options;
/*!
* Add package \p name with options \p options to used_packages.
set<string> pass_thru_cmds = context.pass_thru_cmds;
// These commands have special meanings in Nomenclature
context.pass_thru_cmds.insert("%");
- if (preamble.nomentbl())
+ if (contains(preamble.nomenclOpts(), "nomentbl"))
parse_text_in_inset(p, os, FLAG_ITEM, outer, context, "Nomenclature:nomentbl");
else
parse_text_in_inset(p, os, FLAG_ITEM, outer, context, "Nomenclature");