Skip to content

Commit

Permalink
[#708] Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes authored and amercader committed Apr 19, 2013
1 parent f048c67 commit e16816a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ckan/lib/helpers.py
Expand Up @@ -1395,19 +1395,19 @@ def html_auto_link(data):
group:... converted to a group link
http://... converted to a link
'''

LINK_FNS = {
'tag': tag_link,
'group': group_link,
'dataset': dataset_link,
'package': dataset_link,
}

def makelink(matchobj):
obj = matchobj.group(1)
name = matchobj.group(2)
title = '%s:%s' % (obj, name)
if obj == 'tag':
return tag_link({'name': name.strip('"'),
'title': title})
elif obj == 'group':
return group_link({'name': name,
'title': title})
elif obj in ['dataset', 'package']:
return dataset_link({'name': name,
'title': title})
return LINK_FNS[obj]({'name': name.strip('"'), 'title': title})

def link(matchobj):
return '<a href="%s" target="_blank" rel="nofollow">%s</a>' \
Expand Down

0 comments on commit e16816a

Please sign in to comment.