1
0
Fork 0

Compare commits

...

4 Commits

5 changed files with 58 additions and 37 deletions

View File

@ -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*)

View File

@ -123,30 +123,29 @@
(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+))
(setf *open-tour* (load-icon +open-tour+))
(setf *refresh* (load-icon +refresh+))
(setf *up* (load-icon +up+))
(setf *document-delete* (load-icon +document-delete+))
(setf *document-add* (load-icon +document-add+))
(setf *document-accept* (load-icon +document-accept+))
(setf *document-edit* (load-icon +document-edit+))
(setf *folder* (load-icon +folder+))
(setf *star-yellow* (load-icon +star-yellow+))
(setf *star-blue* (load-icon +star-blue+))
(setf *arrow-up* (load-icon +arrow-up+))
(setf *arrow-down* (load-icon +arrow-down+))
(setf *cross* (load-icon +cross+))
(setf *bus-go* (load-icon +bus-go+))
(setf *dice* (load-icon +dice+))
(setf *gemlog-subscribe* (load-icon +gemlog-subscribe+))
(setf *gemlog-unsubscribe* (load-icon +gemlog-unsubscribe+))
(setf *inline-images* (load-icon +inline-images+))
(setf *text* (load-icon +text+))
(setf *profile* (load-icon +profile+))
(setf *profile-disabled* (disable-icon +profile+))
(setf *toc* (load-icon +toc+))
(setf *toc-disabled* (disable-icon +toc+))))
(setf *search* (load-icon +search+))
(setf *back* (load-icon +back+))
(setf *open-iri* (load-icon +go+))
(setf *open-tour* (load-icon +open-tour+))
(setf *refresh* (load-icon +refresh+))
(setf *up* (load-icon +up+))
(setf *document-delete* (load-icon +document-delete+))
(setf *document-add* (load-icon +document-add+))
(setf *document-accept* (load-icon +document-accept+))
(setf *document-edit* (load-icon +document-edit+))
(setf *folder* (load-icon +folder+))
(setf *star-yellow* (load-icon +star-yellow+))
(setf *star-blue* (load-icon +star-blue+))
(setf *arrow-up* (load-icon +arrow-up+))
(setf *arrow-down* (load-icon +arrow-down+))
(setf *cross* (load-icon +cross+))
(setf *bus-go* (load-icon +bus-go+))
(setf *dice* (load-icon +dice+))
(setf *gemlog-subscribe* (load-icon +gemlog-subscribe+))
(setf *gemlog-unsubscribe* (load-icon +gemlog-unsubscribe+))
(setf *inline-images* (load-icon +inline-images+))
(setf *text* (load-icon +text+))
(setf *profile* (load-icon +profile+))
(setf *profile-disabled* (disable-icon +profile+))
(setf *toc* (load-icon +toc+))
(setf *toc-disabled* (disable-icon +toc+)))

View File

@ -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 "~%")

View File

@ -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))))
@ -59,11 +61,13 @@
usernames)))
(defun local-mention->acct (text-line usernames-table)
"Substitute in `text-line' '@user' with '@user@server', if '@user'
"Substitute in `text-line' '@user' with '@user@server', if '@user'
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)))))

View File

@ -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