Added necessary lines to produce the accurate reference to the specs (#16)

This commit is contained in:
João Guimarães 2016-05-11 19:08:01 +01:00 committed by Jeroen Engels
parent dfc20fc8d9
commit 8f2f9dd025
2 changed files with 17 additions and 3 deletions

View file

@ -37,7 +37,11 @@ test('should create contributors section if it is absent', t => {
'Description',
'## Contributors',
'',
'<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --><!-- ALL-CONTRIBUTORS-LIST:END -->'
'Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):',
'',
'<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --><!-- ALL-CONTRIBUTORS-LIST:END -->',
'',
'This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!'
].join('\n');
const result = addContributorsList(content);
@ -51,7 +55,11 @@ test('should create contributors section if content is empty', t => {
'',
'## Contributors',
'',
'<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --><!-- ALL-CONTRIBUTORS-LIST:END -->'
'Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):',
'',
'<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --><!-- ALL-CONTRIBUTORS-LIST:END -->',
'',
'This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!'
].join('\n');
const result = addContributorsList(content);

View file

@ -4,7 +4,9 @@ var _ = require('lodash/fp');
var injectContentBetween = require('../util').markdown.injectContentBetween;
var badgeContent = '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)';
var headerContent = 'Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):';
var listContent = '<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --><!-- ALL-CONTRIBUTORS-LIST:END -->';
var footerContent = 'This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!';
function addBadge(lines) {
return injectContentBetween(lines, badgeContent, 1, 1);
@ -31,7 +33,11 @@ function addContributorsList(lines) {
.concat([
'## Contributors',
'',
listContent
headerContent,
'',
listContent,
'',
footerContent
]);
}
return injectContentBetween(lines, listContent, insertionLine + 2, insertionLine + 2);