Do not output headlines without backlinks in dynamic blocks

This commit is contained in:
Daniel - 2022-05-20 19:09:39 +02:00
parent 99dbd00e71
commit c572451c14
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 10 additions and 10 deletions

View File

@ -1046,6 +1046,7 @@ PARAMS may contain the following values:
;; Formatting.
(insert (format "| Item | Backlinks | Priority |\n|---|"))
(dolist (headline headlines)
(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)
@ -1055,7 +1056,6 @@ PARAMS may contain the following values:
(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
(insert "\n|---|"))))
(org-table-align)))