diff options
author | Brian Lester <[email protected]> | 2021-08-04 13:28:20 -0400 |
---|---|---|
committer | Brian Lester <[email protected]> | 2021-08-04 16:13:00 -0400 |
commit | 346f847fa2cb386e2ff20c55d2f4d80b22ce109f (patch) | |
tree | 8f5f05d9a30289ca463a5fc6d807a2ffba1d87e1 /screenshot.png | |
parent | 13a3a1bafb82fd35014ad71e3c0a4a97a216b623 (diff) |
Add the ability to retitle reference notes with bibliography
information.
This change adds the ability to update the title of notes that have a
`:ROAM_REFS:` property and an associated bibtex entry. The new title
will be created by `orb--pre-expand-template` and the
`org-roam-ui-ref-title-template`, just like citation nodes that don't
have associated nodes. This also requires that `org-ref` be loaded,
otherwise it falls back to the original title.
I put this behind another customizable variable in case it gets slow or
a user wants to title reference nodes with the title they actually have
in the node.
Currently the handing of citation links throughout `org-roam` and
`org-roam-bibtex` is rather scatter and seems rather brittle. At version
points, different code processes the `:ROAM_REF:` filed differently, and
it seems mostly because the fact that the default citation format
`cite:%s` is so simple is why it works. For example, when inserting a
ref into the database, org-roam uses the `org-link-plain-re` regex to
normalize the reference. This results in the `cite:` being removed. When
processing a link, it depends on the fact that `org` itself has split
the link to `:type` and `:path`. The `:path` (without the `cite:`) is
then inserted. In `org-roam-bibtex` they use `org-ref-cite-re` to
remove the `cite:`, turning it into a key that is in the bibliography.
In the PR, I followed the `org-roam-bibtex` method, parsing the
`:ROAM_REFS:` property directly. We could also update the db node query
to do a left outer join on the refs table. We then would have a new
`refs` field on the node (we wouldn't need to send this over the wire)
that is already formatted the way the database (and `org-roam-bibtex`)
expect it to be. Then we wouldn't need to worry about our parsing
getting out of sync with the other libraries. We would end up having to
deal with multiple rows for the same node if it has multiple `refs`. I
can look into a solution like this is we want.
Another small thing to note, is that `:ROAM_REFS` doesn't have to
specifically be a citation key for a bibliography. The examples have
things like linking to google.com and then that is a reference where
links to google can send you to your google note. In the UI we just
check if `:ROAM_REFS:` is a there or not to making something a citation.
Eventually we may want to actually include the `type` field from the
`refs` table and make our decision based on that instead.
Diffstat (limited to 'screenshot.png')
0 files changed, 0 insertions, 0 deletions