on master help sign in
Merge pull request #283 from ckipp01/feature/pure-data

add in cleanEntry function

commit89bad784e3fa50398d9dfbc2e2eb7c2d5fd877a8 authorЛu Лinveгa <aliceffekt@gmail.com> dateFri 16 Aug 2019, 10:36 (7 years ago) parent68e83ed4e103fa
1 file changed+11−1
scripts/wiki.js+11−1
scripts/wiki.js+11−1
@@ -9,7 +9,17 @@ const Wiki = sites => {
99 const authors = new Set()
1010 const terms = new Set()
1111
12− const storeEntry = (author, url, category, term, entry) => {
12+ const cleanEntry = entry => {
13+ const temp = document.createElement('div')
14+ temp.textContent = entry
15+ return temp.innerHTML
16+ }
17+
18+ const storeEntry = (author, url, category, term, unCleanEntry) => {
19+ const entry = Array.isArray(unCleanEntry)
20+ ? unCleanEntry.map(x => cleanEntry(x))
21+ : cleanEntry(unCleanEntry)
22+
1323 if (!(category in entries)) {
1424 entries[category] = {}
1525 entries[category][term] = [{ entry, authors: [{ author, url }] }]