From 573fa4b98cd650d1e2417fd34f11744da0cea911 Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 26 Aug 2018 17:02:43 -0700 Subject: Linkify ids in git branch names --- lib/render.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/render.js') diff --git a/lib/render.js b/lib/render.js index e6da13c..32085e4 100644 --- a/lib/render.js +++ b/lib/render.js @@ -192,10 +192,13 @@ Render.prototype.formatSize = function (size) { return size.toFixed(2) + ' MB' } -Render.prototype.linkify = function (text) { +Render.prototype.linkify = function (text, opts) { + var ellipsis = opts && opts.ellipsis var arr = text.split(u.ssbRefEncRegex) for (var i = 1; i < arr.length; i += 2) { - arr[i] = h('a', {href: this.toUrlEnc(arr[i])}, arr[i]) + var id = arr[i] + var text = ellipsis && id.length > 8 ? id.substr(0, 8) + '…' : id + arr[i] = h('a', {href: this.toUrlEnc(id)}, text) } return arr } -- cgit v1.2.3