mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
fix: npm squish and cell centering (#164)
* fix: npm squish and cell centering * readme * wip * wip * tests
This commit is contained in:
parent
e4b22f8cd7
commit
fdd6b74547
5 changed files with 11 additions and 11 deletions
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ Description
|
|||
These people contributed to the project:
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||
<!-- prettier-ignore -->
|
||||
<table cellspacing=\\"0\\" cellpadding=\\"1\\"><tr><td>Kent C. Dodds is awesome!</td><td>Divjot Singh is awesome!</td><td>Jeroen Engels is awesome!</td></tr></table>
|
||||
<table><tr><td align=\\"center\\">Kent C. Dodds is awesome!</td><td align=\\"center\\">Divjot Singh is awesome!</td><td align=\\"center\\">Jeroen Engels is awesome!</td></tr></table>
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
Thanks a lot everyone!"
|
||||
|
@ -24,7 +24,7 @@ Description
|
|||
These people contributed to the project:
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||
<!-- prettier-ignore -->
|
||||
<table cellspacing=\\"0\\" cellpadding=\\"1\\"><tr><td>Kent C. Dodds is awesome!</td><td>Kent C. Dodds is awesome!</td><td>Kent C. Dodds is awesome!</td><td>Kent C. Dodds is awesome!</td><td>Kent C. Dodds is awesome!</td></tr><tr><td>Kent C. Dodds is awesome!</td><td>Kent C. Dodds is awesome!</td></tr></table>
|
||||
<table><tr><td align=\\"center\\">Kent C. Dodds is awesome!</td><td align=\\"center\\">Kent C. Dodds is awesome!</td><td align=\\"center\\">Kent C. Dodds is awesome!</td><td align=\\"center\\">Kent C. Dodds is awesome!</td><td align=\\"center\\">Kent C. Dodds is awesome!</td></tr><tr><td align=\\"center\\">Kent C. Dodds is awesome!</td><td align=\\"center\\">Kent C. Dodds is awesome!</td></tr></table>
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
Thanks a lot everyone!"
|
||||
|
|
|
@ -20,7 +20,7 @@ test('format a simple contributor', () => {
|
|||
const {options} = fixtures()
|
||||
|
||||
const expected =
|
||||
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" height="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>'
|
||||
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>'
|
||||
|
||||
expect(formatContributor(options, contributor)).toBe(expected)
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ test('format contributor with complex contribution types', () => {
|
|||
const {options} = fixtures()
|
||||
|
||||
const expected =
|
||||
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" height="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a> <a href="#question-kentcdodds" title="Answering Questions">💬</a>'
|
||||
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a> <a href="#question-kentcdodds" title="Answering Questions">💬</a>'
|
||||
|
||||
expect(formatContributor(options, contributor)).toBe(expected)
|
||||
})
|
||||
|
@ -53,7 +53,7 @@ test('default image size to 100', () => {
|
|||
delete options.imageSize
|
||||
|
||||
const expected =
|
||||
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="100px;" height="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>'
|
||||
'<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>'
|
||||
|
||||
expect(formatContributor(options, contributor)).toBe(expected)
|
||||
})
|
||||
|
@ -63,7 +63,7 @@ test('format contributor with pipes in their name', () => {
|
|||
const {options} = fixtures()
|
||||
|
||||
const expected =
|
||||
'<a href="http://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" height="150px;" alt="Who | Needs | Pipes?"/><br /><sub><b>Who | Needs | Pipes?</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pipey" title="Documentation">📖</a>'
|
||||
'<a href="http://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Who | Needs | Pipes?"/><br /><sub><b>Who | Needs | Pipes?</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pipey" title="Documentation">📖</a>'
|
||||
|
||||
expect(formatContributor(options, contributor)).toBe(expected)
|
||||
})
|
||||
|
@ -73,7 +73,7 @@ test('format contributor with no github account', () => {
|
|||
const {options} = fixtures()
|
||||
|
||||
const expected =
|
||||
'<img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" height="150px;" alt="No Github Account"/><br /><sub><b>No Github Account</b></sub><br /><a href="#translation" title="Translation">🌍</a>'
|
||||
'<img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="No Github Account"/><br /><sub><b>No Github Account</b></sub><br /><a href="#translation" title="Translation">🌍</a>'
|
||||
|
||||
expect(formatContributor(options, contributor)).toBe(expected)
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ const _ = require('lodash/fp')
|
|||
const formatContributionType = require('./format-contribution-type')
|
||||
|
||||
const avatarTemplate = _.template(
|
||||
'<img src="<%= contributor.avatar_url %>" width="<%= options.imageSize %>px;" height="<%= options.imageSize %>px;" alt="<%= name %>"/>',
|
||||
'<img src="<%= contributor.avatar_url %>" width="<%= options.imageSize %>px;" alt="<%= name %>"/>',
|
||||
)
|
||||
const avatarBlockTemplate = _.template(
|
||||
'<a href="<%= contributor.profile %>"><%= avatar %><br /><sub><b><%= name %></b></sub></a>',
|
||||
|
|
|
@ -36,7 +36,7 @@ function injectListBetweenTags(newContent) {
|
|||
}
|
||||
|
||||
function formatLine(contributors) {
|
||||
return `<td>${contributors.join('</td><td>')}</td>`
|
||||
return `<td align="center">${contributors.join('</td><td align="center">')}</td>`
|
||||
}
|
||||
|
||||
function generateContributorsList(options, contributors) {
|
||||
|
@ -48,7 +48,7 @@ function generateContributorsList(options, contributors) {
|
|||
_.map(formatLine),
|
||||
_.join('</tr><tr>'),
|
||||
newContent => {
|
||||
return `\n<table cellspacing="0" cellpadding="1"><tr>${newContent}</tr></table>\n`
|
||||
return `\n<table><tr>${newContent}</tr></table>\n`
|
||||
},
|
||||
)(contributors)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue