on master help sign in
Implemented mentions
111d52eDevine Lu Linvega
links/main.css+1
@@ -17,6 +17,7 @@ body #hallway .entry .date:after { content: ")" }
17body #hallway .entry .author { font-family: 'input_mono_medium'; position: absolute;left: 60px; }
17body #hallway .entry .author { font-family: 'input_mono_medium'; position: absolute;left: 60px; }
18body #hallway .entry .author:after { content:":"; }
18body #hallway .entry .author:after { content:":"; }
19body #hallway .entry .body { max-width: 400px }
19body #hallway .entry .body { max-width: 400px }
20+body #hallway .entry .body a { text-decoration: underline; }
20
21
21/* Portal */
22/* Portal */
22
23
scripts/hallway.js+9
@@ -47,6 +47,15 @@ function Hallway (sites) {
47 const diff = (now - then)
47 const diff = (now - then)
48 const date = Math.floor(diff / 86400000)
48 const date = Math.floor(diff / 86400000)
49
49
50+ // Find mention
51+ if (entry.body.indexOf('@<') > -1) {
52+ const data = entry.body.split('@<').pop().split('>')[0]
53+ const mention = data.split(' ')
54+ const name = mention[0]
55+ const path = mention[1]
56+ entry.body = entry.body.replace(`@<${data}>`, `<a href='${path}'>${name}</a>`)
57+ }
58+
50 return `<li class='entry'><span class='date'>${ago(date)}</span> <span class='author'>${entry.author}</span> <span class='body'>${entry.body}</span></li>`
59 return `<li class='entry'><span class='date'>${ago(date)}</span> <span class='author'>${entry.author}</span> <span class='body'>${entry.body}</span></li>`
51 }
60 }
52
61