diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap
index b8f576a..0786d91 100644
--- a/src/generate/__tests__/__snapshots__/index.js.snap
+++ b/src/generate/__tests__/__snapshots__/index.js.snap
@@ -1,5 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`replace the content between the ALL-CONTRIBUTORS-LIST tags by a custom wrapper around the list of contributors contained in the "bodyContent" tag 1`] = `
+"# project
+
+Description
+
+## Contributors
+These people contributed to the project:
+
+
+
+
+
+ Kent C. Dodds is awesome! |
+ Divjot Singh is awesome! |
+ Jeroen Engels is awesome! |
+
+
+
+
+
+
+
+
+Thanks a lot everyone!"
+`;
+
exports[`replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors 1`] = `
"# project
diff --git a/src/generate/__tests__/index.js b/src/generate/__tests__/index.js
index eeb285c..22d8833 100644
--- a/src/generate/__tests__/index.js
+++ b/src/generate/__tests__/index.js
@@ -69,6 +69,19 @@ test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of c
expect(result).toMatchSnapshot()
})
+test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a custom wrapper around the list of contributors contained in the "bodyContent" tag', () => {
+ const {kentcdodds, bogas04} = contributors
+ const {options, jfmengels, content} = fixtures()
+ const contributorList = [kentcdodds, bogas04, jfmengels]
+ const result = generate(
+ Object.assign(options, { wrapperTemplate: '<%= bodyContent %>
'}),
+ contributorList,
+ content,
+ )
+
+ expect(result).toMatchSnapshot()
+})
+
test('split contributors into multiples lines when there are too many', () => {
const {kentcdodds} = contributors
const {options, content} = fixtures()
diff --git a/src/generate/index.js b/src/generate/index.js
index 11eaedb..033894e 100644
--- a/src/generate/index.js
+++ b/src/generate/index.js
@@ -66,6 +66,10 @@ function formatFooter(options) {
function generateContributorsList(options, contributors) {
const tableFooter = formatFooter(options)
+ const defaultWrapperTemplate = _.template('\n\n <%= bodyContent %> \n<%= tableFooterContent %>
\n\n')
+ const wrapperTemplate = options.wrapperTemplate ? _.template(`\n${options.wrapperTemplate}\n\n`) : defaultWrapperTemplate
+ const seperator = options.wrapperTemplate ? '\n
\n \n ' : '\n
\n \n '
+
let tableFooterContent = ''
return _.flow(
@@ -81,12 +85,15 @@ function generateContributorsList(options, contributors) {
_.map((currentLineContributors) => formatLine(
options, currentLineContributors
)),
- _.join('\n
\n \n '),
+ _.join(seperator),
newContent => {
if (options.linkToUsage) {
tableFooterContent = `
\n ${tableFooter}\n \n`
}
- return `\n\n \n \n ${newContent}\n
\n \n${tableFooterContent}
\n\n`
+
+ const bodyContent = `\n \n ${newContent}\n
\n`
+
+ return wrapperTemplate({ bodyContent, tableFooterContent})
},
)(contributors)
}
@@ -135,6 +142,7 @@ module.exports = function generate(options, contributors, fileContent) {
? '\n'
: generateContributorsList(options, contributors)
const badge = formatBadge(options, contributors)
+
return _.flow(
injectListBetweenTags(contributorsList),
replaceBadge(badge),