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 | |
| 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
| -rw-r--r-- | BibTeX.py | 10 | ||||
| -rw-r--r-- | config.py | 3 |
2 files changed, 11 insertions, 2 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): @@ -6,7 +6,8 @@ _KEYS = [ "ALPHABETIZE_AUTHOR_AS","AUTHOR_URLS","CACHE_DIR","CACHE_SECTIONS", "COLLAPSE_AUTHORS", "DOWNLOAD_CONNECT_TIMEOUT","INITIAL_STRINGS", "MASTER_BIB", "NO_COLLAPSE_AUTHORS", "OMIT_ENTRIES", - "OUTPUT_DIR", "TEMPLATE_FILE", "BIBTEX_TEMPLATE_FILE" ] + "OUTPUT_DIR", "TEMPLATE_FILE", "BIBTEX_TEMPLATE_FILE", + "REQUIRE_KEY" ] for _k in _KEYS: globals()[_k]=None |
