mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 21:46:29 +00:00
feat: Pretty-print the generagted HTML table (#190)
Closes #189 Keeps the Table left aligned, and moves the tr and td in by 2 spaces each
This commit is contained in:
parent
89c38407bc
commit
68166eca69
2 changed files with 25 additions and 5 deletions
|
@ -9,7 +9,13 @@ Description
|
||||||
These people contributed to the project:
|
These people contributed to the project:
|
||||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<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>
|
<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 -->
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|
||||||
|
@ -25,7 +31,19 @@ Description
|
||||||
These people contributed to the project:
|
These people contributed to the project:
|
||||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<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>
|
<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 -->
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,9 @@ function injectListBetweenTags(newContent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatLine(contributors) {
|
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 generateContributorsList(options, contributors) {
|
function generateContributorsList(options, contributors) {
|
||||||
|
@ -46,9 +48,9 @@ function generateContributorsList(options, contributors) {
|
||||||
}),
|
}),
|
||||||
_.chunk(options.contributorsPerLine),
|
_.chunk(options.contributorsPerLine),
|
||||||
_.map(formatLine),
|
_.map(formatLine),
|
||||||
_.join('</tr><tr>'),
|
_.join('\n </tr>\n <tr>\n '),
|
||||||
newContent => {
|
newContent => {
|
||||||
return `\n<table><tr>${newContent}</tr></table>\n\n`
|
return `\n<table>\n <tr>\n ${newContent}\n </tr>\n</table>\n\n`
|
||||||
},
|
},
|
||||||
)(contributors)
|
)(contributors)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue