From 94f1d4c4fef71b5012eefcce57e5ca781134ab92 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 30 Sep 2022 12:10:19 -0400 Subject: More tweaks --- emacsconf-publish.el | 105 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 36 deletions(-) (limited to 'emacsconf-publish.el') diff --git a/emacsconf-publish.el b/emacsconf-publish.el index b3fed02..1031365 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -44,7 +44,7 @@ "Publish the schedule page and the page for this talk." (interactive) (emacsconf-upcoming-insert-or-update) - (emacsconf-generate-schedule-page (emacsconf-get-talk-info-for-subtree)) + (emacsconf-generate-before-page (emacsconf-get-talk-info-for-subtree)) (emacsconf-generate-main-schedule)) (defun emacsconf-update-conf-html () @@ -205,16 +205,23 @@ ${chapter-list} ""))) "
")))) -(when (featurep 'memoize) - (memoize #'compile-media-get-file-duration-ms)) +(condition-case nil + (when (featurep 'memoize) + (memoize #'compile-media-get-file-duration-ms)) + nil) + +(defun emacsconf-format-public-email (o &optional email) + (format "[%s](mailto:%s?subject=%s)" + (or email (plist-get o :public-email)) + (or email (plist-get o :public-email)) + (url-hexify-string (format "Comment for EmacsConf 2022 %s: %s" (plist-get o :slug) (plist-get o :title))))) (defun emacsconf-format-speaker-info (o) (let ((extra-info (mapconcat #'identity (delq nil (list - (plist-get o :pronunciation) - (plist-get o :pronouns) - (when (plist-get o :public-email) - (replace-regexp-in-string "@" " at " (plist-get o :public-email))))) + (unless (string= (plist-get o :pronunciation) "nil") (plist-get o :pronunciation)) + (unless (string= (plist-get o :pronouns) "nil") (plist-get o :pronouns)) + (when (plist-get o :public-email) (format "[%s]")))) ", "))) (concat (plist-get o :speakers) (if (> (length extra-info) 0) @@ -234,8 +241,13 @@ ${chapter-list} (emacsconf-replace-plist-in-string (emacsconf-convert-talk-abstract-to-markdown (append o (list + :speaker-info (emacsconf-format-speaker-info talk) :meta "!meta" - :speaker-info (emacsconf-format-speaker-info o)))) + :categories (if (plist-get o :categories) + (mapconcat (lambda (o) (format "[[!taglink %s]]" o)) + (plist-get o :categories) + " ") + "")))) "[[${meta} title=\"${title}\"]] [[${meta} copyright=\"Copyright © ${year} ${speakers}\"]] [[!inline pages=\"internal(${year}/info/${slug}-nav)\" raw=\"yes\"]] @@ -246,17 +258,15 @@ ${chapter-list} # ${title} ${speaker-info} - +[[!inline pages=\"internal(${year}/info/${slug}-before)\" raw=\"yes\"]] ${abstract-md} -# Links - -# Discussion - -[[!inline pages=\"internal(${year}/info/${slug}-schedule)\" raw=\"yes\"]] +[[!inline pages=\"internal(${year}/info/${slug}-after)\" raw=\"yes\"]] [[!inline pages=\"internal(${year}/info/${slug}-nav)\" raw=\"yes\"]] + +${categories} ")))))) (defun emacsconf-generate-talk-pages (emacsconf-info force) @@ -299,7 +309,6 @@ 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) @@ -324,36 +333,60 @@ resources." (if (plist-get o :public) (emacsconf-wiki-talk-resources o) "") "\n# Description\n\n"))) -(defun emacsconf-generate-schedule-page (talk) +(defun emacsconf-format-email-questions-and-comments (talk) + (format "Questions or comments? Please e-mail %s" + (emacsconf-format-public-email talk (or (plist-get talk :public-email) "emacsconf-org-private@gnu.org")))) + +(defun emacsconf-generate-before-page (talk) + "Info included before the abstract." (interactive (list (emacsconf-get-talk-info-for-subtree))) - (with-temp-file (expand-file-name (format "%s-schedule.md" (plist-get talk :slug)) + (with-temp-file (expand-file-name (format "%s-before.md" (plist-get talk :slug)) (expand-file-name "info" (expand-file-name emacsconf-year emacsconf-directory))) - - (unless (eq emacsconf-publishing-phase 'process) - (insert - "\n\n" - (emacsconf-format-talk-schedule-info talk) "\n")))) - -(defun emacsconf-generate-info-pages () - (interactive) - "Populate year/info/*-nav and *-schedule.md files." - (let* ((talks (seq-remove (lambda (o) (string= (plist-get o :status) "CANCELLED")) - (emacsconf-filter-talks (emacsconf-get-talk-info)))) - (next-talks (cdr talks)) + (insert "\n") + (when (eq emacsconf-publishing-phase 'schedule) + (insert "\n" + (emacsconf-format-talk-schedule-info talk) "\n")) + ;; Contact information + (insert "\n\n" (emacsconf-format-email-questions-and-comments talk) "\n") + (insert ""))) + +(defun emacsconf-generate-after-page (talk &optional info) + "Info included before the abstract." + (interactive (list (emacsconf-get-talk-info-for-subtree))) + ;; 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 "\n") + (insert "\n\n" + (emacsconf-format-email-questions-and-comments talk) "\n") + (insert "\n"))) + +(defun emacsconf-generate-nav-pages (&optional talks) + (interactive (list + (seq-remove (lambda (o) (string= (plist-get o :status) "CANCELLED")) + (sort (emacsconf-filter-talks (emacsconf-get-talk-info)) #'emacsconf-sort-by-scheduled)))) + (let* ((next-talks (cdr talks)) (prev-talks (cons nil talks))) (unless (file-directory-p (expand-file-name "info" (expand-file-name emacsconf-year emacsconf-directory))) (mkdir (expand-file-name "info" (expand-file-name emacsconf-year emacsconf-directory)))) (while talks (let* ((o (pop talks)) (next-talk (emacsconf-format-talk-link (pop next-talks))) - (prev-talk (emacsconf-format-talk-link (pop prev-talks))) - (nav-links (format "Back to the [[talks]] \n%s%s" - (if prev-talk (format "Previous: %s \n" prev-talk) "") - (if next-talk (format "Next: %s \n" next-talk) "")))) + (prev-talk (emacsconf-format-talk-link (pop prev-talks)))) (with-temp-file (expand-file-name (format "%s-nav.md" (plist-get o :slug)) (expand-file-name "info" (expand-file-name emacsconf-year emacsconf-directory))) - (insert nav-links)) - (emacsconf-generate-schedule-page o))))) + (insert (format "Back to the [[talks]] \n%s%s" + (if prev-talk (format "Previous: %s \n" prev-talk) "") + (if next-talk (format "Next: %s \n" next-talk) "")))))))) + +(defun emacsconf-generate-info-pages () + (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 (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))) (defun emacsconf-generate-talks-page (emacsconf-info) (interactive "p") @@ -378,7 +411,7 @@ resources." (defun emacsconf-generate-main-schedule (&optional filename) (interactive) (with-temp-file (expand-file-name "schedule-details.md" (expand-file-name emacsconf-year emacsconf-directory)) - (insert (emacsconf-format-main-schedule (emacsconf-get-talk-info))))) + (insert (emacsconf-format-main-schedule (sort (emacsconf-get-talk-info) #'emacsconf-sort-by-scheduled))))) (defun emacsconf-format-talk-link (talk) (and talk (if (plist-get talk :slug) -- cgit v1.2.3