From 82bdf5c5388f853554188f7d69322a409aa4a66d Mon Sep 17 00:00:00 2001 From: cage Date: Wed, 1 May 2024 12:36:00 +0200 Subject: [PATCH] - [fediverse] rendered correctly ordered list; - fixed indentation of configure.ac; - removed useless command in Makefile. --- Makefile.am | 2 +- Makefile.in | 2 +- configure | 2 +- configure.ac | 2 +- src/html-utils.lisp | 52 +++++++++++++++++++++++++++++++++++---------- src/windows.lisp | 3 ++- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index ef9dafe..89021b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -95,12 +95,12 @@ data/scripts/welcome-bot.lisp dist_man1_MANS = doc/tinmop.man $(PACKAGE): $(CONF_PATH_FILE) *.asd src/* - cd $$(dirname $$($(LISP_COMPILER) --noinform --eval "(format t \"~a\" *core-pathname*)" --eval "(sb-ext:quit)")) && \ $(LISP_COMPILER) \ --eval "(push \"$$(pwd)/\" asdf:*central-registry*)" \ --eval "(asdf:make '$(PACKAGE) :build-pathname \"../$(PACKAGE)\")" \ --eval "(uiop:quit)" mv src/tinmop $(PACKAGE) + $(CONF_PATH_FILE): grep "^;" $(CONF_PATH_FILE_IN) > $(CONF_PATH_FILE) echo -e "(in-package :config)\n" >> $(CONF_PATH_FILE); diff --git a/Makefile.in b/Makefile.in index ca9b16a..1b1ca5d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1117,12 +1117,12 @@ uninstall-man: uninstall-man1 $(PACKAGE): $(CONF_PATH_FILE) *.asd src/* - cd $$(dirname $$($(LISP_COMPILER) --noinform --eval "(format t \"~a\" *core-pathname*)" --eval "(sb-ext:quit)")) && \ $(LISP_COMPILER) \ --eval "(push \"$$(pwd)/\" asdf:*central-registry*)" \ --eval "(asdf:make '$(PACKAGE) :build-pathname \"../$(PACKAGE)\")" \ --eval "(uiop:quit)" mv src/tinmop $(PACKAGE) + $(CONF_PATH_FILE): grep "^;" $(CONF_PATH_FILE_IN) > $(CONF_PATH_FILE) echo -e "(in-package :config)\n" >> $(CONF_PATH_FILE); diff --git a/configure b/configure index 8d96e9a..40b59c1 100755 --- a/configure +++ b/configure @@ -8132,7 +8132,7 @@ fi - ac_header= ac_cache= +ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then diff --git a/configure.ac b/configure.ac index 8d0279a..13fecce 100644 --- a/configure.ac +++ b/configure.ac @@ -167,7 +167,7 @@ AC_CHECK_LIB([turbojpeg], [tjInitDecompress], [], AC_MSG_ERROR([Can not find lib dnl check headers - AC_CHECK_HEADER([turbojpeg.h], [], [Can not find libturbojpeg0 headers file.], []) +AC_CHECK_HEADER([turbojpeg.h], [], [Can not find libturbojpeg0 headers file.], []) AC_CONFIG_FILES([Makefile quick_quicklisp.sh po/Makefile.in src/config.lisp.in]) diff --git a/src/html-utils.lisp b/src/html-utils.lisp index c78472c..6662de0 100644 --- a/src/html-utils.lisp +++ b/src/html-utils.lisp @@ -17,21 +17,25 @@ (in-package :html-utils) -(define-constant +tag-link+ "a" :test #'string=) +(define-constant +tag-link+ "a" :test #'string=) -(define-constant +tag-break+ "br" :test #'string=) +(define-constant +tag-break+ "br" :test #'string=) -(define-constant +tag-paragraph+ "p" :test #'string=) +(define-constant +tag-paragraph+ "p" :test #'string=) -(define-constant +tag-list-item+ "li" :test #'string=) +(define-constant +tag-ordered-list+ "ol" :test #'string=) -(define-constant +tag-div+ "div" :test #'string=) +(define-constant +tag-unordered-list+ "ul" :test #'string=) -(define-constant +tag-blockquote+ "blockquote" :test #'string=) +(define-constant +tag-list-item+ "li" :test #'string=) -(define-constant +attribute-url+ "href" :test #'string=) +(define-constant +tag-div+ "div" :test #'string=) -(define-constant +http-scheme+ "http" :test #'string=) +(define-constant +tag-blockquote+ "blockquote" :test #'string=) + +(define-constant +attribute-url+ "href" :test #'string=) + +(define-constant +http-scheme+ "http" :test #'string=) (defun http-link-iri-p (iri) (conditions:with-default-on-error (nil) @@ -106,6 +110,12 @@ (defparameter *quote-level* 0) +(defparameter *ordered-list* nil) + +(defparameter *unordered-list* nil) + +(defparameter *ordered-list-item-number* 0) + (defun html->text (html &key (add-link-footnotes t) (body-footnotes-separator "") (quote-prefix "> ") (list-item-prefix "* ")) @@ -166,11 +176,31 @@ Some convenience functions are provided to works with these structures. (princ *prefix-text-line* body-stream))) (descend-children node) (format body-stream "~%"))) + ((tag= +tag-unordered-list+ node) + (let ((*ordered-list* nil) + (*unordered-list* t)) + (descend-children node))) + ((tag= +tag-ordered-list+ node) + (let ((*ordered-list* t) + (*unordered-list* nil) + (*ordered-list-item-number* 0)) + (descend-children node))) ((tag= +tag-list-item+ node) (let ((*block-tag* nil)) - (format body-stream list-item-prefix) - (descend-children node) - (format body-stream "~%"))) + (cond + (*unordered-list* + (format body-stream list-item-prefix) + (descend-children node) + (format body-stream "~%")) + (*ordered-list* + (incf *ordered-list-item-number*) + (format body-stream "~a." *ordered-list-item-number*) + (descend-children node) + (format body-stream "~%")) + (t + (format body-stream "unknown list type ") + (descend-children node) + (format body-stream "~%"))))) ((tag= +tag-blockquote+ node) (let ((*prefix-text-line* quote-prefix) (*quote-level* (1+ *quote-level*)) diff --git a/src/windows.lisp b/src/windows.lisp index 47b2800..6ac5bd3 100644 --- a/src/windows.lisp +++ b/src/windows.lisp @@ -531,7 +531,8 @@ list of strings (the text lines)." (win-close window))) (defun make-dialog (parent title message style - &optional (buttons nil) + &optional + (buttons nil) (append-ok-button t)) (let* ((lines (text-utils:split-lines message)) (actual-buttons (if append-ok-button