diff options
| author | Nick Mathewson <nickm@torproject.org> | 2006-12-07 04:41:08 +0000 |
|---|---|---|
| committer | Nick Mathewson <nickm@torproject.org> | 2006-12-07 04:41:08 +0000 |
| commit | 9939c56195f2d132af48f162b34863e38fb69fe8 (patch) | |
| tree | 223c27bc4240996358d748b7318d32c722bead0d /BibTeX.py | |
| parent | 9f5034771ed2e5496f7b3d53718fd70a29424e7f (diff) | |
| download | anonbib-9939c56195f2d132af48f162b34863e38fb69fe8.tar.gz | |
r11440@Kushana: nickm | 2006-12-06 23:40:44 -0500
Add a REQUIRE_KEY option to the configuration. This way, we can build a "big bibliography" and a "selected readings" from one .bib file.
svn:r194
Diffstat (limited to 'BibTeX.py')
| -rw-r--r-- | BibTeX.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -84,8 +84,14 @@ class BibTeX: ent.entries.update(cr.entries) ent.resolve() newEntries = [] + rk = config.REQUIRE_KEY + if rk is None: + # hack: if no key is required, require "title", since every + # entry will have a title. + rk = "title" + for ent in self.entries: - if ent.type in config.OMIT_ENTRIES: + if ent.type in config.OMIT_ENTRIES or not ent.has_key(rk): del self.byKey[ent.key] else: newEntries.append(ent) @@ -258,6 +264,8 @@ class BibTeXEntry: self.entries = entries # Map from key to value. def get(self, k, v=None): return self.entries.get(k,v) + def has_key(self, k): + return self.entries.has_key(k) def __getitem__(self, k): return self.entries[k] def __setitem__(self, k, v): |
