Skip to content

Commit

Permalink
Change candidates' attributes depending on fields like url, key, and …
Browse files Browse the repository at this point in the history
…key_inner
  • Loading branch information
DancingQuanta committed Jul 29, 2018
1 parent d14ddc7 commit 6785e63
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions rpython/python3/denite/source/citation.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,29 @@ def _gather_items(self, context):
else:
items = self._get_items(context)

if context['__field'] is 'key':
text = (self.vars['key_outer_prefix']
+ self.vars['key_inner_prefix']
+ '{}'
+ self.vars['key_suffix'])
elif context['__field'] is 'key_inner':
text = self.vars['key_inner_prefix'] + '{}'
else:
text = '{}'

if context['__field'] is 'url':
file_url = 'url'
else:
file_url = 'file'

# Retirn items
for item in items:
if (context['__collection'] is None
or context['__collection'] in item.collections):
candidate = {
"word" : item.describe(context),
"action__text": getattr(item, context['__field']),
"action__path": item.file,
"action__text": text.format(getattr(item, context['__field']),
"action__path": getattr(item, file_url),
"action__command": self._set_message(item.combined),
})
condidates.append(candidate)
Expand Down

0 comments on commit 6785e63

Please sign in to comment.