Commit Graph

16 Commits

Author SHA1 Message Date
Kyle Meyer 60b178e596 oc-csl: Locate etc/csl for system installs and Emacs repo
* lisp/oc-csl.el (org-cite-csl--etc-dir): Add `data-directory' case,
using it as the fallback.  Also, use the more specific
file-directory-p rather than file-exists-p to inspect the candidates.

When using Org from the system installation, the CSL files will be
available in the etc/org/csl/ subdirectory underneath
`data-directory'.  (This requires the etc/csl/ files to be synced to
the Emacs repo under etc/org/csl.)

Give the Org repository and package cases precedence because they are
anchored to a specific oc.el location while, for Emacs releases with
Org 9.5 or later, the data-directory files will typically always be
present.
2021-10-02 00:52:27 -04:00
Glenn Morris e83ee601f2 Backport commit d50597189 from Emacs
; Standardize some license headers
d505971894d83e04e8d206be1dcee1cee5e8bb93
Glenn Morris
Fri Oct 1 18:07:45 2021 -0700
2021-10-01 21:57:10 -04:00
Glenn Morris 7dcdf98f1d Backport commit f1f57a541 from Emacs
* lisp/oc-csl.el (org-cite-csl-locales-dir)
(org-cite-csl-styles-dir):
* lisp/org-plot.el (org-plot/preset-plot-types): Fix :type.

Fix some custom types
f1f57a541e4c74eec68a27c47c7416ed6c7d75dd
Glenn Morris
Fri Oct 1 08:33:32 2021 -0700
2021-10-01 21:57:09 -04:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
András Simonyi b96aae4684 oc-csl: Refactor code to help byte-compilation
* lisp/oc-csl.el (org-cite-csl--create-structure-params): Refactor pcase pattern
to avoid slow or in some cases non-terminating byte compilation.
2021-09-28 18:55:01 +02:00
András Simonyi 9e2341bc65 oc-csl: Add support for the text and year citation styles
* lisp/oc-csl.el (org-cite-csl--create-structure-params): Introduce this new
function to map the extended list of supported citation styles and variants to
the corresponding citeproc-el citation structure creation parameters.
(org-cite-csl--no-affixes-p, org-cite-csl--capitalize-p,
org-cite-csl--no-author-p): Remove them since their functionality is provided
now by `org-cite-csl--create-structure-params'.
(org-cite-csl--parse-reference): Don't generate `suppress-author' cite
information as that is treated now by citeproc-el as a citation style.
(org-cite-csl--create-structure): Use `org-cite-csl--create-structure-params' to
generate style-dependent citation structure parameters.
2021-09-28 16:39:10 +02:00
András Simonyi 5e58af5ddd oc-csl: Use citeproc-el to create CSL processor itemgetters
* lisp/oc-csl.el (org-cite-csl--processor): Citeproc-el now provides an
itemgetter constructor with all the required functionality and some more, so we
use it to create the itemgetter instead of `org-cite-csl--itemgetter' to avoid
code duplication and make use of the additional features, in particular the
ability to access bibliographies in `org-bibtex' format
(see <https://gewhere.github.io/org-bibtex>).
(org-cite-csl--itemgetter): Is removed since it is no longer used.
2021-09-26 12:35:39 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
TEC a3ba79cd3a
oc-csl: Prevent ' from being a LaTeX active char
* lisp/oc-csl.el (org-cite-csl-finalizer): The hanging LaTeX package
we're using also affects punctuation and makes `,.'"`?!:;' active
characters throughout the entire document.  That means a LaTeX snippet
like \(f'(x)\) will now make the document fail to compile.
See <https://tex.stackexchange.com/questions/61732/hanging-package-chokes-on-apostrophes>
for more information.  Adding the [notquote] option stops \(f'(x)\) from
being an issue.

In time it could be worth looking into replacing the hanging package
with some use of \parshape.
2021-08-23 18:34:30 +08:00
TEC 818bec57eb
oc-csl: Define \citeprocitem for LaTeX export
* lisp/oc-csl.el (org-cite-csl-finalizer): In order for
citeproc-generated references to be treated the same as bib(la)tex
references by hyperref, we need to make use of \hyper@linkstart.
However, this requires \makeatletter and \makeatother, which can only be
used in the preamble.  To allow citeproc-el to use \hyper@linkstart, we
add a command definition in the preamble, \citeprocitem.
2021-08-23 18:34:30 +08:00
Nicolas Goaziou 490eba3a42 Remove spurious `provide'
Provide only features matching file names.
2021-08-11 11:31:54 +02:00
Max Nikulin 31c07bd3bd oc: rx compatibility with Emacs < 27.1
* lisp/oc.el (org-cite-adjust-note):
* lisp/oc-basic.el (org-cite-basic-goto):
* lisp/oc-biblatex.el (org-cite-biblatex-prepare-preamble):
* lisp/oc-csl.el (org-cite-csl--label-regexp): Avoid `rx' forms
introduced in Emacs-27.1 to keep compatibility with older versions.

Use `rx-to-string' instead of `rx' due to lack of support of  `regexp'
and `literal' forms with a variable as an argument.
2021-08-11 11:14:22 +02:00
Nicolas Goaziou 8df3e25db8 Revert "oc: Remove spurious `provide'"
This reverts commit ad006e2930.
2021-08-01 10:29:23 +02:00
Nicolas Goaziou ad006e2930 oc: Remove spurious `provide'
* lisp/oc-basic.el:
* lisp/oc-biblatex.el (biblatex):
* lisp/oc-csl.el:
* lisp/oc-natbib.el:
* lisp/oc.el: Provide only the full library name.
2021-08-01 10:07:39 +02:00
TEC 604bfd9d75
oc-csl: be more caution about the csl etc location
* lisp/oc-csl.el (org-cite-ctl--etc-dir): The previous value of
`org-cite-ctl--etc-dir' is incorrect when using either package.el or
straight to manage Org. We can be a bit more considerate by just
checking if the initial location exists, and then trying the expected
location when using package.el/straight if it doesn't exist.
2021-07-15 03:36:24 +08:00
Nicolas Goaziou 971c1359a5 oc-csl: Implement `csl' citation processor
* etc/csl/chicago-author-date.csl:
* etc/csl/locales-en-US.xml:
* lisp/oc-csl.el (csl): New files.
* etc/Makefile (ETCDIRS): Register new files.
2021-07-09 08:47:14 +02:00