From beaf5e27c753f9e33391b3635d6bbef7b44096be Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 9 Nov 2024 14:04:12 +0100 Subject: [PATCH] - [fediverse] ensured using original content's post as quoted text in a reply. --- src/html-utils.lisp | 4 ++++ src/package.lisp | 1 + src/ui-goodies.lisp | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/html-utils.lisp b/src/html-utils.lisp index 27d136a..4e1bf1a 100644 --- a/src/html-utils.lisp +++ b/src/html-utils.lisp @@ -144,6 +144,10 @@ (defun strip-footnote-reference-word (word) (cl-ppcre:regex-replace scanner word ""))) +(let ((scanner (cl-ppcre:create-scanner (footnote-reference-re :enforce-end-string nil)))) + (defun strip-all-footnote-reference (string) + (cl-ppcre:regex-replace-all scanner string ""))) + (defun block-tag-p (node) (and (consp node) (member node diff --git a/src/package.lisp b/src/package.lisp index edff455..3d67657 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -529,6 +529,7 @@ :node->link :append-footnote-reference :strip-footnote-reference-word + :strip-all-footnote-reference :footnote-reference-re :html->text)) diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index 883e71b..886e31c 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -1326,8 +1326,7 @@ It an existing file path is provided the command will refuse to run." :direction :output :if-exists :supersede :if-does-not-exist :error) - (write-sequence (html-utils:strip-footnote-reference-word body) - stream)) + (write-sequence body stream)) (croatoan:end-screen) (tui:with-notify-errors (os-utils:open-with-editor temp-file)) @@ -1384,7 +1383,9 @@ It an existing file path is provided the command will refuse to run." ;; in db (folder, timeline). (when-let* ((message (db:find-message-id reply-id)) (reply-username (db:row-message-username message)) - (rendered-text (db:row-message-rendered-text message)) + (content (db:row-message-content message)) + (rendered-text (msg-utils:message-original->text-body content + :add-link-footnotes nil)) (lines (split-lines rendered-text)) (quote-mark (swconf:quote-char)) (quoted-text (strcat quote-mark