on master help sign in
add in cleanEntry function
4e103fackipp01
scripts/wiki.js+11−1
@@ -9,7 +9,17 @@ const Wiki = sites => {
9 const authors = new Set()
9 const authors = new Set()
10 const terms = new Set()
10 const terms = new Set()
11
11
12+ const cleanEntry = entry => {
13+ const temp = document.createElement('div')
14+ temp.textContent = entry
15+ return temp.innerHTML
16+ }
17+
12− const storeEntry = (author, url, category, term, entry) => {
18+ const storeEntry = (author, url, category, term, unCleanEntry) => {
19+ const entry = Array.isArray(unCleanEntry)
20+ ? unCleanEntry.map(x => cleanEntry(x))
21+ : cleanEntry(unCleanEntry)
22+
13 if (!(category in entries)) {
23 if (!(category in entries)) {
14 entries[category] = {}
24 entries[category] = {}
15 entries[category][term] = [{ entry, authors: [{ author, url }] }]
25 entries[category][term] = [{ entry, authors: [{ author, url }] }]