Browse Source

Do not output headlines without backlinks in dynamic blocks

master
Daniel Borchmann 1 month ago
parent
commit
c572451c14
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
  1. 20
      site-lisp/db-org.el

20
site-lisp/db-org.el

@ -1046,16 +1046,16 @@ PARAMS may contain the following values:
;; Formatting.
(insert (format "| Item | Backlinks | Priority |\n|---|"))
(dolist (headline headlines)
(insert (format "\n| %s |\n|---|" (db/org--format-link-with-headline (car headline))))
(let ((backlink-lines (-> (mapcar #'(lambda (backlink-id)
(list (db/org--format-link-with-headline backlink-id)
(org-entry-get (org-id-find backlink-id 'marker)
"PRIORITY")))
(cdr headline))
(cl-sort #'string< :key #'cl-second))))
(dolist (line backlink-lines)
(insert (apply #'format "\n| | %s | %s |" line)))
(when backlink-lines ; only print closing hline when there's something to close
(when (cdr headline) ; do not print backlinks if there are none
(insert (format "\n| %s |\n|---|" (db/org--format-link-with-headline (car headline))))
(let ((backlink-lines (-> (mapcar #'(lambda (backlink-id)
(list (db/org--format-link-with-headline backlink-id)
(org-entry-get (org-id-find backlink-id 'marker)
"PRIORITY")))
(cdr headline))
(cl-sort #'string< :key #'cl-second))))
(dolist (line backlink-lines)
(insert (apply #'format "\n| | %s | %s |" line)))
(insert "\n|---|"))))
(org-table-align)))

Loading…
Cancel
Save