mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
(Herbert): fix parsing of bibtex entry bug.
(Henry Pfister): also fixes bug in loading bibtex database. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3999 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
36c21f7712
commit
143f71f691
@ -1,3 +1,8 @@
|
||||
2002-04-15 Herbert Voss <voss@perce.de>
|
||||
|
||||
* biblio.[Ch] (parseBibTeX): fix bug while scanning bibtexentries
|
||||
with something like ,,...blah...`` (two commas)
|
||||
|
||||
2002-04-14 Herbert Voss <voss@perce.de>
|
||||
|
||||
* helper_funcs.[Ch]: move the getVectorFromString and the vice versa
|
||||
|
@ -355,7 +355,8 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
}
|
||||
dummy = token(data, '\n', ++Entries);
|
||||
}
|
||||
data = data_;
|
||||
// replace double commas with "" for easy scanning
|
||||
data = subst(data_, ",,", "\"\"");
|
||||
|
||||
// unlikely!
|
||||
if (data.empty())
|
||||
@ -370,9 +371,12 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
while (!contains(lowercase(dummy), findkey) && !dummy.empty())
|
||||
dummy = token(data, ',', ++Entries);
|
||||
if (dummy.empty())
|
||||
return string(); // no such keyword
|
||||
// we are not sure, if we get all, because "key= "blah, blah" is allowed.
|
||||
// therefore we read all until the next "=" character, which follows a
|
||||
// no such keyword
|
||||
return string();
|
||||
|
||||
// we are not sure, if we get all, because "key= "blah, blah" is
|
||||
// allowed.
|
||||
// Therefore we read all until the next "=" character, which follows a
|
||||
// new keyword
|
||||
keyvalue = dummy;
|
||||
dummy = token(data, ',', ++Entries);
|
||||
@ -380,10 +384,17 @@ string const parseBibTeX(string data, string const & findkey)
|
||||
keyvalue += (',' + dummy);
|
||||
dummy = token(data, ',', ++Entries);
|
||||
}
|
||||
data = keyvalue; // now we have the important line
|
||||
data = strip(data, ' '); // all spaces
|
||||
if (!contains(data, '{')) // no opening '{'
|
||||
data = strip(data, '}');// maybe there is a main closing '}'
|
||||
|
||||
// replace double "" with originals ,, (two commas)
|
||||
// leaving us with the all-important line
|
||||
data = subst(keyvalue, "\"\"", ",,");
|
||||
|
||||
// Clean-up.
|
||||
// 1. Spaces
|
||||
data = strip(data, ' ');
|
||||
// 2. if there is no opening '{' then a closing '{' is probably cruft.
|
||||
if (!contains(data, '{'))
|
||||
data = strip(data, '}');
|
||||
// happens, when last keyword
|
||||
string::size_type const idx =
|
||||
!data.empty() ? data.find('=') : string::npos;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-04-16 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* insetbib.C (getKeys): strip leading '\t's from the line too.
|
||||
With thanks to Henry Pfister <hpfister@ucsd.edu>.
|
||||
|
||||
2002-04-12 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettext.h: added cix() helper function and use it where appropriate
|
||||
|
@ -264,6 +264,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
|
||||
&& !prefixIs(tmp, "@preamble")) {
|
||||
linebuf = split(linebuf, tmp, ',');
|
||||
tmp = frontStrip(tmp);
|
||||
tmp = frontStrip(tmp,'\t');
|
||||
if (!tmp.empty()) {
|
||||
keys.push_back(pair<string,string>(tmp,string()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user