LyX file-format changes
-----------------------
+2007-12-28 Bernhard Reiter <ockham@gmx.net>
+ * Format incremented to 310: support for \nocite{*}
+
2007-12-11 Bernhard Reiter <ockham@gmx.net>
* Format incremented to 309: support for \nocite
("1_3", [221], minor_versions("1.3" , 7)),
("1_4", range(222,246), minor_versions("1.4" , 5)),
("1_5", range(246,277), minor_versions("1.5" , 2)),
- ("1_6", range(277,310), minor_versions("1.6" , 0))] # Bernhard Reiter: nocite
+ ("1_6", range(277,311), minor_versions("1.6" , 0))] # Bernhard Reiter: \nocite{*}
def formats_list():
i = j
+def revert_btprintall(document):
+ "Revert (non-bibtopic) btPrintAll option to ERT \nocite{*}"
+ i = find_token(document.header, '\\use_bibtopic', 0)
+ if i == -1:
+ document.warning("Malformed lyx document: Missing '\\use_bibtopic'.")
+ return
+ if get_value(document.header, '\\use_bibtopic', 0) == "false":
+ i = 0
+ while i < len(document.body):
+ i = find_token(document.body, "\\begin_inset CommandInset bibtex", i)
+ if i == -1:
+ return
+ j = find_end_of_inset(document.body, i + 1)
+ if j == -1:
+ #this should not happen
+ document.warning("End of CommandInset bibtex not found in revert_btprintall!")
+ j = len(document.body)
+ for k in range(i, j):
+ if (document.body[k] == 'btprint "btPrintAll"'):
+ del document.body[k]
+ document.body.insert(i, "\\begin_inset ERT\n" \
+ "status collapsed\n\n\\begin_layout Standard\n\n" \
+ "\\backslash\nnocite{*}\n" \
+ "\\end_layout\n\\end_inset\n")
+ i = j
+
+
def revert_bahasam(document):
"Set language Bahasa Malaysia to Bahasa Indonesia"
i = 0
[306, []],
[307, []],
[308, []],
- [309, []]
+ [309, []],
+ [310, []]
]
-revert = [[308, [revert_nocite]],
+revert = [[309, [revert_btprintall]],
+ [308, [revert_nocite]],
[307, [revert_serbianlatin]],
[306, [revert_slash, revert_nobreakdash]],
[305, [revert_interlingua]],
namespace {
-int const LYX_FORMAT = 309; // Bernhard Reiter: support for \nocite
+int const LYX_FORMAT = 310; // Bernhard Reiter: support for \nocite{*}
} // namespace anon
bibtocCB->setChecked(bibtotoc() && !bibtopic);
bibtocCB->setEnabled(!bibtopic);
+ if (!bibtopic && btPrintCO->count() == 3)
+ btPrintCO->removeItem(1);
+ else if (bibtopic && btPrintCO->count() < 3)
+ btPrintCO->insertItem(1, qt_("all uncited references", 0));
+
docstring btprint = params_["btprint"];
int btp = 0;
- if (btprint == "btPrintNotCited")
+ if ((bibtopic && btprint == "btPrintNotCited") ||
+ (!bibtopic && btprint == "btPrintAll"))
btp = 1;
- else if (btprint == "btPrintAll")
+ else if (bibtopic && btprint == "btPrintAll")
btp = 2;
btPrintCO->setCurrentIndex(btp);
- btPrintCO->setEnabled(bibtopic);
styleCB->clear();
params_["options"] = bibstyle;
}
- // bibtopic allows three kinds of sections:
- // 1. sections that include all cited references of the database(s)
- // 2. sections that include all uncited references of the database(s)
- // 3. sections that include all references of the database(s), cited or not
int btp = btPrintCO->currentIndex();
- switch (btp) {
- case 0:
- params_["btprint"] = from_ascii("btPrintCited");
- break;
- case 1:
- params_["btprint"] = from_ascii("btPrintNotCited");
- break;
- case 2:
- params_["btprint"] = from_ascii("btPrintAll");
- break;
+ if (usingBibtopic()) {
+ // bibtopic allows three kinds of sections:
+ // 1. sections that include all cited references of the database(s)
+ // 2. sections that include all uncited references of the database(s)
+ // 3. sections that include all references of the database(s), cited or not
+ switch (btp) {
+ case 0:
+ params_["btprint"] = from_ascii("btPrintCited");
+ break;
+ case 1:
+ params_["btprint"] = from_ascii("btPrintNotCited");
+ break;
+ case 2:
+ params_["btprint"] = from_ascii("btPrintAll");
+ break;
+ }
+ } else {
+ switch (btp) {
+ case 0:
+ params_["btprint"] = docstring();
+ break;
+ case 1:
+ // use \nocite{*}
+ params_["btprint"] = from_ascii("btPrintAll");
+ break;
+ }
}
-
- if (!usingBibtopic())
- params_["btprint"] = docstring();
}
}
if (!db_out.empty() && !buffer.params().use_bibtopic){
+ docstring btprint = getParam("btprint");
+ if (btprint == "btPrintAll") {
+ os << "\\nocite{*}\n";
+ nlines += 1;
+ }
os << "\\bibliography{" << db_out << "}\n";
nlines += 1;
}