diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-11-14 10:33:06 -0500 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-11-14 10:33:06 -0500 |
commit | 0608ece50bc7b01f2118cca903a78db6f2ac026e (patch) | |
tree | 78234fab971245e79f9025b4e235dffaeaa83a17 /emacsconf-publish.el | |
parent | 36b01a7223c568f00352f7fb8cc33684952c842c (diff) | |
download | emacsconf-el-0608ece50bc7b01f2118cca903a78db6f2ac026e.tar.xz emacsconf-el-0608ece50bc7b01f2118cca903a78db6f2ac026e.zip |
templates, intro pad, transcripts
Diffstat (limited to 'emacsconf-publish.el')
-rw-r--r-- | emacsconf-publish.el | 37 |
1 files changed, 23 insertions, 14 deletions
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 "<!-- End of emacsconf-publish-before-page -->"))) +(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))) " ") |