123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- (require 'org-macs)
- (org-assert-version)
- (require 'oc)
- (declare-function org-element-property "org-element" (property element))
- (declare-function org-export-data "org-export" (data info))
- (defun org-cite-bibtex-export-bibliography (_keys files style &rest _)
- "Print references from bibliography FILES.
- FILES is a list of absolute file names. STYLE is the bibliography style, as
- a string or nil."
- (concat (and style (format "\\bibliographystyle{%s}\n" style))
- (format "\\bibliography{%s}"
- (mapconcat #'file-name-sans-extension
- files
- ","))))
- (defun org-cite-bibtex-export-citation (citation style _ info)
- "Export CITATION object.
- STYLE is the citation style, as a pair of strings or nil. INFO is the export
- state, as a property list."
- (let ((references (org-cite-get-references citation)))
- (format "\\%s%s{%s}"
- (pcase style
- (`(,(or "nocite" "n") . ,_) "nocite")
- (_ "cite"))
- (let ((suffix (cdr (org-cite-main-affixes citation))))
- (if suffix
- (format "[%s]" (org-trim (org-export-data suffix info)))
- ""))
- (mapconcat (lambda (r) (org-element-property :key r))
- references
- ","))))
- (org-cite-register-processor 'bibtex
- :export-bibliography #'org-cite-bibtex-export-bibliography
- :export-citation #'org-cite-bibtex-export-citation
- :cite-styles
- '((("nocite" "n"))
- (("nil"))))
- (provide 'oc-bibtex)
|