Support for \nocite* from Berhard Reiter. Increments file format to 210.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22327 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-12-28 16:56:57 +00:00
parent 636b655216
commit a229a78dff
6 changed files with 75 additions and 24 deletions

View File

@ -1,6 +1,9 @@
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

View File

@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
("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():

View File

@ -998,6 +998,33 @@ def revert_nocite(document):
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
@ -1086,10 +1113,12 @@ convert = [[277, [fix_wrong_tables]],
[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]],

View File

@ -118,7 +118,7 @@ namespace os = support::os;
namespace {
int const LYX_FORMAT = 309; // Bernhard Reiter: support for \nocite
int const LYX_FORMAT = 310; // Bernhard Reiter: support for \nocite{*}
} // namespace anon

View File

@ -270,15 +270,20 @@ void GuiBibtex::updateContents()
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();
@ -334,26 +339,35 @@ void GuiBibtex::applyView()
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();
}

View File

@ -297,6 +297,11 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os,
}
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;
}