("paras." . "paragraph")
("¶" . "paragraph")
("¶¶" . "paragraph")
- ("§" . "paragraph")
- ("§§" . "paragraph")
("part" . "part")
("pt." . "part")
("pts." . "part")
+ ("§" . "section")
+ ("§§" . "section")
("section" . "section")
("sec." . "section")
("secs." . "section")
(defconst org-cite-csl--label-regexp
;; Prior to Emacs-27.1 argument of `regexp' form must be a string literal.
;; It is the reason why `rx' is avoided here.
- (rx-to-string `(seq word-start
- (regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t))
- (0+ digit)
- (or word-start line-end (any ?\s ?\t)))
- t)
+ (rx-to-string
+ `(seq (or line-start space)
+ (regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t))
+ (0+ digit)
+ (or word-end line-end space " "))
+ t)
"Regexp matching a label in a citation reference suffix.
Label is in match group 1.")
((and (guard org-cite-csl-styles-dir) file)
(expand-file-name file org-cite-csl-styles-dir))
(other
- (user-error "Cannot handle relative style file name" other))))
+ (user-error "Cannot handle relative style file name: %S" other))))
(defun org-cite-csl--locale-getter ()
"Return a locale getter.
((re-search-forward org-cite-csl--label-regexp nil t)
(setq location-start (match-beginning 0))
(setq label (cdr (assoc (match-string 1) org-cite-csl--label-alist)))
- (setq locator-start (match-end 1)))
+ (goto-char (match-end 1))
+ (skip-chars-forward "[:space:] ")
+ (setq locator-start (point)))
((re-search-forward (rx digit) nil t)
(setq location-start (match-beginning 0))
(setq label "page")
INFO is the export communication channel, as a property list."
(or (plist-get info :citations)
(letrec ((cites nil)
+ (tree (plist-get info :parse-tree))
+ (find-definition
+ ;; Find definition for standard reference LABEL. At
+ ;; this point, it is impossible to rely on
+ ;; `org-export-get-footnote-definition' because the
+ ;; function caches results that could contain
+ ;; un-processed citation objects. So we use
+ ;; a simplified version of the function above.
+ (lambda (label)
+ (org-element-map tree 'footnote-definition
+ (lambda (d)
+ (and (equal label (org-element-property :label d))
+ (or (org-element-contents d) "")))
+ info t)))
(search-cites
(lambda (data)
(org-element-map data '(citation footnote-reference)
;; Do not force entering inline definitions, since
;; `org-element-map' is going to enter it anyway.
((guard (eq 'inline (org-element-property :type datum))))
- ;; Find definition for current standard
- ;; footnote reference. Unlike to
- ;; `org-export-get-footnote-definition', do
- ;; not cache results as they would contain
- ;; un-processed citation objects.
+ ;; Walk footnote definition.
(_
(let ((label (org-element-property :label datum)))
- (funcall
- search-cites
- (org-element-map data 'footnote-definition
- (lambda (d)
- (and
- (equal label (org-element-property :label d))
- (or (org-element-contents d) "")))))))))
+ (funcall search-cites
+ (funcall find-definition label))))))
info nil 'footnote-definition t))))
- (funcall search-cites (plist-get info :parse-tree))
+ (funcall search-cites tree)
(let ((result (nreverse cites)))
(plist-put info :citations result)
result))))
(concat "/" style)
""))
"")
- (mapconcat (lambda (k) (concat "@" k)) keys ";"))))))))
+ (mapconcat (lambda (k) (concat "@" k)) keys "; "))))))))
+;;;###autoload
(defun org-cite-insert (arg)
"Insert a citation at point.
Insertion is done according to the processor set in `org-cite-insert-processor'.
(let ((name org-cite-insert-processor))
(cond
((null name)
- (user-error "No processor set to follow citations"))
+ (user-error "No processor set to insert citations"))
((not (org-cite--get-processor name))
(user-error "Unknown processor %S" name))
((not (org-cite-processor-has-capability-p name 'insert))