mirror of https://codeberg.org/cage/tinmop/
Compare commits
4 Commits
a0f6c08408
...
d0bcf1e33f
Author | SHA1 | Date |
---|---|---|
cage | d0bcf1e33f | |
cage | bee6b0470e | |
cage | 7d88519b7d | |
cage | e323c81a1c |
|
@ -266,8 +266,6 @@
|
|||
(set-option-variable options :gemini-gui-server *rpc-server-mode*)
|
||||
(set-option-variable options :gemini-gui *rpc-client-mode*)
|
||||
(set-option-variable options :folder *start-folder*)
|
||||
(when (string-not-empty-p *start-folder*)
|
||||
(setf *start-folder* (db:add-folder-prefix *start-folder*)))
|
||||
(set-option-variable options :open-net-address *net-address*)
|
||||
(set-option-variable options :timeline *start-timeline*)
|
||||
(set-option-variable options :reset-timeline-pagination *reset-timeline-pagination*)
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
(client-configuration:config-icons-scaling))))
|
||||
|
||||
(defun load-icons ()
|
||||
(let ((nodgui:*use-tk-for-decoding-png* t))
|
||||
(setf *search* (load-icon +search+))
|
||||
(setf *back* (load-icon +back+))
|
||||
(setf *open-iri* (load-icon +go+))
|
||||
|
@ -149,4 +148,4 @@
|
|||
(setf *profile* (load-icon +profile+))
|
||||
(setf *profile-disabled* (disable-icon +profile+))
|
||||
(setf *toc* (load-icon +toc+))
|
||||
(setf *toc-disabled* (disable-icon +toc+))))
|
||||
(setf *toc-disabled* (disable-icon +toc+)))
|
||||
|
|
|
@ -116,6 +116,24 @@
|
|||
|
||||
(defparameter *ordered-list-item-number* 0)
|
||||
|
||||
(defun append-footnote-reference (text reference-number)
|
||||
(strcat text
|
||||
(format nil
|
||||
"~a~a"
|
||||
#\ZERO_WIDTH_SPACE
|
||||
(number->superscripts reference-number))))
|
||||
|
||||
(defun footnote-reference-re (&key (enforce-end-string t))
|
||||
(format nil
|
||||
"~a[~a]+~@[$~]"
|
||||
#\ZERO_WIDTH_SPACE
|
||||
+digits-superscripts+
|
||||
enforce-end-string))
|
||||
|
||||
(let ((scanner (cl-ppcre:create-scanner (footnote-reference-re))))
|
||||
(defun strip-footnote-reference (word)
|
||||
(cl-ppcre:regex-replace scanner word "")))
|
||||
|
||||
(defun html->text (html &key
|
||||
(add-link-footnotes t) (body-footnotes-separator "")
|
||||
(quote-prefix "> ") (list-item-prefix "* "))
|
||||
|
@ -160,10 +178,8 @@ Some convenience functions are provided to works with these structures.
|
|||
link-count))
|
||||
(descend-children node)
|
||||
(when add-link-footnotes
|
||||
(format body-stream
|
||||
"~a~a "
|
||||
#\ZERO_WIDTH_SPACE
|
||||
(number->superscripts link-count)))))
|
||||
(write-string (append-footnote-reference "" link-count)
|
||||
body-stream))))
|
||||
((tag= +tag-break+ node)
|
||||
(let ((*block-tag* nil))
|
||||
(format body-stream "~%")
|
||||
|
|
|
@ -37,8 +37,10 @@
|
|||
first-mention)))))
|
||||
|
||||
(defun line-find-all-usernames (message-line)
|
||||
(let ((words (split-words message-line)))
|
||||
(mapcar (lambda (a) (subseq a (length +mention-prefix+))) ; remove the @
|
||||
(let ((words (split-words message-line))
|
||||
(mention-prefix-length (length +mention-prefix+)))
|
||||
(mapcar (lambda (a)
|
||||
(html-utils:strip-footnote-reference (subseq a mention-prefix-length))) ; remove the @
|
||||
(remove-if-not (lambda (word)
|
||||
(cl-ppcre:scan (strcat "^" +mention-prefix+) word))
|
||||
words))))
|
||||
|
@ -63,7 +65,9 @@
|
|||
is found as key in the alist `usernames-table'"
|
||||
(let ((results text-line))
|
||||
(loop for (local-mention . actual-mention) in usernames-table do
|
||||
(let ((local-mention-re (strcat "(\\s|^)" local-mention)))
|
||||
(let ((local-mention-re (strcat "(\\s|^)"
|
||||
local-mention
|
||||
(html-utils:footnote-reference-re :enforce-end-string nil))))
|
||||
(setf results (regex-replace-all local-mention-re
|
||||
results
|
||||
(strcat " " actual-mention)))))
|
||||
|
|
|
@ -453,6 +453,7 @@
|
|||
(:export
|
||||
:+float-regexp+
|
||||
:+integer-regexp+
|
||||
:+digits-superscripts+
|
||||
:*blanks*
|
||||
:uchar-length
|
||||
:starts-with-prefix-p
|
||||
|
@ -526,6 +527,9 @@
|
|||
:find-tag
|
||||
:position-tag
|
||||
:node->link
|
||||
:append-footnote-reference
|
||||
:strip-footnote-reference
|
||||
:footnote-reference-re
|
||||
:html->text))
|
||||
|
||||
(defpackage :resources-utils
|
||||
|
|
Loading…
Reference in New Issue