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; -*-
|
||||
|
||||
(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")))
|
||||
|
||||
Reference in New Issue
Block a user