mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-16 08:00:35 +01:00
- refactored some emoji-related code.
This commit is contained in:
parent
e981c6589e
commit
5753a7404a
@ -3,6 +3,13 @@
|
|||||||
(defun codepoint->int (string)
|
(defun codepoint->int (string)
|
||||||
(parse-integer string :radix 16))
|
(parse-integer string :radix 16))
|
||||||
|
|
||||||
|
(defun split-fields (line)
|
||||||
|
(cl-ppcre:split ";" line))
|
||||||
|
|
||||||
|
(defun valid-line-p (line)
|
||||||
|
(and (string-not-empty-p line)
|
||||||
|
(not (cl-ppcre:scan "^#" line))))
|
||||||
|
|
||||||
(defun extract-codepoints-sequences (stream)
|
(defun extract-codepoints-sequences (stream)
|
||||||
"Extract shotcodes from the file:
|
"Extract shotcodes from the file:
|
||||||
https://raw.githubusercontent.com/node-unicode/node-unicode-data/master/data/11.0.0-emoji-sequences.txt"
|
https://raw.githubusercontent.com/node-unicode/node-unicode-data/master/data/11.0.0-emoji-sequences.txt"
|
||||||
@ -10,9 +17,8 @@
|
|||||||
(read-line stream nil nil)))
|
(read-line stream nil nil)))
|
||||||
(let ((res ()))
|
(let ((res ()))
|
||||||
(loop for line = (readline) while line do
|
(loop for line = (readline) while line do
|
||||||
(when (and (string-not-empty-p line)
|
(when (valid-line-p line)
|
||||||
(not (cl-ppcre:scan "^#" line)))
|
(alexandria:when-let* ((fields (split-fields line))
|
||||||
(alexandria:when-let* ((fields (cl-ppcre:split ";" line))
|
|
||||||
(codepoints-fields (split-words (alexandria:first-elt fields)))
|
(codepoints-fields (split-words (alexandria:first-elt fields)))
|
||||||
(codepoints (mapcar (lambda (a) (code-char (codepoint->int a)))
|
(codepoints (mapcar (lambda (a) (code-char (codepoint->int a)))
|
||||||
codepoints-fields)))
|
codepoints-fields)))
|
||||||
@ -1166,9 +1172,8 @@
|
|||||||
(read-line stream nil nil)))
|
(read-line stream nil nil)))
|
||||||
(let ((res ()))
|
(let ((res ()))
|
||||||
(loop for line = (readline) while line do
|
(loop for line = (readline) while line do
|
||||||
(when (and (string-not-empty-p line)
|
(when (valid-line-p line)
|
||||||
(not (cl-ppcre:scan "^#" line)))
|
(alexandria:when-let* ((fields (split-fields line))
|
||||||
(alexandria:when-let* ((fields (cl-ppcre:split ";" line))
|
|
||||||
(codepoints-fields (split-words (alexandria:first-elt fields)))
|
(codepoints-fields (split-words (alexandria:first-elt fields)))
|
||||||
(codepoints-ranges (mapcar (lambda (a) (codepoint->int a))
|
(codepoints-ranges (mapcar (lambda (a) (codepoint->int a))
|
||||||
(cl-ppcre:split "\\.\\."
|
(cl-ppcre:split "\\.\\."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user