Hopefully all remarks addressed..
Best, /PA

On Wed, 24 Apr 2024 at 19:05, Ihor Radchenko <yanta...@posteo.net> wrote:

> Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes:
>
> > Oops, you are right. My local copy got a bit messed up.
> >
> > Here is a hopefully clean patch. I have tried it out on a local
> test-patch
> > branch of current main and it applied.
>
> Thanks!
> May you also add NEWS entry?
>
> Also, a few comments inline.
>
> > Subject: [PATCH] Allow biblatex package options natively
>
> Please, prefix the first line with oc-biblatex library name.
>
> > lisp/oc-biblatex.el: detect and allow biblatex package options
> >   in key=val,key=val,... format. <style>,key=val,key=val,...
> >   continues to be supported and both formats are distinguished
> > doc/org-manual.org: mention that biblatex options in 'native'
> >   format are also supported.
>
> The changelog entries are not correctly formatted. See
> https://orgmode.org/worg/org-contribute.html#commit-messages
>
> Also, please start sentences from capital letter.
>
> > --- a/doc/org-manual.org
> > +++ b/doc/org-manual.org
> > @@ -17631,7 +17631,9 @@ your LaTeX installation, it won't export to
> anything but PDF.
> >  specifies the =biblatex= export processor with the default =numeric=
> >  style and the =bibtex= backend. Always define the style first and then
> >  the rest of load-time options for the =biblatex=
> > -package. Alternatively, use the ~org-cite-biblatex-options~ variable
> > +package. Alternatively, you can use the ~key=val,key=val~ format for
> > +the options as documented in the =biblatex= package documentation, which
> > +is also used for  the ~org-cite-biblatex-options~ variable
> >  in your Emacs configuration. It will only export to PDF, since it
> >  relies on the ~biblatex~ processor of your LaTeX installation;
>
> It would be nice to add an example demonstrating the described behaviour.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
From 2d2610b602b1a0ab073cbdd5e283e89f696a433d Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paag...@gmail.com>
Date: Thu, 25 Apr 2024 07:21:45 +0200
Subject: oc-biblatex: Allow native biblatex options in CITE_EXPORT

* lisp/oc-biblatex.el: (org-cite-biblatex--package-options) Add support
for options in the native biblatex package format.
* doc/org-manual.org: Document the added format and add an example
* etc/ORG-NEWS: Announce new format for #+cite_export biblatex options

---
 doc/org-manual.org  | 11 ++++++++---
 etc/ORG-NEWS        |  6 ++++++
 lisp/oc-biblatex.el | 23 +++++++++++++----------
 3 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index a285aa4e5..786248af9 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17631,9 +17631,14 @@ your LaTeX installation, it won't export to anything but PDF.
 specifies the =biblatex= export processor with the default =numeric=
 style and the =bibtex= backend. Always define the style first and then
 the rest of load-time options for the =biblatex=
-package. Alternatively, use the ~org-cite-biblatex-options~ variable
-in your Emacs configuration. It will only export to PDF, since it
-relies on the ~biblatex~ processor of your LaTeX installation;
+package. Alternatively, you can use the ~key=val,key=val~ format for
+the options as documented in the =biblatex= package documentation:
+
+: #+cite_export: biblatex backend=bibtex,style=numeric
+
+The ~org-cite-biblatex-options~ variable in your Emacs configuration
+uses this format. It will only export to PDF, since it relies on the
+~biblatex~ processor of your LaTeX installation.
 
 ** Bibliography printing
 
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index fc2ff9e00..c4264e152 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1011,6 +1011,12 @@ The option can be customized either by
    group or
 2. by setting the file local keyword =LATEX_FOOTNOTE_COMMAND=
 
+*** Options for ~#+cite_export: biblatex~ can use the package's option syntax
+
+When using =biblatex= to export bibliographies, you can use the format
+as specified in the =biblatex= package documentation as
+=key=val,key=val,...=
+
 ** New features
 *** ~org-paste-subtree~ now handles =C-u= and =C-u C-u= prefix arguments specially
 
diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el
index 36c0ee7e5..97f10710c 100644
--- a/lisp/oc-biblatex.el
+++ b/lisp/oc-biblatex.el
@@ -190,20 +190,23 @@ INITIAL is an initial style of comma-separated options, as a string or nil.
 STYLE is the style definition as a string or nil.
 
 Return a string."
-  (let ((options-no-style
-         (and initial
-              (let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
+  (let* ((options-no-style
+          (and initial
+               (let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
                 (seq-filter
                  (lambda (option) (not (string-match re option)))
                  (split-string (org-unbracket-string "[" "]" initial)
                                "," t " \t")))))
-        (style-options
-         (cond
-          ((null style) nil)
-          ((not (string-match "/" style)) (list (concat "style=" style)))
-          (t
-           (list (concat "bibstyle=" (substring style nil (match-beginning 0)))
-                 (concat "citestyle=" (substring style (match-end 0))))))))
+         ;; Check whether the string is in key=val,...
+         (biblatex-options-p (and (stringp style) (string-match-p "\\`[^,=]+=[^,]+\\(,[^=]+=[^,]+\\)\\'" style)))
+         (style-options
+          (cond
+           ((null style) nil)
+           ;; assume it is a valif options string for biblatex if it is in key=val,... format
+           ((not (string-match "/" style)) (list (if biblatex-options-p style (concat "style=" style))))
+           (t
+            (list (concat "bibstyle=" (substring style nil (match-beginning 0)))
+                  (concat "citestyle=" (substring style (match-end 0))))))))
     (if (or options-no-style style-options)
         (format "[%s]"
                 (mapconcat #'identity
-- 
2.34.1

Reply via email to