From c1a32ad031d6a5fc7dc644fcfc442c3c9a6e107c Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 9 Dec 2022 22:46:25 -0500 Subject: code for adding questions to the Q&A transcript --- emacsconf-extract.el | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'emacsconf-extract.el') diff --git a/emacsconf-extract.el b/emacsconf-extract.el index 77c8d0b..e158764 100644 --- a/emacsconf-extract.el +++ b/emacsconf-extract.el @@ -270,5 +270,40 @@ (unless (string= (or questions "") "") (insert "## Questions and answers\n\n" questions "\n\n")) ))) + +(defun emacsconf-extract-question-headings (slug) + (with-temp-buffer + (insert-file-contents + (expand-file-name + (concat slug ".md") + (expand-file-name "talks" + (expand-file-name emacsconf-year emacsconf-directory)))) + (goto-char (point-min)) + (let (results) + (while (re-search-forward "^-[ \t]+Q:[  ]*" nil t) + (setq results + (cons + (string-trim + (replace-regexp-in-string + "[\n \t ]+" " " + (replace-regexp-in-string + "\\\\" + "" + (buffer-substring + (point) + (and (re-search-forward "^[ \t]+-\\|^[ \t]+*$" nil t) + (match-beginning 0)))))) + results))) + (nreverse results)))) +;; (emacsconf-extract-question-headings "asmblox") + +(defun emacsconf-extract-insert-note-with-question-heading (question) + (interactive + (list + (completing-read + "Question: " + (emacsconf-extract-question-headings + (emacsconf-get-slug-from-string (file-name-base (buffer-file-name))))))) + (insert "NOTE " question "\n\n")) (provide 'emacsconf-extract) ;;; emacsconf-extract.el ends here -- cgit v1.2.3