mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-23 09:07:37 +01:00
- [fediverse] modified again the code to match a mention in a post, as it was missing multiples mentions on a single line.
This commit is contained in:
parent
57a0ef4efd
commit
5d263348e6
@ -84,22 +84,25 @@ followed by different acct e.g.:
|
||||
is found as key in the alist `usernames-table' note that `usernames-table' is not a map see: `usernames->usernames-table'."
|
||||
(let ((results text-line))
|
||||
(loop for (local-mention . actual-mention) in usernames-table do
|
||||
(ignore-errors
|
||||
(let* ((local-mention-re (strcat "(\\s|^)"
|
||||
local-mention
|
||||
"([^"
|
||||
+mention-prefix+
|
||||
"\\w\\s]|$)"))
|
||||
(rest-re-register (nth-value 1 (scan-to-strings local-mention-re results)))
|
||||
(rest-re (when (not (vector-empty-p rest-re-register))
|
||||
(elt rest-re-register 1)))
|
||||
(replaced (funcall replace-function
|
||||
local-mention-re
|
||||
results
|
||||
(strcat " " actual-mention))))
|
||||
(if rest-re
|
||||
(setf results (strcat replaced rest-re))
|
||||
(setf results (strcat replaced " "))))))
|
||||
(let ((local-mention-re (strcat "(\\s|^)"
|
||||
local-mention
|
||||
"([^"
|
||||
+mention-prefix+
|
||||
"\\w]+|$)")))
|
||||
(multiple-value-bind (matched registers)
|
||||
(scan-to-strings local-mention-re results)
|
||||
(when matched
|
||||
(let* ((rest-re (when (not (vector-empty-p registers))
|
||||
(elt registers 1)))
|
||||
(replaced (funcall replace-function
|
||||
local-mention-re
|
||||
results
|
||||
(strcat " "
|
||||
actual-mention
|
||||
(if rest-re
|
||||
rest-re
|
||||
" ")))))
|
||||
(setf results replaced))))))
|
||||
;; NOTE: as `usernames-table' is not a map some mention can not be
|
||||
;; replaced properly e.g.
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user