Compare commits

...
4 Commits
Author SHA1 Message Date
jlamothe df2a9a70b3 defined pt-get-body 2025-05-12 18:01:59 -04:00
jlamothe 7e2b9f3dde variable rename 2025-05-12 16:14:19 -04:00
jlamothe f253c63db3 minor stylistic change 2025-05-12 10:15:17 -04:00
jlamothe accb675a7e fixed pt-get-columns 2025-05-12 09:51:10 -04:00
+16 -5
View File
@@ -40,18 +40,29 @@ TODO: more documentation"
(dolist (record src-body)
(pt--process-record record source-cols buckets))))
(defun pt-get-columns (source)
(defun pt-get-columns (table)
"Extract the column names from a table"
(let (result)
(dolist (row source)
(unless (and (listp row) (eq "!" (car row)))
(dolist (row table)
(when (and (listp row) (equal (car row) "!"))
(let ((n 2))
(dolist (cell (cdr row))
(unless (eq cell "")
(setq result (((format "%s" cell) . n) . result)))
(unless (equal cell "")
(push (cons (format "%s" cell) n) result))
(setq n (1+ n))))))
result))
(defun pt-get-body (source)
"Discards all rows from a table before the first hline (if present)
If there is no hline, the table is instead returned unaltered."
(catch :return
(let ((remain source))
(while remain
(when (eq (car remain) 'hline)
(throw :return (cdr remain)))
(pop remain))
source)))
;; Local Variables:
;; read-symbol-shorthands: (("pt-" . "pivot-table-"))
;; End: