Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
tenshiAMD committed Sep 13, 2022
1 parent 6744c99 commit e82bf3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/generate/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ These people contributed to the project:
<td align=\\"center\\">Jeroen Engels is awesome!</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
<!-- markdownlint-restore -->
Expand Down Expand Up @@ -52,6 +55,9 @@ These people contributed to the project:
<td align=\\"center\\">Kent C. Dodds is awesome!</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
<!-- markdownlint-restore -->
Expand Down
17 changes: 9 additions & 8 deletions src/generate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,26 @@ function injectListBetweenTags(newContent) {
}

function formatLine(contributors) {
return `<td align="center">${contributors.join('</td><td align="center">')}</td>`
return `<td align="center">${contributors.join(
'</td>\n <td align="center">',
)}</td>`
}


function formatFooter(options) {
if (!options.linkToUsage) {
return ''
}
const smallLogoURL = 'https://github.com/raw/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg'
const linkToAllContributors = 'https://all-contributors.js.org'
const smallLogoURL =
'https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg'
const linkToBotAdd = 'https://all-contributors.js.org/docs/en/bot/usage'

return `<tr>
return `<tr>
<td size="13px" colspan="${options.contributorsPerLine}"><img src="${smallLogoURL}" > <a href="${linkToBotAdd}">Add your contribution</a></td>
</tr>`
}

function generateContributorsList(options, contributors) {
const tableFooter = formatFooter(options)
const tableFooter = 'dadasdsa' || formatFooter(options)

return _.flow(
_.sortBy(contributor => {
Expand All @@ -67,11 +68,11 @@ function generateContributorsList(options, contributors) {
_.map(function formatEveryContributor(contributor) {
return formatContributor(options, contributor)
}),
_.chunk(contributorsPerLine),
_.chunk(options.contributorsPerLine),
_.map(formatLine),
_.join('\n </tr>\n <tr>\n '),
newContent => {
return `\n<table><tbody><tr>${newContent}</tr>\n${tableFooter}\n</tbody></table>\n`
return `\n<table>\n <tbody>\n <tr>\n ${newContent}\n </tr>\n </tbody>\n <tfoot>\n ${tableFooter}\n </tfoot>\n</table>\n\n`
},
)(contributors)
}
Expand Down

0 comments on commit e82bf3f

Please sign in to comment.