From fed60b70691670a0f5e30cf9bd02f39ec44b9536 Mon Sep 17 00:00:00 2001 From: jgrizou Date: Wed, 12 Jun 2013 19:20:45 +0200 Subject: [PATCH] Author search by last name: ugly. --- papers/commands/list_cmd.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/papers/commands/list_cmd.py b/papers/commands/list_cmd.py index 2930c64..26f33e2 100644 --- a/papers/commands/list_cmd.py +++ b/papers/commands/list_cmd.py @@ -36,9 +36,17 @@ def test_paper(tests, p): field = tmp[0] value = tmp[1] - if field == 'labels': + if field in ['labels', 'l', 'tags', 't']: if value not in p.metadata['labels']: return False + elif field in ['authors', 'a']: # that is the very ugly + if not 'author' in p.bibentry.persons: + return False + a = False + for p in p.bibentry.persons['author']: + if value in p.last()[0]: + a = True + return a else: if field in p.bibentry.fields: if value not in p.bibentry.fields[field]: