@@ -9,6 +9,8 @@ const Wiki = sites => {
9 const authors = new Set()
9 const authors = new Set()
10 const terms = new Set()
10 const terms = new Set()
12+ const encodeUrl = text => text.replace(/ /g, '+').trim().toLowerCase()
12 const cleanEntry = entry => {
14 const cleanEntry = entry => {
13 const temp = document.createElement('div')
15 const temp = document.createElement('div')
14 temp.textContent = entry
16 temp.textContent = entry
@@ -63,7 +65,7 @@ const Wiki = sites => {
63 const formatSideBarCat = (key, entries) => (currentHtml, cat) => {
65 const formatSideBarCat = (key, entries) => (currentHtml, cat) => {
64 const catLength = Object.keys(entries[cat]).length
66 const catLength = Object.keys(entries[cat]).length
65 const newHtml = `<li class='${selected(key, cat)}'}'>
67 const newHtml = `<li class='${selected(key, cat)}'}'>
66− <a href='#${cat}' data-msgs='${catLength}'>${cat.toLowerCase()}</a>
68+ <a href='#${encodeUrl(cat)}' data-msgs='${catLength}'>${cat.toLowerCase()}</a>
68 return `${currentHtml}${newHtml}`
70 return `${currentHtml}${newHtml}`
@@ -162,11 +164,13 @@ const Wiki = sites => {
167+const decodeUrl = text => text.replace(/\+/g, ' ').trim().toUpperCase()
165const stripHash = hash => {
169const stripHash = hash => {
166 const decoded = decodeURIComponent(hash)
170 const decoded = decodeURIComponent(hash)
167− return decoded.charAt(0) === '#' ? decoded.substring(1) : decoded
171+ return decoded.charAt(0) === '#' ? decodeUrl(decoded.substring(1)) : decoded
170window.addEventListener('hashchange', () => {
174window.addEventListener('hashchange', () => {
171− wiki.refresh(stripHash(window.location.hash).toUpperCase())
175+ wiki.refresh(stripHash(window.location.hash))