mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 22:47:56 +00:00
oc-csl: Also look for style files in default directory
* lisp/oc-csl.el (org-cite-csl--style-file): When file name is relative, look for it in default directory before expanding it against `org-cite-csl-styles-dir'. (org-cite-csl-styles-dir): Document change.
This commit is contained in:
parent
f1929afc66
commit
c6186be3fd
|
@ -97,6 +97,11 @@ argument.
|
||||||
|
|
||||||
** Miscellaneous
|
** Miscellaneous
|
||||||
|
|
||||||
|
*** Org also searches for CSL style files in default directory
|
||||||
|
|
||||||
|
When CSL style file name is relative, Org first looks into
|
||||||
|
default-directory before trying ~org-cite-csl-styles-dir~.
|
||||||
|
|
||||||
*** Users can add checkers to the linting process
|
*** Users can add checkers to the linting process
|
||||||
|
|
||||||
The function ~org-lint-add-checker~ allows one to add personal checks
|
The function ~org-lint-add-checker~ allows one to add personal checks
|
||||||
|
|
|
@ -134,13 +134,15 @@ If nil then only the fallback en-US locale will be available."
|
||||||
|
|
||||||
(defcustom org-cite-csl-styles-dir nil
|
(defcustom org-cite-csl-styles-dir nil
|
||||||
"Directory of CSL style files.
|
"Directory of CSL style files.
|
||||||
When non-nil, relative style file names are expanded relatively to this
|
|
||||||
directory. This variable is ignored when style file is absolute."
|
Relative style file names are expanded according to document's
|
||||||
|
default directory. If it fails and the variable is non-nil, Org
|
||||||
|
looks for style files in this directory, too."
|
||||||
:group 'org-cite
|
:group 'org-cite
|
||||||
:package-version '(Org . "9.5")
|
:package-version '(Org . "9.5")
|
||||||
:type '(choice
|
:type '(choice
|
||||||
(directory :tag "Styles directory")
|
(directory :tag "Styles directory")
|
||||||
(const :tag "Use absolute file names" nil))
|
(const :tag "No central directory for style files" nil))
|
||||||
;; It's not obvious to me that arbitrary locations are safe.
|
;; It's not obvious to me that arbitrary locations are safe.
|
||||||
;;; :safe #'string-or-null-p
|
;;; :safe #'string-or-null-p
|
||||||
)
|
)
|
||||||
|
@ -370,15 +372,21 @@ corresponding to one of the output formats supported by Citeproc: `html',
|
||||||
|
|
||||||
INFO is the export state, as a property list.
|
INFO is the export state, as a property list.
|
||||||
|
|
||||||
When file name is relative, expand it according to `org-cite-csl-styles-dir',
|
When file name is relative, look for it in buffer's default
|
||||||
or raise an error if the variable is unset."
|
directory, failing that in `org-cite-csl-styles-dir' if non-nil.
|
||||||
|
Raise an error if no style file can be found."
|
||||||
(pcase (org-cite-bibliography-style info)
|
(pcase (org-cite-bibliography-style info)
|
||||||
('nil org-cite-csl--fallback-style-file)
|
('nil org-cite-csl--fallback-style-file)
|
||||||
((and (pred file-name-absolute-p) file) file)
|
((and (pred file-name-absolute-p) file) file)
|
||||||
((and (guard org-cite-csl-styles-dir) file)
|
((and (pred file-exists-p) file) (expand-file-name file))
|
||||||
|
((and (guard org-cite-csl-styles-dir)
|
||||||
|
(pred (lambda (f)
|
||||||
|
(file-exists-p
|
||||||
|
(expand-file-name f org-cite-csl-styles-dir))))
|
||||||
|
file)
|
||||||
(expand-file-name file org-cite-csl-styles-dir))
|
(expand-file-name file org-cite-csl-styles-dir))
|
||||||
(other
|
(other
|
||||||
(user-error "Cannot handle relative style file name: %S" other))))
|
(user-error "CSL style file not found: %S" other))))
|
||||||
|
|
||||||
(defun org-cite-csl--locale-getter ()
|
(defun org-cite-csl--locale-getter ()
|
||||||
"Return a locale getter.
|
"Return a locale getter.
|
||||||
|
|
Loading…
Reference in a new issue