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'."
|
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))
|
(let ((results text-line))
|
||||||
(loop for (local-mention . actual-mention) in usernames-table do
|
(loop for (local-mention . actual-mention) in usernames-table do
|
||||||
(ignore-errors
|
(let ((local-mention-re (strcat "(\\s|^)"
|
||||||
(let* ((local-mention-re (strcat "(\\s|^)"
|
local-mention
|
||||||
local-mention
|
"([^"
|
||||||
"([^"
|
+mention-prefix+
|
||||||
+mention-prefix+
|
"\\w]+|$)")))
|
||||||
"\\w\\s]|$)"))
|
(multiple-value-bind (matched registers)
|
||||||
(rest-re-register (nth-value 1 (scan-to-strings local-mention-re results)))
|
(scan-to-strings local-mention-re results)
|
||||||
(rest-re (when (not (vector-empty-p rest-re-register))
|
(when matched
|
||||||
(elt rest-re-register 1)))
|
(let* ((rest-re (when (not (vector-empty-p registers))
|
||||||
(replaced (funcall replace-function
|
(elt registers 1)))
|
||||||
local-mention-re
|
(replaced (funcall replace-function
|
||||||
results
|
local-mention-re
|
||||||
(strcat " " actual-mention))))
|
results
|
||||||
(if rest-re
|
(strcat " "
|
||||||
(setf results (strcat replaced rest-re))
|
actual-mention
|
||||||
(setf results (strcat replaced " "))))))
|
(if rest-re
|
||||||
|
rest-re
|
||||||
|
" ")))))
|
||||||
|
(setf results replaced))))))
|
||||||
;; NOTE: as `usernames-table' is not a map some mention can not be
|
;; NOTE: as `usernames-table' is not a map some mention can not be
|
||||||
;; replaced properly e.g.
|
;; replaced properly e.g.
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user