@@ -38,7 +38,11 @@ function Wiki (sites) {
3838 let html = `term: ${this.loc}`
3939 this._entry.innerHTML = html
4040 } else if (this.categories[this.loc]) {
41− let html = `category: ${this.loc}`
41+ let html = ''
42+ for (const id in this.categories[this.loc]) {
43+ const name = this.categories[this.loc][id].name
44+ html += `${this.templateTerm(name, this.index[name])}<br />`
45+ }
4246 this._entry.innerHTML = html
4347 } else {
4448 let html = `Unknown: ${this.loc}`
@@ -48,7 +52,7 @@ function Wiki (sites) {
4852 this._entry.innerHTML = 'Click a /topic to get started.'
4953 }
5054 // Sidebar
51− this._categories.innerHTML = Object.keys(this.categories).reduce((acc, id) => { return `${acc}<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id} <span class='right'>${this.categories[id].length}</span></li>` }, '')
55+ this._categories.innerHTML = Object.keys(this.categories).reduce((acc, id) => { return `${acc}<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id.substr(0, 20)} <span class='right'>${this.categories[id].length}</span></li>` }, '')
5256 }
5357
5458 this.go = (q) => {
@@ -60,6 +64,10 @@ function Wiki (sites) {
6064 return this.loc.toUpperCase() === q.toUpperCase()
6165 }
6266
67+ this.templateTerm = (name, entry) => {
68+ return '<ul class="term"><li class="name"><b>' + name.toLowerCase() + '</b></li>' + entry.reduce((acc, item) => { return `${acc}<li>${item.value} <a class='author' href='${item.origin.url}'> — @${item.origin.author}</a></li>` }, '') + '</ul>'
69+ }
70+
6371 this.fetch = () => {
6472 console.log('Wiki', 'Fetching..')
6573 for (const site of sites) {
@@ -77,11 +85,11 @@ function Wiki (sites) {
7785 if (!this.index[name]) {
7886 this.index[name] = []
7987 }
80− this.index[name].push({ value, cat, origin })
88+ this.index[name].push({ name, value, cat, origin })
8189 if (!this.categories[cat]) {
8290 this.categories[cat] = []
8391 }
84− this.categories[cat].push({ value, cat, origin })
92+ this.categories[cat].push({ name, value, cat, origin })
8593 }
8694
8795 this.parse = (site, content) => {