Function: org-cite-register-processor
org-cite-register-processor is a byte-compiled function defined in
oc.el.gz.
Signature
(org-cite-register-processor NAME &rest BODY)
Documentation
Mark citation processor NAME as available.
NAME is a symbol. BODY is a property list, where the following optional keys can be set:
:activate
Function activating a citation. It is called with a single
argument: a citation object extracted from the current
buffer. It may add text properties to the buffer. If it is
not provided, org-cite-fontify-default is used.
:export-bibliography
Function rendering a bibliography. It is called with six
arguments: the list of citation keys used in the document, as
strings, a list of bibliography files, the style, as a string
or nil, the local properties, as a property list, the export
back-end, as a symbol, and the communication channel, as a
property list.
It is called at each "print_bibliography" keyword in the
parse tree. It may return a string, a parsed element, a list
of parsed elements, or nil. When it returns nil, the keyword
is ignored. Otherwise, the value it returns replaces the
keyword in the export output.
:export-citation (mandatory for "export" capability)
Function rendering citations. It is called with four
arguments: a citation object, the style, as a pair, the
export back-end, as a symbol, and the communication channel,
as a property list.
It is called on each citation object in the parse tree. It
may return a string, a parsed object, a secondary string, or
nil. When it returns nil, the citation is ignored.
Otherwise, the value it returns replaces the citation object
in the export output.
:export-finalizer
Function called at the end of export process. It must accept
six arguments: the output, as a string, a list of citation
keys used in the document, a list of bibliography files, the
expected bibliography style, as a string or nil, the export
back-end, as a symbol, and the communication channel, as a
property list.
It must return a string, which will become the final output
from the export process, barring subsequent modifications
from export filters.
:follow
Function called to follow a citation. It accepts two
arguments, the citation or citation reference object at
point, and any prefix argument received during interactive
call of org-open-at-point.
:insert
Function called to insert a citation. It accepts two
arguments, the citation or citation reference object at point
or nil, and any prefix argument received.
:cite-styles
When the processor has export capability, the value can
specify what cite styles, variants, and their associated
shortcuts are supported. It can be useful information for
completion or linting.
The expected format is
((STYLE . SHORTCUTS) . VARIANTS))
where STYLE is a string, SHORTCUTS a list of strings or nil,
and VARIANTS is a list of pairs (VARIANT . SHORTCUTS),
VARIANT being a string and SHORTCUTS a list of strings or
nil.
The "nil" style denotes the processor fall-back style. It
should have a corresponding entry in the value.
The value can also be a function. It will be called without
any argument and should return a list structured as the above.
Return a non-nil value on a successful operation.
Source Code
;; Defined in /usr/src/emacs/lisp/org/oc.el.gz
(defun org-cite-register-processor (name &rest body)
"Mark citation processor NAME as available.
NAME is a symbol. BODY is a property list, where the following
optional keys can be set:
`:activate'
Function activating a citation. It is called with a single
argument: a citation object extracted from the current
buffer. It may add text properties to the buffer. If it is
not provided, `org-cite-fontify-default' is used.
`:export-bibliography'
Function rendering a bibliography. It is called with six
arguments: the list of citation keys used in the document, as
strings, a list of bibliography files, the style, as a string
or nil, the local properties, as a property list, the export
back-end, as a symbol, and the communication channel, as a
property list.
It is called at each \"print_bibliography\" keyword in the
parse tree. It may return a string, a parsed element, a list
of parsed elements, or nil. When it returns nil, the keyword
is ignored. Otherwise, the value it returns replaces the
keyword in the export output.
`:export-citation' (mandatory for \"export\" capability)
Function rendering citations. It is called with four
arguments: a citation object, the style, as a pair, the
export back-end, as a symbol, and the communication channel,
as a property list.
It is called on each citation object in the parse tree. It
may return a string, a parsed object, a secondary string, or
nil. When it returns nil, the citation is ignored.
Otherwise, the value it returns replaces the citation object
in the export output.
`:export-finalizer'
Function called at the end of export process. It must accept
six arguments: the output, as a string, a list of citation
keys used in the document, a list of bibliography files, the
expected bibliography style, as a string or nil, the export
back-end, as a symbol, and the communication channel, as a
property list.
It must return a string, which will become the final output
from the export process, barring subsequent modifications
from export filters.
`:follow'
Function called to follow a citation. It accepts two
arguments, the citation or citation reference object at
point, and any prefix argument received during interactive
call of `org-open-at-point'.
`:insert'
Function called to insert a citation. It accepts two
arguments, the citation or citation reference object at point
or nil, and any prefix argument received.
`:cite-styles'
When the processor has export capability, the value can
specify what cite styles, variants, and their associated
shortcuts are supported. It can be useful information for
completion or linting.
The expected format is
((STYLE . SHORTCUTS) . VARIANTS))
where STYLE is a string, SHORTCUTS a list of strings or nil,
and VARIANTS is a list of pairs (VARIANT . SHORTCUTS),
VARIANT being a string and SHORTCUTS a list of strings or
nil.
The \"nil\" style denotes the processor fall-back style. It
should have a corresponding entry in the value.
The value can also be a function. It will be called without
any argument and should return a list structured as the above.
Return a non-nil value on a successful operation."
(declare (indent 1))
(unless (and name (symbolp name))
(error "Invalid processor name: %S" name))
(setq org-cite--processors
(cons (apply #'org-cite--make-processor :name name body)
(seq-remove (lambda (p) (eq name (org-cite-processor-name p)))
org-cite--processors))))