From 0608ece50bc7b01f2118cca903a78db6f2ac026e Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Mon, 14 Nov 2022 10:33:06 -0500 Subject: templates, intro pad, transcripts --- emacsconf-mail.el | 18 ++++++++++++++---- emacsconf-pad.el | 13 +++++++++++++ emacsconf-publish.el | 37 +++++++++++++++++++++++-------------- 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/emacsconf-mail.el b/emacsconf-mail.el index 9bd8dcb..21e22e9 100644 --- a/emacsconf-mail.el +++ b/emacsconf-mail.el @@ -159,9 +159,12 @@ :reply-to (or (org-entry-get-with-inheritance "REPLY_TO") (org-entry-get-with-inheritance "REPLY-TO")) :mail-followup-to (or (org-entry-get-with-inheritance "MAIL_FOLLOWUP_TO") (org-entry-get-with-inheritance "MAIL-FOLLOWUP-TO")) - :body (replace-regexp-in-string "\n *," "\n" (buffer-substring-no-properties - (progn (org-end-of-meta-data) (point)) - (org-end-of-subtree))) + :body (replace-regexp-in-string "\n *," "\n" + (buffer-substring-no-properties + (progn + (org-back-to-heading) + (org-end-of-meta-data) (point)) + (org-end-of-subtree))) :function (when (org-entry-get-with-inheritance "FUNCTION") (intern (org-entry-get-with-inheritance "FUNCTION"))))) @@ -178,7 +181,14 @@ (progn (goto-char char) (emacsconf-mail-merge-get-template-from-subtree)) - (error "Could not find template %s" id))))))) + ;; Try the conf.org file + (with-current-buffer (find-file-noselect emacsconf-org-file) + (setq char (org-find-property "EMAIL_ID" id)) + (if char + (progn + (goto-char char) + (emacsconf-mail-merge-get-template-from-subtree)) + (error "Could not find template %s" id))))))))) (defun emacsconf-mail-merge-fill (string) "Fill in the values for STRING using the properties at point. diff --git a/emacsconf-pad.el b/emacsconf-pad.el index a274ee5..c68088d 100644 --- a/emacsconf-pad.el +++ b/emacsconf-pad.el @@ -451,5 +451,18 @@ ${next-talk-list} (if do-insert (insert result)) result)) +(defun emacsconf-pad-prepopulate-intros () + (interactive) + (emacsconf-pad-create-pad "intros") + (emacsconf-pad-set-html + "intros" + (concat "

https://media.emacsconf.org/2022/backstage/

"))) (provide 'emacsconf-pad) ;;; emacsconf-pad.el ends here diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 07097a0..9965414 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -530,6 +530,27 @@ ${pad-info}${status-info}${schedule-info}\n" ;; (insert "\n\n" (emacsconf-format-email-questions-and-comments talk) "\n") (insert ""))) +(defun emacsconf-format-transcript-from-list (subtitles paragraphs video-id &optional lang) + "Return subtitle directives for SUBTITLES split by PARAGRAPHS." + (when (stringp subtitles) (setq subtitles (subed-parse-file subtitles))) + (when (stringp paragraphs) (setq paragraphs (subed-parse-file paragraphs))) + (mapconcat + (lambda (sub) + (let ((msecs (elt sub 1))) + (format "[[!template %stext=\"%s\" start=\"%s\" video=\"%s\" id=\"subtitle\"%s]]" + (if (and paragraphs (>= msecs (elt (car paragraphs) 1))) + (progn + (while (and paragraphs (>= (elt sub 1) (elt (car paragraphs) 1))) + (setq paragraphs (cdr paragraphs))) + "new=\"1\" ") + "") + (replace-regexp-in-string "\"" """ (elt sub 3)) + (concat (format-seconds "%02h:%02m:%02s" (/ (floor msecs) 1000)) + "." (format "%03d" (mod (floor msecs) 1000))) + video-id + (emacsconf-surround " lang=\"" lang "\"" "")))) + subtitles "\n")) + (defun emacsconf-format-transcript (talk) "Format the transcript for TALK, adding paragraph markers when possible." (require 'subed) @@ -551,20 +572,8 @@ ${pad-info}${status-info}${schedule-info}\n" # Transcript " - (mapconcat (lambda (sub) - (let ((msecs (elt sub 1))) - (format "[[!template %stext=\"%s\" start=\"%s\" video=\"mainVideo-%s\" id=\"subtitle\"]]" - (if (and pars (>= msecs (elt (car pars) 1))) - (progn - (while (and pars (>= (elt sub 1) (elt (car pars) 1))) - (setq pars (cdr pars))) - "new=\"1\" ") - "") - (replace-regexp-in-string "\"" """ (elt sub 3)) - (concat (format-seconds "%02h:%02m:%02s" (/ (floor msecs) 1000)) - "." (format "%03d" (mod (floor msecs) 1000))) - (plist-get talk :slug)))) - subtitles "\n") + (emacsconf-format-transcript-from-list + subtitles pars (concat "mainVideo-" (plist-get talk :slug))) " ") -- cgit v1.2.3