1
0
Fork 0

- added 'starts-with-emoji-p'.

This commit is contained in:
cage 2021-07-15 18:44:44 +02:00
parent 87a87296f6
commit 09f35f4989
3 changed files with 13 additions and 11 deletions

View File

@ -61,7 +61,7 @@
;;;; expansion of (gen-matcher-sequences)
(defun emoji-sequences-p (chars)
(find-if (lambda (a) (match-codepoint-p chars a))
(member-if (lambda (a) (match-codepoint-p chars a))
'((#\U1F9DD #\EMOJI_MODIFIER_FITZPATRICK_TYPE-6)
(#\U1F9DD #\EMOJI_MODIFIER_FITZPATRICK_TYPE-5)
(#\U1F9DD #\EMOJI_MODIFIER_FITZPATRICK_TYPE-4)
@ -1817,7 +1817,7 @@
;;;; expansion of (gen-matcher-zwj-sequences)
(defun emoji-zwj-sequences-p (chars)
(find-if (lambda (a) (match-codepoint-p chars a))
(member-if (lambda (a) (match-codepoint-p chars a))
'((#\U1F9D1 #\ZERO_WIDTH_JOINER #\CHRISTMAS_TREE)
(#\FACE_WITHOUT_MOUTH #\ZERO_WIDTH_JOINER #\FOG
#\VARIATION_SELECTOR-16)
@ -4749,5 +4749,8 @@
(defgeneric emojip (codepoints-chars))
(defmethod emojip ((codepoints-chars list))
(or (emoji-zwj-sequences-p codepoints-chars)
(emoji-sequences-p codepoints-chars)))
(first (or (emoji-zwj-sequences-p codepoints-chars)
(emoji-sequences-p codepoints-chars))))
(defun starts-with-emoji-p (codepoints-chars)
(emojip codepoints-chars))

View File

@ -341,12 +341,10 @@
(response-body (gemini-client:slurp-gemini-url favicon-url))
(favicon-list (coerce (babel:octets-to-string response-body :errorp t)
'list))
(non-emoji-pos (position-if (lambda (a) (not (emojip (list a))))
favicon-list))
(favicon (if non-emoji-pos
(coerce (subseq favicon-list 0 non-emoji-pos)
'string)
(coerce favicon-list 'string))))
(emoji (starts-with-emoji-p favicon-list))
(favicon (if emoji
(coerce emoji 'string)
(swconf:gemini-default-favicon))))
(setf cache (acons host favicon cache))
(fetch-favicon parsed-url)))
(swconf:gemini-default-favicon)))))))

View File

@ -392,7 +392,8 @@
:maybe-percent-encode
:display-corrupting-utf8-p
:remove-corrupting-utf8-chars
:emojip))
:emojip
:starts-with-emoji-p))
(defpackage :html-utils
(:use