summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-09-27 16:13:22 -0400
committerSacha Chua <sacha@sachachua.com>2022-09-27 16:13:22 -0400
commit828dc02ef5fd878e95c2b5e5ad56d32a4fd08f27 (patch)
tree8cceefebecca7e3d0efd3f179aae058d6d3ef702
parent1a6997d1da94f3bed859f5170a1e2f70ce6aa1a0 (diff)
downloademacsconf-el-828dc02ef5fd878e95c2b5e5ad56d32a4fd08f27.tar.xz
emacsconf-el-828dc02ef5fd878e95c2b5e5ad56d32a4fd08f27.zip
Handle comments and validation
-rw-r--r--emacsconf.el48
1 files changed, 34 insertions, 14 deletions
diff --git a/emacsconf.el b/emacsconf.el
index 63fb6f0..9411adf 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -166,13 +166,13 @@
(delq nil
(org-map-entries
(lambda ()
- (when (org-entry-get (point) "SLUG")
- (cons
- (concat (org-entry-get (point) "SLUG") " - "
- (org-entry-get (point) "ITEM") " - "
- (org-entry-get (point) "NAME") " - "
- (org-entry-get (point) "EMAIL"))
- (point)))))))))
+ (cons
+ (concat (org-entry-get (point) "SLUG") " - "
+ (org-entry-get (point) "ITEM") " - "
+ (org-entry-get (point) "NAME") " - "
+ (org-entry-get (point) "EMAIL"))
+ (point)))
+ "SLUG={.}")))))
(goto-char
(if search
(or (org-find-property "SLUG" search)
@@ -181,6 +181,10 @@
choices)))
(org-reveal))))
+(defmacro emacsconf-for-each-talk (&rest body)
+ (declare (indent 0) (debug t))
+ `(org-map-entries (lambda () ,@body) "SLUG={.}"))
+
(defmacro emacsconf-with-talk-heading (search &rest body)
(declare (indent 1) (debug t))
`(progn
@@ -681,20 +685,21 @@ Include some other things, too, such as emacsconf-year, title, name, email, url,
emacsconf-timezone))))
;;; Etherpad
+(defvar emacsconf-review-comments-heading "Comments")
(defun emacsconf-import-comments-from-etherpad-text (filename)
(interactive "FEtherpad text export: ")
(with-temp-buffer
(insert-file-contents filename)
(goto-char (point-min))
- (while (re-search-forward "^\t+Comments for \\([^:]+\\)" nil t)
+ (while (re-search-forward "^[\t ]+Comments for \\([^:]+\\)" nil t)
(let ((slug (match-string 1))
comments)
(forward-line 1)
(setq comments
(split-string
- (replace-regexp-in-string
- "\t\t\\*"
- "- "
+ (replace-regexp-in-string
+ "\t\t\\*[ \t]*"
+ ""
(buffer-substring-no-properties
(point)
(if (re-search-forward "^[^\t]" nil t)
@@ -704,11 +709,12 @@ Include some other things, too, such as emacsconf-year, title, name, email, url,
(save-window-excursion
(emacsconf-with-talk-heading slug
;; Do we already have a heading for comments?
- (if (re-search-forward "^\\(\\*+\\) +Review comments" (save-excursion (org-end-of-subtree)) t)
+ (if (re-search-forward (concat "^\\(\\*+\\) +" emacsconf-review-comments-heading)
+ (save-excursion (org-end-of-subtree)) t)
(org-end-of-meta-data)
(org-end-of-subtree)
(org-insert-heading-after-current)
- (insert "Review comments\n"))
+ (insert emacsconf-review-comments-heading "\n"))
;; Are these comments already included?
(save-restriction
(org-narrow-to-subtree)
@@ -717,7 +723,21 @@ Include some other things, too, such as emacsconf-year, title, name, email, url,
(unless (re-search-forward (regexp-quote o) nil t)
(goto-char (point-max))
(unless (bolp) (insert "\n"))
- (insert o "\n")))
+ (insert "- " o "\n")))
comments))))))))
+
+(defun emacsconf-validate-all-talks-have-comments-for-speakers ()
+ (interactive)
+ (emacsconf-for-each-talk
+ (unless (re-search-forward "^\\(- \\)?For \\(the \\)?[^ ]+ speaker" (save-excursion (org-end-of-subtree) (point)) t)
+ (error "Could not find comment for %s" (org-entry-get (point) "SLUG"))))
+ t)
+
+(defun emacsconf-validate-all-talks-have-field (field)
+ (emacsconf-for-each-talk
+ (when (string= (or (org-entry-get (point) field) "") "")
+ (error "%s is missing %s" (org-entry-get (point) "SLUG") field)))
+ t)
+
(provide 'emacsconf)
;;; emacsconf.el ends here