@@ -38,7 +38,11 @@ function Wiki (sites) {
38 let html = `term: ${this.loc}`
38 let html = `term: ${this.loc}`
39 this._entry.innerHTML = html
39 this._entry.innerHTML = html
40 } else if (this.categories[this.loc]) {
40 } 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 />`
42 this._entry.innerHTML = html
46 this._entry.innerHTML = html
44 let html = `Unknown: ${this.loc}`
48 let html = `Unknown: ${this.loc}`
@@ -48,7 +52,7 @@ function Wiki (sites) {
48 this._entry.innerHTML = 'Click a /topic to get started.'
52 this._entry.innerHTML = 'Click a /topic to get started.'
50 // Sidebar
54 // 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>` }, '')
54 this.go = (q) => {
58 this.go = (q) => {
@@ -60,6 +64,10 @@ function Wiki (sites) {
60 return this.loc.toUpperCase() === q.toUpperCase()
64 return this.loc.toUpperCase() === q.toUpperCase()
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>'
63 this.fetch = () => {
71 this.fetch = () => {
64 console.log('Wiki', 'Fetching..')
72 console.log('Wiki', 'Fetching..')
65 for (const site of sites) {
73 for (const site of sites) {
@@ -77,11 +85,11 @@ function Wiki (sites) {
77 if (!this.index[name]) {
85 if (!this.index[name]) {
78 this.index[name] = []
86 this.index[name] = []
80− this.index[name].push({ value, cat, origin })
88+ this.index[name].push({ name, value, cat, origin })
81 if (!this.categories[cat]) {
89 if (!this.categories[cat]) {
82 this.categories[cat] = []
90 this.categories[cat] = []
84− this.categories[cat].push({ value, cat, origin })
92+ this.categories[cat].push({ name, value, cat, origin })
87 this.parse = (site, content) => {
95 this.parse = (site, content) => {