|
|
|
@ -40,7 +40,7 @@ def parser(subparsers, conf):
|
|
|
|
|
return parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def many_from_path(ui, bibpath, ignore=False):
|
|
|
|
|
def many_from_path(ui, bibpath, bibfield_excludes=[], ignore=False):
|
|
|
|
|
"""Extract list of papers found in bibliographic files in path.
|
|
|
|
|
|
|
|
|
|
The behavior is to:
|
|
|
|
@ -62,7 +62,13 @@ def many_from_path(ui, bibpath, ignore=False):
|
|
|
|
|
biblist = []
|
|
|
|
|
for filepath in all_files:
|
|
|
|
|
try:
|
|
|
|
|
biblist.append(coder.decode_bibdata(read_text_file(filepath)))
|
|
|
|
|
bibentry = coder.decode_bibdata(read_text_file(filepath))
|
|
|
|
|
# exclude bibtex fields if specified
|
|
|
|
|
for item in bibentry.values():
|
|
|
|
|
for field in bibfield_excludes:
|
|
|
|
|
if field in item:
|
|
|
|
|
del item[field]
|
|
|
|
|
biblist.append(bibentry)
|
|
|
|
|
except coder.BibDecodingError:
|
|
|
|
|
error = "Could not parse bibtex at {}.".format(filepath)
|
|
|
|
|
if ignore:
|
|
|
|
@ -100,7 +106,9 @@ def command(conf, args):
|
|
|
|
|
|
|
|
|
|
rp = repo.Repository(conf)
|
|
|
|
|
# Extract papers from bib
|
|
|
|
|
papers = many_from_path(ui, bibpath, ignore=args.ignore_malformed)
|
|
|
|
|
papers = many_from_path(ui, bibpath,
|
|
|
|
|
bibfield_excludes=conf['main']['bibtex_field_excludes'],
|
|
|
|
|
ignore=args.ignore_malformed)
|
|
|
|
|
keys = args.keys or papers.keys()
|
|
|
|
|
for k in keys:
|
|
|
|
|
p = papers[k]
|
|
|
|
|