Skip to content

Commit

Permalink
Pass all glyph data through to template
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Oct 9, 2023
1 parent 7cedbf9 commit 2fc1a5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions compile.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ exec sbcl --noinform --disable-debugger --load "$0" --eval '(fixup)' --eval '(ge
(let ((sections (make-hash-table :test 'equal)))
(loop for glyph across (with-open-file (stream file)
(shasht:read-json stream))
do (push (list :code (gethash "code" glyph)
:codepoint (gethash "codepoint" glyph)
:name (gethash "name" glyph))
do (push (loop for k being the hash-keys of glyph using (hash-value v)
collect (intern (string-upcase k) "KEYWORD")
collect v)
(gethash (gethash "category" glyph) sections)))
(loop for name being the hash-keys of sections
for glyphs being the hash-values of sections
Expand Down
5 changes: 4 additions & 1 deletion index.ctml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<section class="glyphsection" lquery="(attr :id name)">
<h2 lquery="(text name)"></h2>
<c:splice iterate="glyphs">
<div class="glyph">
<div class="glyph" lquery="(data :category category :tags tags :code code :name name)">
<i lquery='(html (code-char codepoint))'>&#x0021;</i>
<code lquery='(text code)'>U+0021</code>
<span lquery="(text name)">!</span>
Expand Down Expand Up @@ -185,6 +185,9 @@
query = query.trim().toLowerCase();
if(query === "") return true;
let inner = el.innerText.toLowerCase();
for(let k in el.dataset){
inner += " "+k+":"+el.dataset[k].toLowerCase();
}
for(let part of query.split(/ +/)){
if(!inner.includes(part))
return false;
Expand Down

0 comments on commit 2fc1a5a

Please sign in to comment.