WIP example instead of test

output is \"marcevers\\n 17\\n sentence1\\n\")))

plus a lot of junk
This commit is contained in:
Willem van den Ende
2023-04-12 19:07:39 +02:00
parent 4418d06712
commit ecfeb97728
+5 -4
View File
@@ -1,12 +1,12 @@
;;; mostalive/convert-chats-to-org.el -*- lexical-binding: t; -*-
(defun format-chat-messages ()
(defun chat-remove-hourse-ago ()
"Format chat messages by adding '|' separator and user names."
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^\\([[:alnum:]]+\\)\n +\\([[:print:]\n ]+?\\)\n\n" nil t)
(replace-match "| \\1 | \\2 |\n"))))
(while (re-search-forward "hours ago" nil t)
(replace-match ""))))
(ert-deftest test-format-chat-messages-adds-separators ()
(should
@@ -15,5 +15,6 @@
(org-mode)
(insert "marcevers\n 17 hours ago\n sentence 1\n")
(goto-char (point-min))
(format-chat-messages(buffer-string))
(format-chat-messages)
)
"|marcevers | sentence1\n")))