Skip to content

Commit

Permalink
Added bibtex-completion-format-citation-org-cite.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmalsburg committed Jul 18, 2021
1 parent 9f6ea92 commit a4e8b49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Ivy-bibtex: [[http://melpa.org/#/ivy-bibtex][http://melpa.org/packages/ivy-bibte
Helm-bibtex and ivy-bibtex allow you to search and manage your BibTeX bibliography. They both share the same generic backend, bibtex-completion, but one uses the Helm completion framework and the other Ivy as a front-end.

* News
- 2021-07-18: Added a citation function for Org’s new citation system: ~bibtex-completion-format-citation-oc-bibtex~ (for use in configuration variable ~bibtex-completion-format-citation-functions~)
- 2021-04-12: Added a section below explaining how the bibliography can be automatically reloaded when PDFs and notes are added. See [[https://github.com/tmalsburg/helm-bibtex#refresh-bibliography-when-new-pdfs-and-notes-are-added][here]].
- 2021-04-08: It is now possible to search for entries with PDFs and notes by entering ~=has-pdf=~ and ~=has-note=~.
- 2020-04-29: New commands ~helm-bibtex-with-notes~ and ~ivy-bibtex-with-noted~ for searching just within the entries that have notes.
Expand Down
8 changes: 7 additions & 1 deletion bibtex-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ebib:key depending on the major mode of the current buffer. Note
that the functions should accept a list of keys as input. With
multiple marked entries one can insert multiple keys at once,
e.g. \cite{key1,key2}. See the functions
`bibtex-completion-format-citation-ebib' and
`bibtex-completion-format-citation-org-cite' and
`bibtex-completion-format-citation-cite' as examples."
:group 'bibtex-completion
:type '(alist :key-type symbol :value-type function))
Expand Down Expand Up @@ -1047,6 +1047,12 @@ which no PDF is available are omitted."
for pdfs = (bibtex-completion-find-pdf key bibtex-completion-find-additional-pdfs)
append (with-no-warnings (--map (org-make-link-string it key) pdfs)))))

(defun bibtex-completion-format-citation-org-cite (keys)
"Format org-links using Org mode's own cite syntax."
(format "[cite:%s]"
(s-join ";"
(--map (format "@%s" it) keys))))

(defun bibtex-completion-format-citation-org-apa-link-to-PDF (keys)
"Format org-links to PDF for entries in KEYS.
Link text loosely follows APA format. Uses first matching PDF if
Expand Down

0 comments on commit a4e8b49

Please sign in to comment.