mirror of
https://codeberg.org/cage/tinmop/
synced 2025-01-02 01:06:40 +01:00
Compare commits
2 Commits
0a484ea39c
...
39e567bd4e
Author | SHA1 | Date | |
---|---|---|---|
|
39e567bd4e | ||
|
96cc3b62c4 |
@ -74,6 +74,9 @@ Print program version and exit
|
||||
.TP
|
||||
\fB\fC\-F, \-\-fediverse\-account\fP \fP
|
||||
Specify a fediverse user account (format: user-name@server-name)
|
||||
.TP
|
||||
\fB\fC\-Q, \-\-search\-fediverse SEARCH\-FEDIVERSE\-QUERY\fP\fP
|
||||
Search fediverse (see this guide: \fIhttps://markwrites.io/guide-for-using-mastodon-search\fP)
|
||||
.SH "Usage"
|
||||
.PP
|
||||
Users of Tinmop supposed to interact with the social network using a terminal interface (TUI, but starting with version 0.9.9.1414 a GUI for gemini is available See \fIfuzzy:GUI\fP), the terminal screen layout is sketched below:
|
||||
@ -1500,7 +1503,7 @@ The program will be compiled in \fCdebug\-mode\fP this means that a lot of diagn
|
||||
.IP \(em 4
|
||||
\fC$HOME/.config/tinmop/main.conf\fP: user configuration (simple format)
|
||||
.IP \(em 4
|
||||
\fC$HOME/.config/tinmop/main.conf\fP: user configuration for GUI (simple format)
|
||||
\fC$HOME/.config/tinmop/gui.conf\fP: user configuration for GUI (simple format)
|
||||
.SH "Privacy"
|
||||
.PP
|
||||
The author of this software collects no user data information with this software.
|
||||
|
@ -53,6 +53,7 @@
|
||||
+ ~-U, --gemini-gui-client-only~ :: Start the program as A gemini GUI client
|
||||
+ ~-v, --version~ :: Print program version and exit
|
||||
+ ~-F, --fediverse-account~ :: Specify a fediverse user account (format: user-name@server-name)
|
||||
+ ~-Q, --search-fediverse SEARCH-FEDIVERSE-QUERY~ :: Search fediverse (see this guide: https://markwrites.io/guide-for-using-mastodon-search)
|
||||
|
||||
* Usage
|
||||
|
||||
@ -758,7 +759,7 @@
|
||||
- ~/etc/tinmop/init.lisp~: system wide configuration
|
||||
- ~$HOME/.config/tinmop/init.lisp~: user configuration
|
||||
- ~$HOME/.config/tinmop/main.conf~: user configuration (simple format)
|
||||
- ~$HOME/.config/tinmop/main.conf~: user configuration for GUI (simple format)
|
||||
- ~$HOME/.config/tinmop/gui.conf~: user configuration for GUI (simple format)
|
||||
|
||||
* Privacy
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# - underline
|
||||
# - blink
|
||||
|
||||
announcements.icon = "📣"
|
||||
announcements.icon = "📢"
|
||||
|
||||
announcements.separator = "∴ ∴ ∴"
|
||||
|
||||
@ -723,7 +723,7 @@ gopher-window.line.prefix.attribute = bold
|
||||
|
||||
# Some examples follows, order matters!
|
||||
|
||||
# footnotes
|
||||
# footnotes reference number
|
||||
|
||||
color-regexp = "[⁰¹²³⁴⁵⁶⁷⁸⁹]" #f7a805 italic
|
||||
|
||||
@ -818,6 +818,11 @@ color-regexp = "\*[^*]+\*" #ffff00 bold
|
||||
|
||||
#color-regexp = "/[^/]+/" #ffff00 italic
|
||||
|
||||
# footnotes
|
||||
|
||||
color-regexp = "[0-9][0-9]*·" #f7a805 italic
|
||||
|
||||
|
||||
#########################
|
||||
# ⚠ EXPERIMENTAL ZONE ⚠ #
|
||||
#########################
|
||||
|
@ -569,60 +569,70 @@
|
||||
(scale-pixmap main-window file 'nodgui.pixmap:png))
|
||||
|
||||
(defun inline-image (main-window link-value line-index)
|
||||
(multiple-value-bind (file-path mime-type)
|
||||
(slurp-iri main-window (remove-standard-port link-value))
|
||||
(a:when-let* ((local-file (fs:file-exists-p file-path))
|
||||
(image (handler-case
|
||||
(cond
|
||||
((or (string= mime-type +mime-type-jpg+)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "jpg")
|
||||
(fs:has-extension file-path "jpeg")))
|
||||
(scale-jpeg main-window file-path))
|
||||
((or (member mime-type
|
||||
'("image/x-tga" "image/x-targa")
|
||||
:test #'string=)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "tga")))
|
||||
(scale-targa main-window file-path))
|
||||
((or (string= mime-type +mime-type-png+)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "png")))
|
||||
(scale-png main-window file-path))
|
||||
(t
|
||||
(gui:make-image file-path)))
|
||||
(error (e)
|
||||
(let ((error-message (format nil
|
||||
(_ "unable to inline ~a: ~a")
|
||||
link-value
|
||||
e)))
|
||||
(gui-goodies:notify-request-error error-message)
|
||||
nil))))
|
||||
(coordinates `(+ (:line ,line-index :char 0) 1 :lines)))
|
||||
(with-accessors ((ir-lines ir-lines)
|
||||
(ir-rendered-lines ir-rendered-lines)
|
||||
(gemtext-widget gemtext-widget)) main-window
|
||||
(let* ((parent-line (elt ir-lines (- line-index 1)))
|
||||
(new-line (copy-list parent-line)))
|
||||
(gui:move-cursor-to gemtext-widget coordinates)
|
||||
(gui:insert-text gemtext-widget (format nil "~%"))
|
||||
(gui:insert-image gemtext-widget image coordinates)
|
||||
(setf (getf new-line :type) (link-contains-inline-type-p link-value))
|
||||
(setf ir-lines
|
||||
(fresh-vector-insert@ ir-lines
|
||||
new-line
|
||||
line-index))
|
||||
(setf ir-rendered-lines
|
||||
(fresh-vector-insert@ ir-rendered-lines
|
||||
""
|
||||
line-index)))))))
|
||||
(with-accessors ((ir-lines ir-lines)
|
||||
(ir-rendered-lines ir-rendered-lines)
|
||||
(gemtext-widget gemtext-widget)) main-window
|
||||
(when (not (image-inlined-p ir-lines line-index))
|
||||
(multiple-value-bind (file-path mime-type)
|
||||
(slurp-iri main-window (remove-standard-port link-value))
|
||||
(a:when-let* ((local-file (fs:file-exists-p file-path))
|
||||
(image (handler-case
|
||||
(cond
|
||||
((or (string= mime-type +mime-type-jpg+)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "jpg")
|
||||
(fs:has-extension file-path "jpeg")))
|
||||
(scale-jpeg main-window file-path))
|
||||
((or (member mime-type
|
||||
'("image/x-tga" "image/x-targa")
|
||||
:test #'string=)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "tga")))
|
||||
(scale-targa main-window file-path))
|
||||
((or (string= mime-type +mime-type-png+)
|
||||
(and local-file
|
||||
(fs:has-extension file-path "png")))
|
||||
(scale-png main-window file-path))
|
||||
(t
|
||||
(gui:make-image file-path)))
|
||||
(error (e)
|
||||
(let ((error-message (format nil
|
||||
(_ "unable to inline ~a: ~a")
|
||||
link-value
|
||||
e)))
|
||||
(gui-goodies:notify-request-error error-message)
|
||||
nil))))
|
||||
(coordinates `(+ (:line ,line-index :char 0) 1 :lines)))
|
||||
(let* ((parent-line (elt ir-lines (- line-index 1)))
|
||||
(new-line (copy-list parent-line)))
|
||||
(gui:move-cursor-to gemtext-widget coordinates)
|
||||
(gui:insert-text gemtext-widget (format nil "~%"))
|
||||
(gui:insert-image gemtext-widget image coordinates)
|
||||
(setf (getf new-line :type) (link-contains-inline-type-p link-value))
|
||||
(setf ir-lines
|
||||
(fresh-vector-insert@ ir-lines
|
||||
new-line
|
||||
line-index))
|
||||
(setf ir-rendered-lines
|
||||
(fresh-vector-insert@ ir-rendered-lines
|
||||
""
|
||||
line-index))))))))
|
||||
|
||||
(defun image-inlined-p (lines line-number)
|
||||
(if (< (1- line-number)
|
||||
(1- (length lines)))
|
||||
(eq (getf (elt lines line-number) ; getting the line *next* to the link
|
||||
:type)
|
||||
+inline-ir-type+)))
|
||||
|
||||
(defun inline-all-images (main-window)
|
||||
"Note that this functions assumes that all remote IRI resources are
|
||||
absolute (i.e. with scheme component), non absolute IRI are considered
|
||||
local file paths."
|
||||
(labels ((inline-single-image (lines line-number)
|
||||
(when (< (1- line-number) (length lines))
|
||||
(when (and (< (1- line-number)
|
||||
(length lines))
|
||||
(not (image-inlined-p lines line-number)))
|
||||
(let ((line (elt lines (1- line-number))))
|
||||
(if (and (string= (getf line :type) "a")
|
||||
(inline-image-p (getf line :href)))
|
||||
|
@ -152,13 +152,12 @@ Some convenience functions are provided to works with these structures.
|
||||
(incf link-count)
|
||||
(if link
|
||||
(format footnotes-stream
|
||||
"~a ~a~%"
|
||||
(number->superscripts link-count)
|
||||
"~a· ~a~%"
|
||||
link-count
|
||||
(attribute-value link))
|
||||
(format footnotes-stream
|
||||
"~a ~a~%"
|
||||
(number->superscripts link-count)
|
||||
(_ "No address found")))
|
||||
(_ "~a· No address found~%")
|
||||
link-count))
|
||||
(descend-children node)
|
||||
(when add-link-footnotes
|
||||
(format body-stream
|
||||
|
@ -181,11 +181,11 @@
|
||||
(declare (ignore blanks))
|
||||
s)
|
||||
|
||||
(let ((scanner-including-zero-width (cl-ppcre:create-scanner (strcat "(\\p{White_Space})|("
|
||||
;; \\x200B → #\ZERO_WIDTH_SPACE
|
||||
(string (code-char #x200B))
|
||||
")")))
|
||||
(scanner (cl-ppcre:create-scanner "\\p{White_Space}")))
|
||||
(let* ((re-including-zero-width (format nil
|
||||
"(\\p{White_Space})|(~a)"
|
||||
#\ZERO_WIDTH_SPACE))
|
||||
(scanner-including-zero-width (cl-ppcre:create-scanner re-including-zero-width))
|
||||
(scanner (cl-ppcre:create-scanner "\\p{White_Space}")))
|
||||
(defun split-words (text &key (include-zero-width-space nil))
|
||||
(if include-zero-width-space
|
||||
(cl-ppcre:split scanner-including-zero-width text)
|
||||
|
Loading…
Reference in New Issue
Block a user