WIP example instead of test
output is \"marcevers\\n 17\\n sentence1\\n\"))) plus a lot of junk
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
;;; mostalive/convert-chats-to-org.el -*- lexical-binding: t; -*-
|
;;; 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."
|
"Format chat messages by adding '|' separator and user names."
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "^\\([[:alnum:]]+\\)\n +\\([[:print:]\n ]+?\\)\n\n" nil t)
|
(while (re-search-forward "hours ago" nil t)
|
||||||
(replace-match "| \\1 | \\2 |\n"))))
|
(replace-match ""))))
|
||||||
|
|
||||||
(ert-deftest test-format-chat-messages-adds-separators ()
|
(ert-deftest test-format-chat-messages-adds-separators ()
|
||||||
(should
|
(should
|
||||||
@@ -15,5 +15,6 @@
|
|||||||
(org-mode)
|
(org-mode)
|
||||||
(insert "marcevers\n 17 hours ago\n sentence 1\n")
|
(insert "marcevers\n 17 hours ago\n sentence 1\n")
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(format-chat-messages(buffer-string))
|
(format-chat-messages)
|
||||||
|
)
|
||||||
"|marcevers | sentence1\n")))
|
"|marcevers | sentence1\n")))
|
||||||
|
|||||||
Reference in New Issue
Block a user