Comments (4)
We're using Org-roam's org-roam--title-to-slug
to generate the name of the files:
https://github.com/zaeph/org-roam-bibtex/blob/6bbdebb39d7edf9b369c16311afa18cf00cecffc/org-roam-bibtex.el#L493
I think this is safe to drop this, but I'm going to run some tests first.
from org-roam-bibtex.
@tmalsburg Just don't use ${slug} in :file-name
- You can use the citekey directly like this:
(setq org-roam-bibtex-preformat-templates t
org-roam-bibtex-preformat-keywords '(("citekey" . "=key="))
org-roam-bibtex-templates
'(("r" "ref" plain #'org-roam-capture--get-point
"%?"
:file-name "references/${citekey}"
:head "#+TITLE: ${title}\n#+ROAM_KEY: ${ref}\n"
:unnarrowed t)))
- Above, the difference between "citekey" and "ref" is that the latter is a kind of hardcoded internal and will be formatted according to the format specified in
org-roam-bibtex-citekey-format
(cite:%s
by default, if it'snil
then "ref" is the citekey). So the following will also work yielding the identical result:
(setq org-roam-bibtex-preformat-templates nil
org-roam-bibtex-citekey-format nil
org-roam-bibtex-preformat-keywords nil
org-roam-bibtex-templates
'(("r" "ref" plain #'org-roam-capture--get-point
"%?"
:file-name "references/${ref}"
:head "#+TITLE: ${title}\n#+ROAM_KEY: cite:${ref}\n"
:unnarrowed t)))
- Alternatively, the same result can be achieved with
org-roam-capture-templates
(to use these one must setorg-roam-bibtex-templates
tonil
, however).
(setq org-roam-capture-templates
'(("r" "reference" plain (function org-roam-capture--get-point)
"%?"
:file-name "references/${citekey}"
:head "#+TITLE: ${title}\n#+ROAM_KEY: cite:${citekey}\n"
:unnarrowed t)))
- Note that extra things in
:head
can be moved into the template string (5th element of the list). For preformatting to take place one has to use Org-capture's%^{...}
syntax instead of${...}
used in:file-name
and:head
, which are Org-roam's add-ons to Org-capture.
(setq org-roam-capture-templates
'(("r" "reference" plain (function org-roam-capture--get-point)
"#+ROAM_KEY: cite:%^{citekey}\n%?"
:file-name "references/${citekey}"
:head "#+TITLE: ${title}\n"
:unnarrowed t)))
- Pay attention that in order to use custom bibtex-aware wildcards in the templates, make sure
org-roam-bibtex-preformat-templates
ist
and the bibtex key field is set for preformatting:
(setq org-roam-bibtex-preformat-keywords "=key=")
(setq ... templates ...
... :file-name "${=key=}" ...
or
(setq org-roam-bibtex-preformat-keywords '(("myverybestcitekey" . "=key=")))
(setq ... templates ...
... :file-name "${myverybestcitekey}" ...
By the way, this works with any bibtex field as retrieved by bibtex-completion-apa-get-value
. As far as I'm aware, only "citekey" and "type" fields have special names, =key=
and =type=
, respectively. All other field names are the same as found in a bib
file. So one can put anything or even everything from a bibtex record into the notes file and the file name itself!
With this setup Bibtex-completion has worked out of the box from the very beginning 😉
from org-roam-bibtex.
Thanks for double-checking this, @myshevchuk!
I'm not sure if we should make (setq org-roam-bibtex-preformat-keywords '(("citekey" . "=key="))
anvec :file-name "${citekey}"
the defaults, though. As it is right now, it prevents special characters from screwing up with the file-creation.
from org-roam-bibtex.
@zaeph Yes, a similar thought appeared to me. Could you please make a separate issue for this. I'd opt for the defaults you are suggesting. As of now, org-roam-capture-templates
and org-roam-bibtex-templates
provide basically the same functionality and interface. We could tune org-roam-bibtex-templates
to be more user friendly with some additional work under the hood.
from org-roam-bibtex.
Related Issues (20)
- Suggestion: Exported org-roam links in PDF output should point to PDF files, not org files HOT 1
- Unable to create new notes HOT 3
- API changes in citar HOT 3
- Question : how to use org-roam-bibtex HOT 1
- can not insert a new node with ivy-bibtex HOT 1
- does ivy-bibtex abandoned? then how to add a node with out insert the link? HOT 1
- Considering add a functon to add new node only? HOT 2
- No file uri printed out when used with org-cite HOT 1
- add keyword to merge date and year
- [Documentation fix] Citar integration is handled differently now HOT 2
- Support git-annex type storage of attachments HOT 3
- Bind orb-note-actions HOT 1
- org-roam V2 capture template defaults HOT 1
- One note file for all bib entries HOT 1
- Keeping bibtex citekey and org-roam handle in sync when changing one or the other HOT 2
- helm-bibtex doesn't work from everywhere when org-roam-bibtex-mode enabled HOT 1
- ORB always prompting for template capture, even if the node already exists HOT 5
- Note actions: optionally look up cite key in parent hierarchy HOT 2
- org-capure-finish did not close capture buffer, but maximized it. HOT 1
- working example of org-roam-bibtex with ciatar HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from org-roam-bibtex.