From 2b5818b78329ac0992bf148c64f39e94a47fb69f Mon Sep 17 00:00:00 2001 From: Steve Mao Date: Tue, 10 May 2016 22:46:43 +1000 Subject: [PATCH] feat(template): use context.repoUrl --- templates/commit.hbs | 55 ++++++++++++++++++++++++++------------------ templates/header.hbs | 19 +++++++++------ test/test.js | 2 +- 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/templates/commit.hbs b/templates/commit.hbs index 803e2c7..9eb8a04 100644 --- a/templates/commit.hbs +++ b/templates/commit.hbs @@ -5,16 +5,20 @@ {{~header}} {{~/if}} -{{~!-- commit link --}} -{{~#if @root.linkReferences~}} +{{~!-- commit link --}} {{#if @root.linkReferences~}} ([{{hash}}]( - {{~#if @root.host}} - {{~@root.host}}/ - {{~/if}} - {{~#if @root.owner}} - {{~@root.owner}}/ - {{~/if}} - {{~@root.repository}}/{{@root.commit}}/{{hash}})) + {{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} + {{~else}} + {{~@root.repoUrl}} + {{~/if}}/ + {{~@root.commit}}/{{hash}})) {{~else}} {{~hash}} {{~/if}} @@ -22,26 +26,31 @@ {{~!-- commit references --}} {{~#if references~}} , closes - {{~#each references}} {{#if @root.linkReferences}}[ + {{~#each references}} {{#if @root.linkReferences~}} + [ {{~#if this.owner}} {{~this.owner}}/ {{~/if}} {{~this.repository}}#{{this.issue}}]( - {{~#if @root.host}} - {{~@root.host}}/ - {{~/if}} - {{~#if this.repository}} - {{~#if this.owner}} - {{~this.owner}}/ + {{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ {{~/if}} - {{~this.repository}} + {{~#if this.repository}} + {{~#if this.owner}} + {{~this.owner}}/ + {{~/if}} + {{~this.repository}} + {{~else}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} + {{~/if}} {{~else}} - {{~#if @root.owner}} - {{~@root.owner}}/ - {{~/if}} - {{~@root.repository}} - {{~/if~}} - /{{@root.issue}}/{{this.issue}}) + {{~@root.repoUrl}} + {{~/if}}/ + {{~@root.issue}}/{{this.issue}}) {{~else}} {{~#if this.owner}} {{~this.owner}}/ diff --git a/templates/header.hbs b/templates/header.hbs index e0c2dca..313fd65 100644 --- a/templates/header.hbs +++ b/templates/header.hbs @@ -5,13 +5,18 @@ # {{~/if}} {{#if @root.linkCompare~}} [{{version}}]( - {{~#if @root.host}} - {{~@root.host}}/ - {{~/if}} - {{~#if @root.owner}} - {{~@root.owner}}/ - {{~/if}} - {{~@root.repository}}/compare/{{previousTag}}...{{currentTag}}) + {{~#if @root.repository~}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} + {{~else}} + {{~@root.repoUrl}} + {{~/if~}} + /compare/{{previousTag}}...{{currentTag}}) {{~else}} {{~version}} {{~/if}} diff --git a/test/test.js b/test/test.js index 9423594..c5ede27 100644 --- a/test/test.js +++ b/test/test.js @@ -155,7 +155,7 @@ describe('angular preset', function() { config: preset, pkg: { path: __dirname + '/fixtures/_unknown-host.json' - }, + } }) .on('error', function(err) { done(err);