@@ -85,8 +85,18 @@ function Wiki (sites) {
8585 return html
8686 }
8787
88− this.templateTerm = (name, entry) => {
89− return '<ul class="term"><li class="name"><strong>' + name.toLowerCase() + '</strong></li>' + entry.reduce((acc, item) => { return `${acc}<li>${item.value} <a class='author' target='_blank' href='${item.origin.url}'> — @${item.origin.author}</a></li>` }, '') + '</ul>'
88+ this.templateTerm = (name, entries) => {
89+ const formatEntry = (acc, entry) => {
90+ if (typeof entry.value === 'string') {
91+ return `${acc}<li>${entry.value}<a class='author' target='_blank' href='${entry.origin.url}'> — @${entry.origin.author}</a></li>`
92+ } else {
93+ const listItems = entry.value.reduce((items, item) => `${items}<li>${item}</li>`)
94+ return `${acc}<li><ul>${listItems}<a class='author' target='_blank' href='${entry.origin.url}'> — @${entry.origin.author}</a></ul></li>`
95+ }
96+ }
97+
98+ const htmlEntries = entries.reduce(formatEntry, '')
99+ return `<ul class="term"><li class="name"><strong>${name.toLowerCase()}</strong></li>${htmlEntries}</ul>`
90100 }
91101
92102 this.fetch = () => {