mirror of
https://github.com/org-roam/org-roam
synced 2025-08-07 12:47:23 -05:00
(feat): optionally use headline as title (#538)
Optionally pulls title from the first headline in Org file. Closes #506.
This commit is contained in:
@ -10,6 +10,9 @@
|
|||||||
* [#509](https://github.com/jethrokuan/org-roam/pull/509) fix external org files being tracked in database
|
* [#509](https://github.com/jethrokuan/org-roam/pull/509) fix external org files being tracked in database
|
||||||
* [#537](https://github.com/jethrokuan/org-roam/pull/537) quote graphviz node and edge configuration options to allow multi-word configurations
|
* [#537](https://github.com/jethrokuan/org-roam/pull/537) quote graphviz node and edge configuration options to allow multi-word configurations
|
||||||
|
|
||||||
|
### Features
|
||||||
|
* [#538](https://github.com/jethrokuan/org-roam/pull/538) Optionally use text in first headline as title
|
||||||
|
|
||||||
## 1.1.0 (21-04-2020)
|
## 1.1.0 (21-04-2020)
|
||||||
|
|
||||||
To the average user, this release is mainly a bugfix release with additional options to customize. However, the changes made to the source is significant. Most notably, in this release:
|
To the average user, this release is mainly a bugfix release with additional options to customize. However, the changes made to the source is significant. Most notably, in this release:
|
||||||
|
14
org-roam.el
14
org-roam.el
@ -246,11 +246,19 @@ it as FILE-PATH."
|
|||||||
|
|
||||||
(defun org-roam--extract-titles ()
|
(defun org-roam--extract-titles ()
|
||||||
"Extract the titles from current buffer.
|
"Extract the titles from current buffer.
|
||||||
Titles are obtained via the #+TITLE property, or aliases
|
Titles are obtained via:
|
||||||
specified via the #+ROAM_ALIAS property."
|
|
||||||
|
1. The #+TITLE property or the first headline
|
||||||
|
2. The aliases specified via the #+ROAM_ALIAS property."
|
||||||
(let* ((props (org-roam--extract-global-props '("TITLE" "ROAM_ALIAS")))
|
(let* ((props (org-roam--extract-global-props '("TITLE" "ROAM_ALIAS")))
|
||||||
(aliases (cdr (assoc "ROAM_ALIAS" props)))
|
(aliases (cdr (assoc "ROAM_ALIAS" props)))
|
||||||
(title (cdr (assoc "TITLE" props)))
|
(title (or (cdr (assoc "TITLE" props))
|
||||||
|
(org-element-map
|
||||||
|
(org-element-parse-buffer)
|
||||||
|
'headline
|
||||||
|
(lambda (h)
|
||||||
|
(org-no-properties (org-element-property :raw-value h)))
|
||||||
|
:first-match t)))
|
||||||
(alias-list (org-roam--aliases-str-to-list aliases)))
|
(alias-list (org-roam--aliases-str-to-list aliases)))
|
||||||
(if title
|
(if title
|
||||||
(cons title alias-list)
|
(cons title alias-list)
|
||||||
|
Reference in New Issue
Block a user