Angus Leeming wrote:
> Cæsar is dead; let him lie!

OK. I'm not interested in tyrants anyway.

> Why don't we do it as natbib does it. (How does it deal with entries that
> have neither an author/editor nor a year?)

Natbib tries to be clever here: if there's no author, the key field is used 
instead. So all possibilities are in theorie possible without author and 
year:

key (o.J.) etc.
(see natbib doc p. 10)

Therefore we should allow this too.
Here is my proposal.

Thanks,
Juergen.
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.163
diff -u -r1.163 ChangeLog
--- src/frontends/controllers/ChangeLog	2002/04/24 10:00:38	1.163
+++ src/frontends/controllers/ChangeLog	2002/04/26 13:30:36
@@ -1,3 +1,8 @@
+2002-04-26  Juergen Spitzmueller  <[EMAIL PROTECTED]>
+
+	* biblio.C (getAbbreviatedAuthor, getYear): Julius might be dead, but we
+	need support if author or year field is empty. Implement this.
+
 2002-04-22  Angus Leeming  <[EMAIL PROTECTED]>

 	* biblio.C (getAbbreviatedAuthor, getYear): Cæsar is dead. RIP; he was
Index: src/frontends/controllers/biblio.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/controllers/biblio.C,v
retrieving revision 1.24
diff -u -r1.24 biblio.C
--- src/frontends/controllers/biblio.C	2002/04/24 10:00:39	1.24
+++ src/frontends/controllers/biblio.C	2002/04/26 13:30:37
@@ -214,6 +214,9 @@
 		else if (authors.size() > 2)
 			author += _(" et al.");
 	}
+	
+	if (author.empty())
+		author = _("No author");
 
 	return author;
 }
@@ -247,6 +250,10 @@
 	}
 
 	string year = parseBibTeX(it->second, "year");
+	
+	if (year.empty())
+		year = _("No year");
+
 	return year;
 }
 
@@ -558,8 +565,6 @@
 
 	string const author = getAbbreviatedAuthor(map, key);
 	string const year   = getYear(map, key);
-	if (author.empty() || year.empty())
-		return vector<string>();
 
 	vector<string> vec(styles.size());
 	for (vector<string>::size_type i = 0; i != vec.size(); ++i) {
@@ -613,8 +618,6 @@
 
 	string const author = getAbbreviatedAuthor(map, key);
 	string const year   = getYear(map, key);
-	if (author.empty() || year.empty())
-		return vector<string>();
 
 	vector<string> vec(styles.size());
 	for (vector<string>::size_type i = 0; i != vec.size(); ++i) {

Reply via email to