mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
some bib fixes from Herbert
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4154 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
13462e25c3
commit
ed8a3124f3
@ -1,3 +1,11 @@
|
||||
2002-05-13 Herbert Voss <voss@perce.de>
|
||||
|
||||
* biblio.C (getAbbreviatedAuthor): fix bug with "and" for Authors
|
||||
like "Odland, G. and ... "
|
||||
(parseBibTeX): fix bug with title and booktitle
|
||||
and replace a \n with a space when one entry has more than
|
||||
one line
|
||||
|
||||
2002-05-01 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ControlCharacter.C: use "ignore" and "reset" as the identifiers, not
|
||||
|
@ -205,7 +205,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
|
||||
return author;
|
||||
}
|
||||
|
||||
vector<string> authors = getVectorFromString(author, "and");
|
||||
vector<string> authors = getVectorFromString(author, " and");
|
||||
|
||||
if (!authors.empty()) {
|
||||
author.erase();
|
||||
@ -379,24 +379,32 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
string keyvalue;
|
||||
// at first we delete all characters right of '%' and
|
||||
// replace tabs through a space and remove leading spaces
|
||||
// we read the data line by line so that the \n are
|
||||
// ignored, too.
|
||||
string data_;
|
||||
int Entries = 0;
|
||||
string dummy = token(data,'\n', Entries);
|
||||
while (!dummy.empty()) {
|
||||
dummy = subst(dummy, '\t', ' '); // no tabs
|
||||
dummy = frontStrip(dummy); // no leading spaces
|
||||
dummy = frontStrip(dummy); // no leading spaces
|
||||
// ignore lines with a beginning '%' or ignore all right of %
|
||||
string::size_type const idx =
|
||||
dummy.empty() ? string::npos : dummy.find('%');
|
||||
if (idx != string::npos) {
|
||||
// ignore lines with a beginning '%'
|
||||
if (idx > 0) {
|
||||
data_ += dummy.substr(0,data.find('%'));
|
||||
}
|
||||
} else {
|
||||
data_ += dummy;
|
||||
if (idx != string::npos)
|
||||
dummy.erase(idx, string::npos);
|
||||
// do we have a new token or a new line of
|
||||
// the same one? In the first case we ignore
|
||||
// the \n and in the second we replace it
|
||||
// with a space
|
||||
if (!dummy.empty()) {
|
||||
if (!contains(dummy, "="))
|
||||
data_ += (' ' + dummy);
|
||||
else
|
||||
data_ += dummy;
|
||||
}
|
||||
dummy = token(data, '\n', ++Entries);
|
||||
}
|
||||
|
||||
// replace double commas with "" for easy scanning
|
||||
data = subst(data_, ",,", "\"\"");
|
||||
|
||||
@ -409,9 +417,18 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
data += ','; // now we have same behaviour for all entries
|
||||
// because the last one is "blah ... }"
|
||||
Entries = 0;
|
||||
dummy = token(data, ',', Entries);
|
||||
while (!contains(lowercase(dummy), findkey) && !dummy.empty())
|
||||
dummy = token(data, ',', ++Entries);
|
||||
bool found = false;
|
||||
// parsing of title and booktitle is different from the
|
||||
// others, because booktitle contains title
|
||||
do {
|
||||
dummy = token(data, ',', Entries++);
|
||||
if (!dummy.empty()) {
|
||||
found = contains(lowercase(dummy), findkey);
|
||||
if (findkey == "title" &&
|
||||
contains(lowercase(dummy), "booktitle"))
|
||||
found = false;
|
||||
}
|
||||
} while (!found && !dummy.empty());
|
||||
if (dummy.empty())
|
||||
// no such keyword
|
||||
return string();
|
||||
@ -421,10 +438,10 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
// Therefore we read all until the next "=" character, which follows a
|
||||
// new keyword
|
||||
keyvalue = dummy;
|
||||
dummy = token(data, ',', ++Entries);
|
||||
dummy = token(data, ',', Entries++);
|
||||
while (!contains(dummy, '=') && !dummy.empty()) {
|
||||
keyvalue += (',' + dummy);
|
||||
dummy = token(data, ',', ++Entries);
|
||||
dummy = token(data, ',', Entries++);
|
||||
}
|
||||
|
||||
// replace double "" with originals ,, (two commas)
|
||||
|
Loading…
Reference in New Issue
Block a user