mirror of
https://codeberg.org/cage/tinmop/
synced 2025-01-02 01:06:40 +01:00
Compare commits
3 Commits
7ea80477ed
...
0a484ea39c
Author | SHA1 | Date | |
---|---|---|---|
|
0a484ea39c | ||
|
a8acc05e90 | ||
|
7dd0d88c15 |
@ -701,6 +701,123 @@ gopher-window.line.prefix.foreground = cyan
|
||||
|
||||
gopher-window.line.prefix.attribute = bold
|
||||
|
||||
# color parts of a displayed message according to a regular expression
|
||||
# syntax is regular expression color attribute
|
||||
# valid color are specified using RGB triplets as #RRGGBB or color names
|
||||
# valid color names are:
|
||||
# - red
|
||||
# - green
|
||||
# - yellow
|
||||
# - blue
|
||||
# - magenta
|
||||
# - cyan
|
||||
# - white
|
||||
#
|
||||
# valid attributes are:
|
||||
# - bold
|
||||
# - italic
|
||||
# - underline
|
||||
# - blink
|
||||
|
||||
# attribute is optional
|
||||
|
||||
# Some examples follows, order matters!
|
||||
|
||||
# footnotes
|
||||
|
||||
color-regexp = "[⁰¹²³⁴⁵⁶⁷⁸⁹]" #f7a805 italic
|
||||
|
||||
# http links
|
||||
color-regexp = "http(s)?://[^ ]+" #ff0000
|
||||
|
||||
# gemini address header
|
||||
|
||||
color-regexp = "-> gemini://[^ ]+" yellow underline
|
||||
|
||||
#gemini links
|
||||
|
||||
color-regexp = "gemini://[^ ]+" #ff0000
|
||||
|
||||
#gopher links
|
||||
|
||||
color-regexp = "gopher://[^ ]+" #ff0000
|
||||
|
||||
# (c) and (r)
|
||||
|
||||
color-regexp = "(?i)(\\(c\\))|(\\(r\\))" #ff0000 bold
|
||||
|
||||
# date yyyy-mm-dd
|
||||
|
||||
color-regexp = "[0-9]{4}-[0-9]?[0-9]-[0-9]?[0-9]" #0000ff bold
|
||||
|
||||
# numbers
|
||||
|
||||
color-regexp = "-?[0-9]+(.[0-9]+)?%" #ff00ff bold
|
||||
|
||||
# by default polls uses that
|
||||
|
||||
color-regexp = "⯀" green bold
|
||||
|
||||
color-regexp = "The poll has expired" #ff00ff bold
|
||||
|
||||
# HH:MM
|
||||
|
||||
color-regexp = "[012]?[0-9]:[0123456][0-9]" cyan bold
|
||||
|
||||
# your username mentioned
|
||||
|
||||
#color-regexp = "your-username" #ff00ff bold
|
||||
|
||||
# mentions
|
||||
|
||||
color-regexp = "@[^\s]+" cyan
|
||||
|
||||
# hashtags
|
||||
|
||||
color-regexp = "#[^\s]+" #fca9ff
|
||||
|
||||
# gemini colorization
|
||||
|
||||
# header level 1
|
||||
|
||||
color-regexp = "^🞂.*" white bold
|
||||
|
||||
# header level 2
|
||||
|
||||
color-regexp = "🞓 .+" blue bold
|
||||
|
||||
# header level 3
|
||||
|
||||
color-regexp = "🞐 .+" yellow bold
|
||||
|
||||
# header level 4
|
||||
|
||||
color-regexp = "🞎 " yellow
|
||||
|
||||
# list bullet
|
||||
|
||||
color-regexp = "• " blue bold
|
||||
|
||||
# stream statuses
|
||||
|
||||
color-regexp = ":completed" green bold
|
||||
|
||||
color-regexp = ":aborted" red
|
||||
|
||||
color-regexp = ":rendering" cyan
|
||||
|
||||
# _underline_
|
||||
|
||||
color-regexp = "_[^_]+_" #ffff00 underline
|
||||
|
||||
# *bold*
|
||||
|
||||
color-regexp = "\*[^*]+\*" #ffff00 bold
|
||||
|
||||
# /italic/ , commented as interferes with file path and URI
|
||||
|
||||
#color-regexp = "/[^/]+/" #ffff00 italic
|
||||
|
||||
#########################
|
||||
# ⚠ EXPERIMENTAL ZONE ⚠ #
|
||||
#########################
|
||||
|
109
etc/shared.conf
109
etc/shared.conf
@ -75,115 +75,6 @@ delete.fetched.mentions = yes
|
||||
|
||||
open-message-link-window.close-after-select = yes
|
||||
|
||||
# color parts of a displayed message according to a regular expression
|
||||
# syntax is regular expression color attribute
|
||||
# valid color are specified using RGB triplets as #RRGGBB or color names
|
||||
# valid color names are:
|
||||
# - red
|
||||
# - green
|
||||
# - yellow
|
||||
# - blue
|
||||
# - magenta
|
||||
# - cyan
|
||||
# - white
|
||||
#
|
||||
# valid attributes are:
|
||||
# - bold
|
||||
# - italic
|
||||
# - underline
|
||||
# - blink
|
||||
|
||||
# attribute is optional
|
||||
|
||||
# Some examples follows, order matters!
|
||||
|
||||
# http links
|
||||
color-regexp = "http(s)?://[^ ]+" #ff0000
|
||||
|
||||
# gemini address header
|
||||
|
||||
color-regexp = "-> gemini://[^ ]+" yellow underline
|
||||
|
||||
#gemini links
|
||||
|
||||
color-regexp = "gemini://[^ ]+" #ff0000
|
||||
|
||||
#gopher links
|
||||
|
||||
color-regexp = "gopher://[^ ]+" #ff0000
|
||||
|
||||
# (c) and (r)
|
||||
|
||||
color-regexp = "(?i)(\\(c\\))|(\\(r\\))" #ff0000 bold
|
||||
|
||||
# date yyyy-mm-dd
|
||||
|
||||
color-regexp = "[0-9]{4}-[0-9]?[0-9]-[0-9]?[0-9]" #0000ff bold
|
||||
|
||||
# numbers
|
||||
|
||||
color-regexp = "-?[0-9]+(.[0-9]+)?%" #ff00ff bold
|
||||
|
||||
# by default polls uses that
|
||||
|
||||
color-regexp = "⯀" green bold
|
||||
|
||||
color-regexp = "The poll has expired" #ff00ff bold
|
||||
|
||||
# HH:MM
|
||||
|
||||
color-regexp = "[012][0-9]:[0123456][0-9]" cyan bold
|
||||
|
||||
# your username mentioned
|
||||
|
||||
#color-regexp = "your-username" #ff00ff bold
|
||||
|
||||
# mentions
|
||||
|
||||
color-regexp = "@[^\s]+" cyan
|
||||
|
||||
# gemini colorization
|
||||
|
||||
# header level 1
|
||||
|
||||
color-regexp = "^🞂.*" white bold
|
||||
|
||||
# header level 2
|
||||
|
||||
color-regexp = "🞓 .+" blue bold
|
||||
|
||||
# header level 3
|
||||
|
||||
color-regexp = "🞐 .+" yellow bold
|
||||
|
||||
# header level 4
|
||||
|
||||
color-regexp = "🞎 " yellow
|
||||
|
||||
# list bullet
|
||||
|
||||
color-regexp = "• " blue bold
|
||||
|
||||
# stream statuses
|
||||
|
||||
color-regexp = ":completed" green bold
|
||||
|
||||
color-regexp = ":aborted" red
|
||||
|
||||
color-regexp = ":rendering" cyan
|
||||
|
||||
# _underline_
|
||||
|
||||
color-regexp = "_[^_]+_" #ffff00 underline
|
||||
|
||||
# *bold*
|
||||
|
||||
color-regexp = "\*[^*]+\*" #ffff00 bold
|
||||
|
||||
# /italic/ , commented as interferes with file path and URI
|
||||
|
||||
#color-regexp = "/[^/]+/" #ffff00 italic
|
||||
|
||||
gemini.search-engine.uri = "gemini://kennedy.gemi.dev/search"
|
||||
|
||||
# gemini proxy, forward all the gemini and http requests to the servel
|
||||
|
@ -280,7 +280,7 @@ nil (default T), start a new connection"
|
||||
(defun encode-datetime-string (d &optional (fallback nil))
|
||||
"Encode a datetime string from db"
|
||||
(handler-case
|
||||
(local-time:parse-timestring d)
|
||||
(misc:parse-timestring d)
|
||||
(error () fallback)))
|
||||
|
||||
;; application -> db
|
||||
|
@ -24,7 +24,7 @@ A link text entry is like 'aaaa-mm-dd post title'
|
||||
This function parses the 'aaaa-mm-dd' part.
|
||||
"
|
||||
(when (>= (length link-text) 10)
|
||||
(local-time:parse-timestring link-text :start 0 :end 10 :fail-on-error nil)))
|
||||
(misc:parse-timestring link-text :start 0 :end 10 :fail-on-error nil)))
|
||||
|
||||
(defun link-post-title (link-text)
|
||||
"Returns the title of gemlog entry from link text
|
||||
|
@ -152,16 +152,19 @@ Some convenience functions are provided to works with these structures.
|
||||
(incf link-count)
|
||||
(if link
|
||||
(format footnotes-stream
|
||||
"[~a] ~a~%"
|
||||
link-count
|
||||
"~a ~a~%"
|
||||
(number->superscripts link-count)
|
||||
(attribute-value link))
|
||||
(format footnotes-stream
|
||||
"[~a] ~a~%"
|
||||
link-count
|
||||
"~a ~a~%"
|
||||
(number->superscripts link-count)
|
||||
(_ "No address found")))
|
||||
(descend-children node)
|
||||
(when add-link-footnotes
|
||||
(format body-stream " [~a] " link-count))))
|
||||
(format body-stream
|
||||
"~a~a "
|
||||
#\ZERO_WIDTH_SPACE
|
||||
(number->superscripts link-count)))))
|
||||
((tag= +tag-break+ node)
|
||||
(let ((*block-tag* nil))
|
||||
(format body-stream "~%")
|
||||
|
@ -955,8 +955,11 @@ to the array"
|
||||
;; unix timestamp is seconds from 1970-01-01T00:00:00Z
|
||||
(+ unix-timestamp +unix-epoch+))
|
||||
|
||||
(defun parse-timestring (string)
|
||||
(local-time:parse-timestring string))
|
||||
(defun parse-timestring (string &key (start nil) (end nil) (fail-on-error t))
|
||||
(local-time:parse-timestring string
|
||||
:start start
|
||||
:end end
|
||||
:fail-on-error fail-on-error))
|
||||
|
||||
(defmacro gen-time-access (name pos)
|
||||
`(defun ,(format-fn-symbol t "time-~a-of" name) (time-list)
|
||||
|
@ -502,6 +502,7 @@
|
||||
:display-corrupting-utf8-p
|
||||
:remove-corrupting-utf8-chars
|
||||
:match-words
|
||||
:number->superscripts
|
||||
:emojip
|
||||
:starting-emoji))
|
||||
|
||||
|
@ -181,8 +181,15 @@
|
||||
(declare (ignore blanks))
|
||||
s)
|
||||
|
||||
(defun split-words (text)
|
||||
(cl-ppcre:split "\\p{White_Space}" text))
|
||||
(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}")))
|
||||
(defun split-words (text &key (include-zero-width-space nil))
|
||||
(if include-zero-width-space
|
||||
(cl-ppcre:split scanner-including-zero-width text)
|
||||
(cl-ppcre:split scanner text))))
|
||||
|
||||
(defun extract-blanks (text)
|
||||
(remove-if #'string-empty-p (cl-ppcre:split "\\P{White_Space}" text)))
|
||||
@ -724,7 +731,7 @@ printed in the box column by column; in the example above the results are:
|
||||
(defgeneric lines->uri (object))
|
||||
|
||||
(defmethod lines->uri ((object string))
|
||||
(a:when-let ((words (split-words object)))
|
||||
(a:when-let ((words (split-words object :include-zero-width-space t)))
|
||||
(remove-if (lambda (word)
|
||||
(if (< (length word) 4)
|
||||
t
|
||||
@ -832,3 +839,15 @@ list of string `words' or nil if probe is not in words under predicate
|
||||
(when (not mismatchp)
|
||||
(return-from match-words word-start-count)))
|
||||
(return-from match-words nil))))
|
||||
|
||||
(a:define-constant +digits-superscripts+ "⁰¹²³⁴⁵⁶⁷⁸⁹" :test #'string=)
|
||||
|
||||
(defun number->superscripts (number &optional (accum ""))
|
||||
(flet ((concat-digit (index)
|
||||
(strcat (string (elt +digits-superscripts+ index))
|
||||
accum)))
|
||||
(if (< number 10)
|
||||
(concat-digit number)
|
||||
(let ((index (mod number 10))
|
||||
(new-number (truncate (/ number 10))))
|
||||
(number->superscripts new-number (concat-digit index))))))
|
||||
|
Loading…
Reference in New Issue
Block a user