From 1e7f47df29053c2a197ee4a143f6ea198167b4fc Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Tue, 26 Sep 2023 12:59:10 -0400 Subject: Recognize multiple time constraints --- emacsconf-publish.el | 87 ++++++++++++++++++++++++++------------------------- emacsconf-schedule.el | 16 +++++++--- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 3657012..a8f2495 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -492,49 +492,50 @@ resources." (timestamp (org-timestamp-from-string (plist-get o :scheduled)))) (emacsconf-replace-plist-in-string (append o - (list :format - (concat (or (plist-get o :video-time) - (plist-get o :time)) - "-min talk" - (if (plist-get o :q-and-a) - (format " followed by %s Q&A%s" - (plist-get o :q-and-a) - (if (eq emacsconf-publishing-phase 'conference) - (format " (%s)" - (if (string-match "live" (plist-get o :q-and-a)) - (if (eq 'after (emacsconf-bbb-status o)) - "done" - (format "" (plist-get o :slug))) - (emacsconf-publish-webchat-link o))) - "")) - "")) - :pad-info - (if emacsconf-publish-include-pads - (format "Etherpad: \n" emacsconf-year (plist-get o :slug)) - "") - :irc-info - (format "Discuss on IRC: [#%s](%s) \n" (plist-get o :channel) - (plist-get o :webchat-url)) - :status-info - (if (member emacsconf-publishing-phase '(cfp program schedule conference)) (format "Status: %s \n" (plist-get o :status-label)) "") - :schedule-info - (if (and (member emacsconf-publishing-phase '(schedule conference)) - (not (emacsconf-talk-all-done-p o)) - (not (string= (plist-get o :status) "CANCELLED"))) - (let ((start (org-timestamp-to-time (org-timestamp-split-range timestamp))) - (end (org-timestamp-to-time (org-timestamp-split-range timestamp t)))) - (format - "
Times in different timezones:
%s
which is the same as:
%s
Find out how to watch and participate
" - (format-time-string "%Y-%m-%dT%H:%M:%SZ" start t) - (format-time-string "%Y-%m-%dT%H:%M:%SZ" end t) - (emacsconf-timezone-string o emacsconf-timezone) - (string-join (emacsconf-timezone-strings - o - (seq-remove (lambda (zone) (string= emacsconf-timezone zone)) - emacsconf-timezones)) "
") - emacsconf-year - (plist-get (emacsconf-get-track (plist-get o :track)) :id))) - ""))) + (list + :format + (concat (or (plist-get o :video-time) + (plist-get o :time)) + "-min talk" + (if (plist-get o :q-and-a) + (format " followed by %s Q&A%s" + (plist-get o :q-and-a) + (if (eq emacsconf-publishing-phase 'conference) + (format " (%s)" + (if (string-match "live" (plist-get o :q-and-a)) + (if (eq 'after (emacsconf-bbb-status o)) + "done" + (format "" (plist-get o :slug))) + (emacsconf-publish-webchat-link o))) + "")) + "")) + :pad-info + (if emacsconf-publish-include-pads + (format "Etherpad: \n" emacsconf-year (plist-get o :slug)) + "") + :irc-info + (format "Discuss on IRC: [#%s](%s) \n" (plist-get o :channel) + (plist-get o :webchat-url)) + :status-info + (if (member emacsconf-publishing-phase '(cfp program schedule conference)) (format "Status: %s \n" (plist-get o :status-label)) "") + :schedule-info + (if (and (member emacsconf-publishing-phase '(schedule conference)) + (not (emacsconf-talk-all-done-p o)) + (not (string= (plist-get o :status) "CANCELLED"))) + (let ((start (org-timestamp-to-time (org-timestamp-split-range timestamp))) + (end (org-timestamp-to-time (org-timestamp-split-range timestamp t)))) + (format + "
Times in different timezones:
%s
which is the same as:
%s
" + (format-time-string "%Y-%m-%dT%H:%M:%SZ" start t) + (format-time-string "%Y-%m-%dT%H:%M:%SZ" end t) + (emacsconf-timezone-string o emacsconf-timezone) + (string-join (emacsconf-timezone-strings + o + (seq-remove (lambda (zone) (string= emacsconf-timezone zone)) + emacsconf-timezones)) "
") + emacsconf-year + (plist-get (emacsconf-get-track (plist-get o :track)) :id))) + ""))) (concat "[[!toc ]] Format: ${format} diff --git a/emacsconf-schedule.el b/emacsconf-schedule.el index 644d818..885cada 100644 --- a/emacsconf-schedule.el +++ b/emacsconf-schedule.el @@ -642,11 +642,17 @@ Both start and end time are tested." (defun emacsconf-schedule-get-time-constraint (o) (unless (string-match "after the event" (or (plist-get o :q-and-a) "")) (let ((avail (or (plist-get o :availability) "")) - hours) - (when (string-match "\\([<>]\\)=? *\\([0-9]+:[0-9]+\\) *EST" avail) - (if (string= (match-string 1 avail) ">") - (list (match-string 2 avail) nil) - (list nil (match-string 2 avail))))))) + hours + start + (pos 0) + (result (list nil nil))) + (while (string-match "\\([<>]\\)=? *\\([0-9]+:[0-9]+\\) *EST" avail pos) + (setf (elt result (if (string= (match-string 1 avail) ">") + 0 + 1)) + (match-string 2 avail)) + (setq pos (match-end 0))) + result))) (defun emacsconf-schedule-validate-all-talks-present (sched &optional list) (let* ((sched-slugs (mapcar (lambda (o) (plist-get o :slug)) -- cgit v1.2.3