From 94e6dccac910d4074a8052434e4fab8a76880118 Mon Sep 17 00:00:00 2001 From: "Fabien C. Y. Benureau" Date: Tue, 28 Aug 2018 17:20:29 +0900 Subject: [PATCH] doc extension visible in pubs list --- pubs/pretty.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pubs/pretty.py b/pubs/pretty.py index 9e8c82c..10de342 100644 --- a/pubs/pretty.py +++ b/pubs/pretty.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals +import os import re from . import color @@ -64,8 +65,12 @@ def paper_oneliner(p, citekey_only=False): return p.citekey else: bibdesc = bib_oneliner(p.bibdata) - tags = '' if len(p.tags) == 0 else '| {}'.format( + doc_str = '' + if p.docpath is not None: + doc_str = color.dye_out(' [{}]'.format(os.path.splitext(p.docpath)[1][1:]), + 'tag') + tags = '' if len(p.tags) == 0 else ' | {}'.format( ','.join(color.dye_out(t, 'tag') for t in sorted(p.tags))) - return '[{citekey}] {descr} {tags}'.format( + return '[{citekey}] {descr}{doc}{tags}'.format( citekey=color.dye_out(p.citekey, 'citekey'), - descr=bibdesc, tags=tags) + descr=bibdesc, tags=tags, doc=doc_str)