(feat): prefer lowercase versions of org in-file settings (#769)

See #768
This commit is contained in:
N V
2020-06-07 01:55:07 -04:00
committed by GitHub
parent 14f83bdb07
commit 5bf3e596c8
5 changed files with 48 additions and 45 deletions

View File

@ -250,16 +250,16 @@ Org-roam calls =org-roam--extract-titles= to extract titles. It uses the
variable =org-roam-title-sources=, to control how the titles are extracted. The
title extraction methods supported are:
1. ='title=: This extracts the title using the file =#+TITLE= property
1. ='title=: This extracts the title using the file =#+title= property
2. ='headline=: This extracts the title from the first headline in the Org file
3. ='alias=: This extracts a list of titles using the =#ROAM_ALIAS= property.
3. ='alias=: This extracts a list of titles using the =#+roam_alias= property.
The aliases are space-delimited, and can be multi-worded using quotes
Take for example the following org file:
#+BEGIN_SRC org
#+TITLE: World War 2
#+ROAM_ALIAS: "WWII" "World War II"
#+title: World War 2
#+roam_alias: "WWII" "World War II"
* Headline
#+END_SRC
@ -290,7 +290,7 @@ Org-roam calls =org-roam--extract-tags= to extract tags from files. It uses the
variable =org-roam-tag-sources=, to control how tags are extracted. The tag
extraction methods supported are:
1. ='prop=: This extracts tags from the =#+ROAM_TAGS= property. Tags are space delimited, and can be multi-word using double quotes.
1. ='prop=: This extracts tags from the =#+roam_tags= property. Tags are space delimited, and can be multi-word using double quotes.
2. ='all-directories=: All sub-directories relative to =org-roam-directory= are
extracted as tags. That is, if a file is located at relative path
=foo/bar/file.org=, the file will have tags =foo= and =bar=.
@ -316,8 +316,8 @@ Refs are unique identifiers for files. Each note can only have 1 ref.
For example, a note for a website may contain a ref:
#+BEGIN_SRC org
#+TITLE: Google
#+ROAM_KEY: https://www.google.com/
#+title: Google
#+roam_key: https://www.google.com/
#+END_SRC
These keys come in useful for when taking website notes, using the
@ -327,8 +327,8 @@ Alternatively, add a ref for notes for a specific paper, using its
[[https://github.com/jkitchin/org-ref][org-ref]] citation key:
#+BEGIN_SRC org
#+TITLE: Neural Ordinary Differential Equations
#+ROAM_KEY: cite:chen18_neural_ordin_differ_equat
#+title: Neural Ordinary Differential Equations
#+roam_key: cite:chen18_neural_ordin_differ_equat
#+END_SRC
The backlinks buffer will show any cites of this key: e.g.
@ -363,7 +363,7 @@ the default template, reproduced below.
("d" "default" plain (function org-roam--capture-get-point)
"%?"
:file-name "%<%Y%m%d%H%M%S>-${slug}"
:head "#+TITLE: ${title}\n"
:head "#+title: ${title}\n"
:unnarrowed t)
#+END_SRC
@ -419,7 +419,7 @@ directly to provide its third argument to specify UTC.
("d" "default" plain (function org-roam--capture-get-point)
"%?"
:file-name "%(format-time-string \"%Y-%m-%d--%H-%M-%SZ--${slug}\" (current-time) t)"
:head "#+TITLE: ${title}\n"
:head "#+title: ${title}\n"
:unnarrowed t)
#+END_SRC
@ -782,7 +782,7 @@ settings:
where =template= is the template key for a template in
=org-roam-capture-ref-templates= (see [[*The Templating System][The Templating System]]). These templates
should contain a =#+ROAM_KEY: ${ref}= in it.
should contain a =#+roam_key: ${ref}= in it.
* TODO Daily Notes
@ -923,7 +923,7 @@ to see all dated entries.
:bind
("C-c n j" . org-journal-new-entry)
:custom
(org-journal-date-prefix "#+TITLE: ")
(org-journal-date-prefix "#+title: ")
(org-journal-file-format "%Y-%m-%d.org")
(org-journal-dir "/path/to/org-roam-files/")
(org-journal-date-format "%A, %d %B %Y"))

View File

@ -383,19 +383,19 @@ title extraction methods supported are:
@enumerate
@item
@samp{'title}: This extracts the title using the file @samp{#+TITLE} property
@samp{'title}: This extracts the title using the file @samp{#+title} property
@item
@samp{'headline}: This extracts the title from the first headline in the Org file
@item
@samp{'alias}: This extracts a list of titles using the @samp{#ROAM_ALIAS} property.
@samp{'alias}: This extracts a list of titles using the @samp{#+roam_alias} property.
The aliases are space-delimited, and can be multi-worded using quotes
@end enumerate
Take for example the following org file:
@example
#+TITLE: World War 2
#+ROAM_ALIAS: "WWII" "World War II"
#+title: World War 2
#+roam_alias: "WWII" "World War II"
* Headline
@end example
@ -434,7 +434,7 @@ extraction methods supported are:
@enumerate
@item
@samp{'prop}: This extracts tags from the @samp{#+ROAM_TAGS} property. Tags are space delimited, and can be multi-word using double quotes.
@samp{'prop}: This extracts tags from the @samp{#+roam_tags} property. Tags are space delimited, and can be multi-word using double quotes.
@item
@samp{'all-directories}: All sub-directories relative to @samp{org-roam-directory} are
extracted as tags. That is, if a file is located at relative path
@ -464,8 +464,8 @@ Refs are unique identifiers for files. Each note can only have 1 ref.
For example, a note for a website may contain a ref:
@example
#+TITLE: Google
#+ROAM_KEY: https://www.google.com/
#+title: Google
#+roam_key: https://www.google.com/
@end example
These keys come in useful for when taking website notes, using the
@ -475,8 +475,8 @@ Alternatively, add a ref for notes for a specific paper, using its
@uref{https://github.com/jkitchin/org-ref, org-ref} citation key:
@example
#+TITLE: Neural Ordinary Differential Equations
#+ROAM_KEY: cite:chen18_neural_ordin_differ_equat
#+title: Neural Ordinary Differential Equations
#+roam_key: cite:chen18_neural_ordin_differ_equat
@end example
The backlinks buffer will show any cites of this key: e.g.
@ -527,7 +527,7 @@ the default template, reproduced below.
("d" "default" plain (function org-roam--capture-get-point)
"%?"
:file-name "%<%Y%m%d%H%M%S>-$@{slug@}"
:head "#+TITLE: $@{title@}\n"
:head "#+title: $@{title@}\n"
:unnarrowed t)
@end lisp
@ -594,7 +594,7 @@ directly to provide its third argument to specify UTC@.
("d" "default" plain (function org-roam--capture-get-point)
"%?"
:file-name "%(format-time-string \"%Y-%m-%d--%H-%M-%SZ--$@{slug@}\" (current-time) t)"
:head "#+TITLE: $@{title@}\n"
:head "#+title: $@{title@}\n"
:unnarrowed t)
@end lisp
@ -1056,7 +1056,10 @@ settings:
where @samp{template} is the template key for a template in
@samp{org-roam-capture-ref-templates} (see @ref{The Templating System}). These templates
should contain a @samp{#+ROAM_KEY: $@{ref@}} in it.
should contain a @samp{#+roam_key: $@{ref@}} in it.
@node Daily Notes
@chapter @strong{TODO} Daily Notes
@node Diagnosing and Repairing Files
@chapter Diagnosing and Repairing Files
@ -1213,7 +1216,7 @@ to see all dated entries.
:bind
("C-c n j" . org-journal-new-entry)
:custom
(org-journal-date-prefix "#+TITLE: ")
(org-journal-date-prefix "#+title: ")
(org-journal-file-format "%Y-%m-%d.org")
(org-journal-dir "/path/to/org-roam-files/")
(org-journal-date-format "%A, %d %B %Y"))

View File

@ -50,7 +50,7 @@
(defvar org-roam-capture--file-name-default "%<%Y%m%d%H%M%S>"
"The default file name format for Org-roam templates.")
(defvar org-roam-capture--header-default "#+TITLE: ${title}\n"
(defvar org-roam-capture--header-default "#+title: ${title}\n"
"The default capture header for Org-roam templates.")
(defvar org-roam-capture--file-path nil
@ -85,7 +85,7 @@ note with the given `ref'.")
'(("d" "default" plain (function org-roam-capture--get-point)
"%?"
:file-name "%<%Y%m%d%H%M%S>-${slug}"
:head "#+TITLE: ${title}\n"
:head "#+title: ${title}\n"
:unnarrowed t))
"Capture templates for Org-roam.
The capture templates are an extension of
@ -110,8 +110,8 @@ applies.
'(("r" "ref" plain (function org-roam-capture--get-point)
""
:file-name "${slug}"
:head "#+TITLE: ${title}
#+ROAM_KEY: ${ref}\n"
:head "#+title: ${title}
#+roam_key: ${ref}\n"
:unnarrowed t))
"The Org-roam templates used during a capture from the roam-ref protocol.
Details on how to specify for the template is given in `org-roam-capture-templates'.")

View File

@ -74,20 +74,20 @@
("R" . ("Replace link (keep label)" . org-roam-doctor--replace-link-keep-label))))
(make-org-roam-doctor-checker
:name 'org-roam-doctor-check-roam-props
:description "Check #+ROAM_* properties.")
:description "Check #+roam_* properties.")
(make-org-roam-doctor-checker
:name 'org-roam-doctor-check-tags
:description "Check #+ROAM_TAGS.")
:description "Check #+roam_tags.")
(make-org-roam-doctor-checker
:name 'org-roam-doctor-check-alias
:description "Check #+ROAM_ALIAS.")))
:description "Check #+roam_alias.")))
(defconst org-roam-doctor--supported-roam-properties
'("ROAM_TAGS" "ROAM_ALIAS" "ROAM_KEY")
"List of supported Org-roam properties.")
(defun org-roam-doctor-check-roam-props (ast)
"Checker for detecting invalid #+ROAM_* properties.
"Checker for detecting invalid #+roam_* properties.
AST is the org-element parse tree."
(let (reports)
(org-element-map ast 'keyword
@ -105,7 +105,7 @@ AST is the org-element parse tree."
reports))
(defun org-roam-doctor-check-tags (ast)
"Checker for detecting invalid #+ROAM_TAGS.
"Checker for detecting invalid #+roam_tags.
AST is the org-element parse tree."
(let (reports)
(org-element-map ast 'keyword
@ -125,7 +125,7 @@ AST is the org-element parse tree."
reports))
(defun org-roam-doctor-check-alias (ast)
"Checker for detecting invalid #+ROAM_ALIAS.
"Checker for detecting invalid #+roam_alias.
AST is the org-element parse tree."
(let (reports)
(org-element-map ast 'keyword

View File

@ -178,10 +178,10 @@ It should be a list of symbols representing any of the following
extraction methods:
`prop'
Extract tags from the #+ROAM_TAGS property.
Extract tags from the #+roam_tags property.
Tags are space delimited.
Tags may contain spaces if they are double-quoted.
e.g. #+ROAM_TAGS: tag \"tag with spaces\"
e.g. #+roam_tags: TAG \"tag with spaces\"
`all-directories'
Extract sub-directories relative to `org-roam-directory'.
@ -192,7 +192,7 @@ extraction methods:
Extract the last directory relative to `org-roam-directory'.
That is, if a file is located at relative path foo/bar/file.org,
the file will have tag \"bar\"."
:type '(set (const :tag "#+ROAM_TAGS" prop)
:type '(set (const :tag "#+roam_tags" PROP)
(const :tag "sub-directories" all-directories)
(const :tag "parent directory" last-directory)))
@ -214,8 +214,8 @@ For example the setting: '((title headline) alias) means the following:
2. Or return 'headline + 'alias otherwise.
The currently supported symbols are:
1. 'title: The \"#+TITLE\" property of org file.
2. 'alias: The \"#+ROAM_ALIAS\" property of the org file, using
1. 'title: The \"#+title\" property of org file.
2. 'alias: The \"#+roam_alias\" property of the org file, using
space-delimited strings.
3. 'headline: The first headline in the org file."
:type '(repeat
@ -533,7 +533,7 @@ it as FILE-PATH."
links))
(defun org-roam--extract-titles-title ()
"Return title from \"#+TITLE\" of the current buffer."
"Return title from \"#+title\" of the current buffer."
(let* ((prop (org-roam--extract-global-props '("TITLE")))
(title (cdr (assoc "TITLE" prop))))
(when title
@ -596,7 +596,7 @@ The final directory component is used as a tag."
(last (f-split dir-relative))))
(defun org-roam--extract-tags-prop (_file)
"Extract tags from the current buffer's \"#ROAM_TAGS\" global property."
"Extract tags from the current buffer's \"#roam_tags\" global property."
(let* ((prop (cdr (assoc "ROAM_TAGS" (org-roam--extract-global-props '("ROAM_TAGS"))))))
(condition-case nil
(org-roam--str-to-list prop)
@ -615,7 +615,7 @@ Tags are obtained via:
1. Directory tags: Relative to `org-roam-directory': each folder
path is considered a tag.
2. The key #+ROAM_TAGS."
2. The key #+roam_tags."
(let* ((file (or file (buffer-file-name (buffer-base-buffer))))
(tags (mapcan (lambda (source)
(funcall (intern (concat "org-roam--extract-tags-"
@ -804,7 +804,7 @@ included as a candidate."
(defun org-roam--find-ref (ref)
"Find and open and Org-roam file from REF if it exists.
REF should be the value of '#+ROAM_KEY:' without any
REF should be the value of '#+roam_key:' without any
type-information (e.g. 'cite:').
Return nil if the file does not exist."
(when-let* ((completions (org-roam--get-ref-path-completions))