From 81f9f99ea85727db64c5227c3c45443891ecf3a1 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Mon, 19 Oct 2026 11:17:21 -0400 Subject: add transcript backstage --- emacsconf-publish.el | 85 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 35a0cda..da01e30 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -525,6 +525,10 @@ (seq-filter (lambda (o) (string-match "--answers" o)) (emacsconf-publish-filter-public-files talk))) "") + :transcript-details + (if (plist-get talk :backstage) + (format "
Transcript%sView on Youtube" @@ -545,7 +549,7 @@ (emacsconf-replace-plist-in-string info (if (stringp video-file) - "${chapter-list}" + "${chapter-list}${transcript-details}" (or (plist-get talk :video-note) ""))) :audio (if (and (plist-get talk :audio-file) (plist-get talk :public)) @@ -852,36 +856,53 @@ This includes the intro note, the schedule, and talk resources." (insert ""))) -(defun emacsconf-format-transcript-from-list (subtitles video-id &optional lang) +(defun emacsconf-format-transcript-from-list (subtitles video-id &optional lang format) "Return subtitle directives for SUBTITLES." (let ((subed-sanitize-functions nil)) (when (stringp subtitles) (setq subtitles (subed-parse-file subtitles)))) - (mapconcat - (lambda (sub) - (let ((msecs (elt sub 1))) - (concat - (if (and (elt sub 4) (not (string= (elt sub 4) ""))) - (format "\n
[[!template new=\"1\" text=\"\"\"%s\"\"\" start=\"%s\" video=\"%s\" id=\"subtitle\"%s]]
" - (replace-regexp-in-string "\\." "\\\\." (string-trim (replace-regexp-in-string "^NOTE[ \n]" "" (elt sub 4)))) - (concat (format-seconds "%02h:%02m:%02s" (/ (floor msecs) 1000)) - "." (format "%03d" (mod (floor msecs) 1000))) - video-id - (emacsconf-surround " lang=\"" lang "\"" "")) - "") - (format - "[[!template text=\"\"\"%s\"\"\" start=\"%s\" video=\"%s\" id=\"subtitle\"%s]]" - (replace-regexp-in-string - "^#" "\\\\#" - (replace-regexp-in-string - "*" "\\\\*" - (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-publish-format-transcript (talk &optional video-id lang title) + (replace-regexp-in-string + "^

\\|

$" "" + (mapconcat + (lambda (sub) + (let* ((msecs (elt sub 1)) + (text (replace-regexp-in-string + "^#" "\\\\#" + (replace-regexp-in-string + "*" "\\\\*" + (replace-regexp-in-string "\"" """ (elt sub 3))))) + (start (concat (format-seconds "%02h:%02m:%02s" (/ (floor msecs) 1000)) + "." (format "%03d" (mod (floor msecs) 1000))))) + (if (eq format 'html) + (if (and (elt sub 4) (not (string= (elt sub 4) ""))) + (format "

[%s] %s" + video-id + start + video-id + start + start + start + video-id + text) + (format "%s" + start + start + video-id + text)) + (if (and (elt sub 4) (not (string= (elt sub 4) ""))) + (format "\n

[[!template new=\"1\" text=\"\"\"%s\"\"\" start=\"%s\" video=\"%s\" id=\"subtitle\"%s]]
" + (replace-regexp-in-string "\\." "\\\\." (string-trim (replace-regexp-in-string "^NOTE[ \n]" "" (elt sub 4)))) + start + video-id + (emacsconf-surround " lang=\"" lang "\"" "")) + (format + "[[!template text=\"\"\"%s\"\"\" start=\"%s\" video=\"%s\" id=\"subtitle\"%s]]" + text + start + video-id + (emacsconf-surround " lang=\"" lang "\"" "")))))) + subtitles "\n"))) + +(defun emacsconf-publish-format-transcript (talk &optional video-id lang title format) "Format the transcript for TALK, adding paragraph markers when possible." (require 'subed) (setq video-id (or video-id "mainVideo")) @@ -899,7 +920,7 @@ This includes the intro note, the schedule, and talk resources." %s " - (if video-id (concat " transcript-" video-id) "") + (if (and video-id (not (eq format 'html))) (concat " transcript-" video-id) "") (plist-get talk :slug) video-id (emacsconf-surround "-" lang "" "") @@ -908,7 +929,7 @@ This includes the intro note, the schedule, and talk resources." "" " (unedited)") (emacsconf-format-transcript-from-list - subtitles (concat video-id "-" (plist-get talk :slug)))) + subtitles (concat video-id "-" (plist-get talk :slug)) lang format)) ""))) (defun emacsconf-publish-format-captions (talk) @@ -1556,7 +1577,9 @@ If MODIFY-FUNC is specified, use it to modify the talk." (dom-append-child (dom-by-tag node 'title) - (plist-get (emacsconf-resolve-talk (dom-attr node 'data-slug) talks) :status))) + (concat + " " + (plist-get (emacsconf-resolve-talk (dom-attr node 'data-slug) talks) :status)))) (dom-by-tag img 'a)) (svg-print img) (buffer-string))) -- cgit v1.2.3