summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--emacsconf-publish.el132
1 files changed, 87 insertions, 45 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el
index 899145d..ee8f545 100644
--- a/emacsconf-publish.el
+++ b/emacsconf-publish.el
@@ -40,14 +40,13 @@
(defcustom emacsconf-public-media-directory nil "Can be over TRAMP" :type 'string :group 'emacsconf)
(defcustom emacsconf-protected-media-directory nil "Can be over TRAMP" :type 'string :group 'emacsconf)
-(defun emacsconf-update-talk ()
+(defun emacsconf-update-talk (info)
"Publish the schedule page and the page for this talk."
- (interactive)
+ (interactive (list (emacsconf-complete-talk-info)))
(when (functionp 'emacsconf-upcoming-insert-or-update)
(emacsconf-upcoming-insert-or-update))
- (let ((info (emacsconf-get-talk-info-for-subtree)))
- (emacsconf-generate-before-page info)
- (emacsconf-generate-after-page info))
+ (emacsconf-generate-before-page info)
+ (emacsconf-generate-after-page info)
(emacsconf-generate-main-schedule))
(defun emacsconf-publish-add-talk ()
@@ -325,27 +324,32 @@ resources."
(timestamp (org-timestamp-from-string (plist-get o :scheduled))))
(concat
"[[!toc ]]\n"
- (if (plist-get o :q-and-a) (format "Q&A: %s \n" (plist-get o :q-and-a)) "")
- (if (member emacsconf-publishing-phase '(program schedule)) (concat "Status: " (plist-get o :status-label) " \n") "")
"Duration: " (or (plist-get o :video-duration)
(concat (plist-get o :duration) " minutes"))
" \n"
+ (if (plist-get o :q-and-a) (format "Q&A: %s \n" (plist-get o :q-and-a)) "")
+ (if (member emacsconf-publishing-phase '(program schedule)) (concat "Status: " (plist-get o :status-label) " \n") "")
(if (and (member emacsconf-publishing-phase '(program schedule))
(not (member (plist-get o :status) '("DONE" "CANCELLED" "STARTED"))))
(let ((start (org-timestamp-to-time (org-timestamp-split-range timestamp)))
(end (org-timestamp-to-time (org-timestamp-split-range timestamp t))))
(format
- "<div class=\"times\" start=\"%s\" end=\"%s\">%s<br /><a href=\"/2021/\">Find out how to watch and participate</a></div>"
+ "<div>Times in different timezones:</div><div class=\"times\" start=\"%s\" end=\"%s\"><div class=\"conf-time\">%s</div><div class=\"others\">%s</div></div><div><a href=\"/%s/watch/%s/\">Find out how to watch and participate</a></div>"
(format-time-string "%Y-%m-%dT%H:%M:%SZ" start t)
(format-time-string "%Y-%m-%dT%H:%M:%SZ" end t)
- (string-join (emacsconf-timezone-strings o) "<br />")))
+ (emacsconf-timezone-string o emacsconf-timezone)
+ (string-join (emacsconf-timezone-strings
+ o
+ (seq-filter (lambda (zone) (string= emacsconf-timezone zone))
+ emacsconf-timezones)) "<br />")
+ emacsconf-year
+ (plist-get (emacsconf-get-track (plist-get o :track)) :id)))
"")
"\n"
(if (plist-get o :alternate-apac)
(format "[[!inline pages=\"internal(%s/inline-alternate)\" raw=\"yes\"]] \n" emacsconf-year)
"")
"\n"
- "If you have questions and the speaker has not indicated public contact information on this page, please feel free to e-mail us at <emacsconf-submit@gnu.org> and we'll forward your question to the speaker.\n\n"
(if (plist-get o :public) (emacsconf-wiki-talk-resources o) "")
"\n# Description\n\n")))
@@ -371,16 +375,40 @@ resources."
;; (insert "\n\n" (emacsconf-format-email-questions-and-comments talk) "\n")
(insert "<!-- End of emacsconf-generate-before-page -->")))
-(defun emacsconf-generate-after-page (talk &optional info)
+(defun emacsconf-generate-after-page (talk &optional info elem)
"Info included before the abstract."
(interactive (list (emacsconf-get-talk-info-for-subtree)))
+ (setq info (or info (emacsconf-get-talk-info)))
;; Contact information
(with-temp-file (expand-file-name (format "%s-after.md" (plist-get talk :slug))
(expand-file-name "info" (expand-file-name emacsconf-year emacsconf-directory)))
- (insert "<!-- Automatically generated by emacsconf-generate-after-page -->\n")
- (insert "\n\n"
- (emacsconf-format-email-questions-and-comments talk) "\n")
- (insert "<!-- End of emacsconf-generate-after-page -->\n")))
+ (insert
+ "<!-- Automatically generated by emacsconf-generate-after-page -->\n"
+ "\n\n"
+ (emacsconf-format-email-questions-and-comments talk) "\n"
+ (format "<div class=\"schedule-in-context schedule-svg-container\" data-slug=\"%s\">\n" (plist-get talk :slug))
+ (let* ((width 800) (height 150)
+ (talk-date (format-time-string "%Y-%m-%d" (plist-get talk :start-time) emacsconf-timezone))
+ (start (date-to-time (concat talk-date "T09:00:00" emacsconf-timezone-offset)))
+ (end (date-to-time (concat talk-date "T17:00:00" emacsconf-timezone-offset)))
+ (emacsconf-schedule-svg-modify-functions
+ (append
+ emacsconf-schedule-svg-modify-functions
+ (list (lambda (o node &optional parent)
+ (when (string= (plist-get o :slug) (plist-get talk :slug))
+ (dom-set-attribute node 'stroke-width "3")))))))
+ (with-temp-buffer
+ (svg-print (emacsconf-schedule-svg-day
+ (svg-create width height)
+ (format-time-string "%A" (plist-get talk :start-time) emacsconf-timezone)
+ width height
+ start end
+ (emacsconf-by-track
+ (seq-filter (lambda (o) (string= (format-time-string "%Y-%m-%d" (plist-get o :start-time) emacsconf-timezone)
+ talk-date))
+ info))))
+ (buffer-string)))
+ "\n</div>\n<!-- End of emacsconf-generate-after-page -->\n")))
(defun emacsconf-sort-by-track-then-schedule (a b)
;; Gen,Dev; then by time
@@ -423,13 +451,15 @@ Back to the [[talks]] \n"
")))))))
(defun emacsconf-generate-info-pages (&optional info)
- (interactive)
"Populate year/info/*-nav, -before, and -after files."
- (let* ((talks (seq-remove (lambda (o) (string= (plist-get o :status) "CANCELLED"))
- (sort (emacsconf-filter-talks (or info (emacsconf-get-talk-info))) #'emacsconf-sort-by-scheduled))))
- (emacsconf-generate-nav-pages talks)
- (mapc #'emacsconf-generate-before-page talks)
- (mapc #'emacsconf-generate-after-page talks)))
+ (interactive)
+ (setq info (or info (emacsconf-get-talk-info)))
+ (emacsconf-publish-with-wiki-change
+ (let* ((talks (seq-remove (lambda (o) (string= (plist-get o :status) "CANCELLED"))
+ (sort (emacsconf-filter-talks info) #'emacsconf-sort-by-scheduled))))
+ (emacsconf-generate-nav-pages talks)
+ (mapc #'emacsconf-generate-before-page talks)
+ (mapc (lambda (o) (emacsconf-generate-after-page o talks)) talks))))
(defun emacsconf-generate-talks-page (emacsconf-info)
(interactive "p")
@@ -537,15 +567,8 @@ Back to the [[talks]] \n"
(defun emacsconf-publish-format-interleaved-schedule (&optional info)
"Return a list with the schedule for INFO.
Entries are sorted chronologically, with different tracks interleaved."
- (let* ((by-day (seq-group-by (lambda (o)
- (format-time-string "%Y-%m-%d" (plist-get o :start-time) emacsconf-timezone))
- (sort (seq-filter (lambda (o)
- (or (plist-get o :slug)
- (plist-get o :include-in-info)))
- (or info (emacsconf-get-talk-info)))
- #'emacsconf-sort-by-scheduled)))
- (dates (seq-map (lambda (o) (plist-get (cadr o) :start-time))
- by-day))
+ (let* ((by-day (emacsconf-by-day (or info (emacsconf-get-talk-info))))
+ (dates (seq-map (lambda (o) (plist-get (cadr o) :start-time)) by-day))
(links (mapcar (lambda (o)
(format "<a href=\"#date-%s\">%s</a>"
(format-time-string "%Y-%m-%d" o emacsconf-timezone)
@@ -560,23 +583,14 @@ Entries are sorted chronologically, with different tracks interleaved."
(day-end (date-to-time (concat (format-time-string "%Y-%m-%dT17:00" (plist-get (cadr day) :start-time))
emacsconf-timezone-offset))))
(concat
- (with-temp-buffer
- (svg-print
- (emacsconf-schedule-svg-day
- (svg-create width height)
- (format-time-string "%a" (plist-get (cadr day) :start-time) emacsconf-timezone)
- width height
- day-start
- day-end
- (emacsconf-by-tracks (cdr day))))
- (buffer-string))
- "\n\n"
(if (> (length links) 1) (concat "Jump to: " (string-join links " - ")) "")
(format "<a name=\"date-%s\"></a>\n"
(format-time-string "%Y-%m-%d"
(plist-get (cadr day) :start-time)
emacsconf-timezone))
(format-time-string "# %A %b %-e, %Y\n" (plist-get (cadr day) :start-time) emacsconf-timezone)
+ (format "[[!inline pages=\"internal(%s/schedule-%s)\" raw=\"yes\"]]" emacsconf-year (car day))
+ "\n\n"
(format "<div class=\"schedule\" data-start=\"%s\" data-end=\"%s\" data-tracks=\"General,Development\">\n"
(format-time-string "%FT%T%z" day-start t)
(format-time-string "%FT%T%z" day-end t))
@@ -587,6 +601,7 @@ Entries are sorted chronologically, with different tracks interleaved."
(defun emacsconf-generate-main-schedule (&optional info)
(interactive)
+ (emacsconf-publish-schedule-svg-snippets)
(with-temp-file (expand-file-name "schedule-details.md" (expand-file-name emacsconf-year emacsconf-directory))
(insert
(if (eq emacsconf-publishing-phase 'program)
@@ -1162,21 +1177,47 @@ Entries are sorted chronologically, with different tracks interleaved."
(magit-stage-modified)
(magit-status-setup-buffer))))
+(defun emacsconf-publish-schedule-svg-snippets ()
+ (interactive)
+ (let* ((info (emacsconf-get-talk-info))
+ (by-day (emacsconf-by-day info))
+ (year-dir (expand-file-name emacsconf-year emacsconf-directory))
+ (width 800)
+ (height 300))
+ (emacsconf-publish-with-wiki-change
+ (with-temp-file (expand-file-name "schedule-image.md" year-dir)
+ (insert "<div class=\"schedule-svg-container\">")
+ (svg-print (emacsconf-schedule-svg 800 300 (emacsconf-get-talk-info)))
+ (insert "</div>"))
+ (mapc (lambda (day)
+ (let ((start (date-to-time (concat (car day) "T09:00:00" emacsconf-timezone-offset)))
+ (end (date-to-time (concat (car day) "T17:00:00" emacsconf-timezone-offset))))
+ (with-temp-file (expand-file-name (concat "schedule-" (car day) ".md") year-dir)
+ (insert "<div class=\"schedule-svg-container\">")
+ (svg-print (emacsconf-schedule-svg-day
+ (svg-create width (/ height (length by-day)))
+ (format-time-string "%A" (plist-get (cadr day) :start-time) emacsconf-timezone)
+ width (/ height (length by-day))
+ start end
+ (emacsconf-by-track (cdr day))))
+ (insert "</div>"))))
+ by-day))))
+
(defun emacsconf-publish-watch-pages ()
"Update /year/watch pages."
(interactive)
(emacsconf-publish-with-wiki-change
+
(mapc (lambda (track)
(plist-put track :year emacsconf-year)
(plist-put track :stream (concat emacsconf-stream-base (plist-get track :id) ".webm"))
(plist-put track :480p (concat emacsconf-stream-base (plist-get track :id) "-480p.webm"))
- (plist-put track :webchat (concat emacsconf-chat-base "?join=emacsconf-" (plist-get track :id)))
+ (plist-put track :webchat (concat emacsconf-chat-base "?join=emacsconf,emacsconf-" (plist-get track :id)))
(plist-put track :channel (concat "#emacsconf-" (plist-get track :id))))
emacsconf-tracks)
(let* ((info (sort (emacsconf-get-talk-info) #'emacsconf-sort-by-scheduled))
(emacsconf-publishing-phase 'schedule)
- (sched (with-temp-buffer (svg-print (emacsconf-schedule-svg 800 300 (emacsconf-get-talk-info)))
- (buffer-string))))
+ (sched (format "[[!inline pages=\"internal(%s/schedule-image)\" raw=\"yes\"]]" emacsconf-year)))
(unless (file-directory-p (expand-file-name "watch" (expand-file-name emacsconf-year emacsconf-directory)))
(make-directory (expand-file-name "watch" (expand-file-name emacsconf-year emacsconf-directory))))
(with-temp-file (expand-file-name "watch/info.md" (expand-file-name emacsconf-year emacsconf-directory))
@@ -1212,6 +1253,7 @@ Entries are sorted chronologically, with different tracks interleaved."
emacsconf-tracks
" - "))
:sched sched
+ :year emacsconf-year
:talks (mapconcat #'emacsconf-publish-sched-directive
(seq-filter (lambda (o) (string= (plist-get o :track)
(plist-get track :name)))
@@ -1219,7 +1261,7 @@ Entries are sorted chronologically, with different tracks interleaved."
"\n"))
track)
"<!-- Automatically generated by emacsconf-publish-watch-pages -->
-[[!inline pages=\"internal(2022/info/watch-announce)\" raw=\"yes\"]]
+[[!inline pages=\"internal(${year}/watch/announce)\" raw=\"yes\"]]
[[!meta title=\"${name} stream\"]]
[[!sidebar content=\"\"]]