Samuel Wales <samolog...@gmail.com> writes:

> i need to export a plain list with a noexport feature per item.
> the list is a timeline with some items having timestamps.
>
> one design idea was that i would specify this with [X] (checkbox
> checked).
>
> exported:
>   1) i left msg for A
>   2) [2024-11-09 Sat 13:22] i left msg for A
>   3) [ ] i left msg for A
>   4) [ ] [2024-11-09 Sat 13:22] i left msg for A
> not exported:
>   1) [X] i left msg for A
>   2) [X] [2024-11-09 Sat 13:15] i left msg for A
>
> so it could be used for only exporting not yet done items, or
> items that should be exported depending on audience.

(add-hook 'org-export-filter-parse-tree-functions #'yant/filter-checked-items)

(defun yant/filter-checked-items (data _backend info)
  "Remove items with checked checkbox from DATA."
  (org-element-map data 'item
    (lambda (item)
      (when (eq 'on (org-element-property :checkbox item))
        (org-element-extract-element item)))
    info)
  ;; return modified data                                       
  data)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to