* PATCH allow explicit style= in #+cite_export: biblatex @ 2024-04-13 7:14 Pedro Andres Aranda Gutierrez 2024-04-13 14:33 ` Ihor Radchenko 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-13 7:14 UTC (permalink / raw) To: Org Mode List [-- Attachment #1: Type: text/plain, Size: 169 bytes --] HI, Attached is a small patch to allow explicitly adding style= in the biblatex export options, to increase consistency with Customisation variables. Best, /PA [-- Attachment #2: 0001-Allow-style-in-cite_export.patch --] [-- Type: application/octet-stream, Size: 1618 bytes --] From b74faec1602637914248df29f8c319f29d5a2544 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <paranda@it.uc3m.es> Date: Sat, 13 Apr 2024 08:17:04 +0200 Subject: [PATCH] Allow style= in cite_export --- lisp/oc-biblatex.el: Allow style= in #+cite_export. This is a more natural transition for people coming from TeX doc/org-manual.org: Reflect the change in the documentation. doc/org-manual.org | 4 ++++ lisp/oc-biblatex.el | 2 ++ 2 files changed, 6 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index 6c699ae1e..32604cd54 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17607,6 +17607,10 @@ your LaTeX installation, it won't export to anything but PDF. : #+cite_export: biblatex numeric,backend=bibtex +or, specifying ~style=~ explicitly: + +: #+cite_export: biblatex backend=bibtex,style=numeric + #+vindex: org-cite-biblatex-options #+texinfo: @noindent specifies the =biblatex= export processor with the default =numeric= diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el index 36c0ee7e5..f28d13316 100644 --- a/lisp/oc-biblatex.el +++ b/lisp/oc-biblatex.el @@ -200,6 +200,8 @@ Return a string." (style-options (cond ((null style) nil) + ;; allow the user to include "style=" anywhere in the style options + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) ((not (string-match "/" style)) (list (concat "style=" style))) (t (list (concat "bibstyle=" (substring style nil (match-beginning 0))) -- 2.37.1 (Apple Git-137.1) [-- Attachment #3: Type: text/plain, Size: 1 bytes --] ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-13 7:14 PATCH allow explicit style= in #+cite_export: biblatex Pedro Andres Aranda Gutierrez @ 2024-04-13 14:33 ` Ihor Radchenko 2024-04-14 5:22 ` Pedro Andres Aranda Gutierrez 0 siblings, 1 reply; 14+ messages in thread From: Ihor Radchenko @ 2024-04-13 14:33 UTC (permalink / raw) To: Pedro Andres Aranda Gutierrez; +Cc: Org Mode List Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: > HI, > Attached is a small patch to allow explicitly adding style= in the biblatex export options, to increase consistency with > Customisation variables. Thanks! > (style-options > (cond > ((null style) nil) > + ;; allow the user to include "style=" anywhere in the style options > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) > ((not (string-match "/" style)) (list (concat "style=" style))) > (t > (list (concat "bibstyle=" (substring style nil (match-beginning 0))) If we allow style=..., may as well allow bibstyle= and citestyle=. -- 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-13 14:33 ` Ihor Radchenko @ 2024-04-14 5:22 ` Pedro Andres Aranda Gutierrez 2024-04-14 5:30 ` Pedro Andres Aranda Gutierrez 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-14 5:22 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1: Type: text/plain, Size: 1423 bytes --] Hi, Maybe not... because style= is a keyword for the biblatex package, while bibstyle or citestyle aren't. Best, /PA On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net> wrote: > Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: > > > HI, > > Attached is a small patch to allow explicitly adding style= in the > biblatex export options, to increase consistency with > > Customisation variables. > > Thanks! > > > (style-options > > (cond > > ((null style) nil) > > + ;; allow the user to include "style=" anywhere in the style > options > > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) > > ((not (string-match "/" style)) (list (concat "style=" > style))) > > (t > > (list (concat "bibstyle=" (substring style nil > (match-beginning 0))) > > If we allow style=..., may as well allow bibstyle= and citestyle=. > > -- > 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 [-- Attachment #2: Type: text/html, Size: 2507 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-14 5:22 ` Pedro Andres Aranda Gutierrez @ 2024-04-14 5:30 ` Pedro Andres Aranda Gutierrez 2024-04-14 7:16 ` Pedro Andres Aranda Gutierrez 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-14 5:30 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1: Type: text/plain, Size: 1907 bytes --] Sorry... I was not right... You are right. I'll take a look at it again. /PA On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez < paaguti@gmail.com> wrote: > Hi, > > Maybe not... because style= is a keyword for the biblatex package, while > bibstyle or citestyle aren't. > > Best, /PA > > On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net> wrote: > >> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: >> >> > HI, >> > Attached is a small patch to allow explicitly adding style= in the >> biblatex export options, to increase consistency with >> > Customisation variables. >> >> Thanks! >> >> > (style-options >> > (cond >> > ((null style) nil) >> > + ;; allow the user to include "style=" anywhere in the style >> options >> > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) >> > ((not (string-match "/" style)) (list (concat "style=" >> style))) >> > (t >> > (list (concat "bibstyle=" (substring style nil >> (match-beginning 0))) >> >> If we allow style=..., may as well allow bibstyle= and citestyle=. >> >> -- >> 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 > > -- 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 [-- Attachment #2: Type: text/html, Size: 3481 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-14 5:30 ` Pedro Andres Aranda Gutierrez @ 2024-04-14 7:16 ` Pedro Andres Aranda Gutierrez 2024-04-17 6:22 ` Pedro Andres Aranda Gutierrez 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-14 7:16 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1: Type: text/plain, Size: 2808 bytes --] HI, full answer... In the original code, that section prepends "style=" in some cases. I have stumbled across instances where the options started with style= because they were taken directly from LaTeX and the generated code ended by like: \usepackage[style=style=numeric,backend=biber]{biblatex} for #+cite_export: biblatex style=numeric,backend=biber which, BTW, is something someone used the LaTeX may parse as correct. I was just trying to cater for this case. Best, /PA On Sun, 14 Apr 2024 at 07:30, Pedro Andres Aranda Gutierrez < paaguti@gmail.com> wrote: > Sorry... I was not right... You are right. I'll take a look at it again. > /PA > > On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez < > paaguti@gmail.com> wrote: > >> Hi, >> >> Maybe not... because style= is a keyword for the biblatex package, while >> bibstyle or citestyle aren't. >> >> Best, /PA >> >> On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net> wrote: >> >>> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: >>> >>> > HI, >>> > Attached is a small patch to allow explicitly adding style= in the >>> biblatex export options, to increase consistency with >>> > Customisation variables. >>> >>> Thanks! >>> >>> > (style-options >>> > (cond >>> > ((null style) nil) >>> > + ;; allow the user to include "style=" anywhere in the style >>> options >>> > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) >>> > ((not (string-match "/" style)) (list (concat "style=" >>> style))) >>> > (t >>> > (list (concat "bibstyle=" (substring style nil >>> (match-beginning 0))) >>> >>> If we allow style=..., may as well allow bibstyle= and citestyle=. >>> >>> -- >>> 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 >> >> > > -- > 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 > > -- 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 [-- Attachment #2: Type: text/html, Size: 4988 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-14 7:16 ` Pedro Andres Aranda Gutierrez @ 2024-04-17 6:22 ` Pedro Andres Aranda Gutierrez 2024-04-17 7:00 ` Pedro Andres Aranda Gutierrez 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-17 6:22 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1.1: Type: text/plain, Size: 3705 bytes --] Hi again Rationale of the patch: Currently, when the options to biblatex are _not_ xxx/xxx format, a style= is prepended, because it is assumed that it will be a biblatex options string starting with a style. With the proposed patch, I add the possibility of using a biblatex options string where style= is stated explicitly (anywhere in the string). This adds congruency WRT the ~org-cite-biblatex-options~ variable. Best, /PA On Sun, 14 Apr 2024 at 09:16, Pedro Andres Aranda Gutierrez < paaguti@gmail.com> wrote: > HI, full answer... > > In the original code, that section prepends "style=" in some cases. I have > stumbled across > instances where the options started with style= because they were taken > directly from LaTeX > and the generated code ended by like: > \usepackage[style=style=numeric,backend=biber]{biblatex} > for > #+cite_export: biblatex style=numeric,backend=biber > which, BTW, is something someone used the LaTeX may parse as correct. > I was just trying to cater for this case. > > Best, /PA > > > On Sun, 14 Apr 2024 at 07:30, Pedro Andres Aranda Gutierrez < > paaguti@gmail.com> wrote: > >> Sorry... I was not right... You are right. I'll take a look at it again. >> /PA >> >> On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez < >> paaguti@gmail.com> wrote: >> >>> Hi, >>> >>> Maybe not... because style= is a keyword for the biblatex package, while >>> bibstyle or citestyle aren't. >>> >>> Best, /PA >>> >>> On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net> >>> wrote: >>> >>>> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: >>>> >>>> > HI, >>>> > Attached is a small patch to allow explicitly adding style= in the >>>> biblatex export options, to increase consistency with >>>> > Customisation variables. >>>> >>>> Thanks! >>>> >>>> > (style-options >>>> > (cond >>>> > ((null style) nil) >>>> > + ;; allow the user to include "style=" anywhere in the >>>> style options >>>> > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) >>>> > ((not (string-match "/" style)) (list (concat "style=" >>>> style))) >>>> > (t >>>> > (list (concat "bibstyle=" (substring style nil >>>> (match-beginning 0))) >>>> >>>> If we allow style=..., may as well allow bibstyle= and citestyle=. >>>> >>>> -- >>>> 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 >>> >>> >> >> -- >> 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 >> >> > > -- > 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 > > -- 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 [-- Attachment #1.2: Type: text/html, Size: 6396 bytes --] [-- Attachment #2: 0001-Allow-explicit-style-in-cite_export-options.patch --] [-- Type: text/x-patch, Size: 3391 bytes --] From 82f1cecaf5c011506c6cc57cb3835b6f8eba0f6d Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <paaguti@gmail.com> Date: Wed, 17 Apr 2024 08:19:22 +0200 Subject: [PATCH] Allow explicit style= in cite_export options lisp/oc-biblatex.el: Ckech whether the biblatex options include style= explicitly. doc/org-manual.org: Clarify this in the documentation. --- doc/org-manual.org | 10 +++++++++- lisp/oc-biblatex.el | 31 +++++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 6c699ae1e..2de5df3af 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17614,7 +17614,15 @@ 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; +relies on the ~biblatex~ processor of your LaTeX installation. + +The previous example assumes the first element in the options is a +style. Alternatively you can specify ~style=~ explicitly anywhere in +the options string (as you would when setting the +~org-cite-biblatex-options~ variable in your Emacs configuration): + +: #+cite_export: biblatex backend=bibtex,style=numeric + ** Bibliography printing diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el index 36c0ee7e5..13e160ac1 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")))) - (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)))))))) + (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"))))) + ;; Did we state the style as style= in the options? + (explicit-style (string-match-p "\\(\\`s\\|,s\\)tyle=" style)) + (style-options + (cond + ((null style) nil) + ;; prepend style= if not already in options + ((not (string-match "/" style)) (list (if explicit-style 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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-17 6:22 ` Pedro Andres Aranda Gutierrez @ 2024-04-17 7:00 ` Pedro Andres Aranda Gutierrez 2024-04-17 15:45 ` Pedro Andres Aranda Gutierrez 2024-04-21 13:21 ` Ihor Radchenko 0 siblings, 2 replies; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-17 7:00 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1.1: Type: text/plain, Size: 4290 bytes --] Stop the press... I discovered a small bug in the last patch. Attached is a new version. /PA On Wed, 17 Apr 2024 at 08:22, Pedro Andres Aranda Gutierrez < paaguti@gmail.com> wrote: > Hi again > > Rationale of the patch: > Currently, when the options to biblatex are _not_ xxx/xxx format, a style= > is prepended, because > it is assumed that it will be a biblatex options string starting with a > style. > With the proposed patch, I add the possibility of using a biblatex options > string where style= is stated > explicitly (anywhere in the string). This adds congruency WRT > the ~org-cite-biblatex-options~ variable. > > Best, /PA > > On Sun, 14 Apr 2024 at 09:16, Pedro Andres Aranda Gutierrez < > paaguti@gmail.com> wrote: > >> HI, full answer... >> >> In the original code, that section prepends "style=" in some cases. I >> have stumbled across >> instances where the options started with style= because they were taken >> directly from LaTeX >> and the generated code ended by like: >> \usepackage[style=style=numeric,backend=biber]{biblatex} >> for >> #+cite_export: biblatex style=numeric,backend=biber >> which, BTW, is something someone used the LaTeX may parse as correct. >> I was just trying to cater for this case. >> >> Best, /PA >> >> >> On Sun, 14 Apr 2024 at 07:30, Pedro Andres Aranda Gutierrez < >> paaguti@gmail.com> wrote: >> >>> Sorry... I was not right... You are right. I'll take a look at it again. >>> /PA >>> >>> On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez < >>> paaguti@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> Maybe not... because style= is a keyword for the biblatex package, >>>> while bibstyle or citestyle aren't. >>>> >>>> Best, /PA >>>> >>>> On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net> >>>> wrote: >>>> >>>>> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: >>>>> >>>>> > HI, >>>>> > Attached is a small patch to allow explicitly adding style= in the >>>>> biblatex export options, to increase consistency with >>>>> > Customisation variables. >>>>> >>>>> Thanks! >>>>> >>>>> > (style-options >>>>> > (cond >>>>> > ((null style) nil) >>>>> > + ;; allow the user to include "style=" anywhere in the >>>>> style options >>>>> > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) >>>>> > ((not (string-match "/" style)) (list (concat "style=" >>>>> style))) >>>>> > (t >>>>> > (list (concat "bibstyle=" (substring style nil >>>>> (match-beginning 0))) >>>>> >>>>> If we allow style=..., may as well allow bibstyle= and citestyle=. >>>>> >>>>> -- >>>>> 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 >>>> >>>> >>> >>> -- >>> 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 >>> >>> >> >> -- >> 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 >> >> > > -- > 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 > > -- 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 [-- Attachment #1.2: Type: text/html, Size: 7409 bytes --] [-- Attachment #2: 0001-Allow-explicit-style-in-cite_export-options.patch --] [-- Type: text/x-patch, Size: 3396 bytes --] From 82f1cecaf5c011506c6cc57cb3835b6f8eba0f6d Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <paaguti@gmail.com> Date: Wed, 17 Apr 2024 08:19:22 +0200 Subject: [PATCH 1/2] Allow explicit style= in cite_export options lisp/oc-biblatex.el: Allow explicit style= in biblatex cite-export doc/org-manual.org: Clarify documentation regarding biblatex cite-export --- doc/org-manual.org | 10 +++++++++- lisp/oc-biblatex.el | 31 +++++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 6c699ae1e..2de5df3af 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17614,7 +17614,15 @@ 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; +relies on the ~biblatex~ processor of your LaTeX installation. + +The previous example assumes the first element in the options is a +style. Alternatively you can specify ~style=~ explicitly anywhere in +the options string (as you would when setting the +~org-cite-biblatex-options~ variable in your Emacs configuration): + +: #+cite_export: biblatex backend=bibtex,style=numeric + ** Bibliography printing diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el index 36c0ee7e5..13e160ac1 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")))) - (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)))))))) + (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"))))) + ;; Did we state the style as style= in the options? + (explicit-style (string-match-p "\\(\\`s\\|,s\\)tyle=" style)) + (style-options + (cond + ((null style) nil) + ;; prepend style= if not already in options + ((not (string-match "/" style)) (list (if explicit-style 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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-17 7:00 ` Pedro Andres Aranda Gutierrez @ 2024-04-17 15:45 ` Pedro Andres Aranda Gutierrez 2024-04-21 13:21 ` Ihor Radchenko 1 sibling, 0 replies; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-17 15:45 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1: Type: text/plain, Size: 4930 bytes --] BTW, I was thinking that maybe "\\`[^=]+=" may be better than matching style= anywhere in the options string... Open to discuss it... /PA On Wed, 17 Apr 2024 at 09:00, Pedro Andres Aranda Gutierrez < paaguti@gmail.com> wrote: > Stop the press... I discovered a small bug in the last patch. > Attached is a new version. > > /PA > > On Wed, 17 Apr 2024 at 08:22, Pedro Andres Aranda Gutierrez < > paaguti@gmail.com> wrote: > >> Hi again >> >> Rationale of the patch: >> Currently, when the options to biblatex are _not_ xxx/xxx format, a >> style= is prepended, because >> it is assumed that it will be a biblatex options string starting with a >> style. >> With the proposed patch, I add the possibility of using a biblatex >> options string where style= is stated >> explicitly (anywhere in the string). This adds congruency WRT >> the ~org-cite-biblatex-options~ variable. >> >> Best, /PA >> >> On Sun, 14 Apr 2024 at 09:16, Pedro Andres Aranda Gutierrez < >> paaguti@gmail.com> wrote: >> >>> HI, full answer... >>> >>> In the original code, that section prepends "style=" in some cases. I >>> have stumbled across >>> instances where the options started with style= because they were taken >>> directly from LaTeX >>> and the generated code ended by like: >>> \usepackage[style=style=numeric,backend=biber]{biblatex} >>> for >>> #+cite_export: biblatex style=numeric,backend=biber >>> which, BTW, is something someone used the LaTeX may parse as correct. >>> I was just trying to cater for this case. >>> >>> Best, /PA >>> >>> >>> On Sun, 14 Apr 2024 at 07:30, Pedro Andres Aranda Gutierrez < >>> paaguti@gmail.com> wrote: >>> >>>> Sorry... I was not right... You are right. I'll take a look at it again. >>>> /PA >>>> >>>> On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez < >>>> paaguti@gmail.com> wrote: >>>> >>>>> Hi, >>>>> >>>>> Maybe not... because style= is a keyword for the biblatex package, >>>>> while bibstyle or citestyle aren't. >>>>> >>>>> Best, /PA >>>>> >>>>> On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net> >>>>> wrote: >>>>> >>>>>> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: >>>>>> >>>>>> > HI, >>>>>> > Attached is a small patch to allow explicitly adding style= in the >>>>>> biblatex export options, to increase consistency with >>>>>> > Customisation variables. >>>>>> >>>>>> Thanks! >>>>>> >>>>>> > (style-options >>>>>> > (cond >>>>>> > ((null style) nil) >>>>>> > + ;; allow the user to include "style=" anywhere in the >>>>>> style options >>>>>> > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style)) >>>>>> > ((not (string-match "/" style)) (list (concat "style=" >>>>>> style))) >>>>>> > (t >>>>>> > (list (concat "bibstyle=" (substring style nil >>>>>> (match-beginning 0))) >>>>>> >>>>>> If we allow style=..., may as well allow bibstyle= and citestyle=. >>>>>> >>>>>> -- >>>>>> 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 >>>>> >>>>> >>>> >>>> -- >>>> 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 >>>> >>>> >>> >>> -- >>> 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 >>> >>> >> >> -- >> 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 >> >> > > -- > 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 > > -- 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 [-- Attachment #2: Type: text/html, Size: 8460 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-17 7:00 ` Pedro Andres Aranda Gutierrez 2024-04-17 15:45 ` Pedro Andres Aranda Gutierrez @ 2024-04-21 13:21 ` Ihor Radchenko 2024-04-21 15:38 ` Pedro Andres Aranda Gutierrez 1 sibling, 1 reply; 14+ messages in thread From: Ihor Radchenko @ 2024-04-21 13:21 UTC (permalink / raw) To: Pedro Andres Aranda Gutierrez; +Cc: Org Mode List Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: > +: #+cite_export: biblatex backend=bibtex,style=numeric What about something like #+cite_export: biblatex backend=bibtex,bibstyle=numeric > BTW, I was thinking that maybe "\\`[^=]+=" may be better than matching > style= anywhere in the options string... > Open to discuss it... May you elaborate what exactly will be improved? -- 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-21 13:21 ` Ihor Radchenko @ 2024-04-21 15:38 ` Pedro Andres Aranda Gutierrez 2024-04-22 19:46 ` Ihor Radchenko 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-21 15:38 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1: Type: text/plain, Size: 1757 bytes --] Hi Ihor, On Sun, 21 Apr 2024 at 15:20, Ihor Radchenko <yantar92@posteo.net> wrote: > Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: > > > +: #+cite_export: biblatex backend=bibtex,style=numeric > > What about something like > > #+cite_export: biblatex backend=bibtex,bibstyle=numeric > Just tested on a work document. It generates \usepackage[backend=bibtex,bibstyle=numeric]{biblatex} which is a perfectly valid options string for biblatex and yes, the PDF is generated without errors ;-) > > > BTW, I was thinking that maybe "\\`[^=]+=" may be better than matching > > style= anywhere in the options string... > > Open to discuss it... > > May you elaborate what exactly will be improved? > IMHO, the current solution of prepending "style=" forces the option string to be <style>,key=val,key=val,... I'm adding the possibility of a more general key=val,key=val,key=val,... option string, which matches the syntax for the options for the biblatex package. Go to the biblatex documentation, figure out the mix of options and use them in your document without needing to fix it. And BTW, without the patch, the options string generated in the example above is: style=backend=bibtex,bibstyle=numeric and that it obviously very wrong ;-) Best, /PA > -- > 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 [-- Attachment #2: Type: text/html, Size: 3225 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-21 15:38 ` Pedro Andres Aranda Gutierrez @ 2024-04-22 19:46 ` Ihor Radchenko [not found] ` <CAO48Bk_2xjGrN9Qgfe7hpnDnw=do5geKe3XnEA8wJr_dn8SZYg@mail.gmail.com> 0 siblings, 1 reply; 14+ messages in thread From: Ihor Radchenko @ 2024-04-22 19:46 UTC (permalink / raw) To: Pedro Andres Aranda Gutierrez; +Cc: Org Mode List Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: >> What about something like >> >> #+cite_export: biblatex backend=bibtex,bibstyle=numeric >> > Just tested on a work document. It generates > \usepackage[backend=bibtex,bibstyle=numeric]{biblatex} > which is a perfectly valid options string for biblatex and yes, > the PDF is generated without errors ;-) Not for me. With your latest patch, I tried to export the following to latex #+cite_export: biblatex backend=bibtex,bibstyle=numeric #+bibliography: bib.bib Test [cite:@takemoto2006dissolution] #+print_bibliography: bib.bib: @article{takemoto2006dissolution, title={Dissolution of stainless steels in molten lead-free solders}, author={Takemoto, Tadashi and Takemoto, Masaharu}, journal={Soldering \& surface mount technology}, volume={18}, number={3}, pages={24--30}, year={2006}, publisher={Emerald Group Publishing Limited} } I am getting \usepackage[style=backend=bibtex,bibstyle=numeric]{biblatex} >> > BTW, I was thinking that maybe "\\`[^=]+=" may be better than matching >> > style= anywhere in the options string... >> > Open to discuss it... >> >> May you elaborate what exactly will be improved? >> > > IMHO, the current solution of prepending "style=" forces the option string > to be > <style>,key=val,key=val,... > I'm adding the possibility of a more general > key=val,key=val,key=val,... > option string, which matches the syntax for the options for the biblatex > package. > Go to the biblatex documentation, figure out the mix of options and use > them in > your document without needing to fix it. Sounds reasonable. > And BTW, without the patch, the options string generated in the example > above is: > style=backend=bibtex,bibstyle=numeric > and that it obviously very wrong ;-) I am seeing this with the patch as well. So, maybe you are using a different patch? -- 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <CAO48Bk_2xjGrN9Qgfe7hpnDnw=do5geKe3XnEA8wJr_dn8SZYg@mail.gmail.com>]
[parent not found: <87ttjspaor.fsf@localhost>]
[parent not found: <CAO48Bk91MjUAi-AUbhKfKEZGQcJbb1yZWCNoM8U+cObUCH0bVw@mail.gmail.com>]
* Re: PATCH allow explicit style= in #+cite_export: biblatex [not found] ` <CAO48Bk91MjUAi-AUbhKfKEZGQcJbb1yZWCNoM8U+cObUCH0bVw@mail.gmail.com> @ 2024-04-24 17:06 ` Ihor Radchenko 2024-04-25 5:34 ` Pedro Andres Aranda Gutierrez 0 siblings, 1 reply; 14+ messages in thread From: Ihor Radchenko @ 2024-04-24 17:06 UTC (permalink / raw) To: Pedro Andres Aranda Gutierrez; +Cc: Org Mode List Pedro Andres Aranda Gutierrez <paaguti@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> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-24 17:06 ` Ihor Radchenko @ 2024-04-25 5:34 ` Pedro Andres Aranda Gutierrez 2024-04-26 12:24 ` Ihor Radchenko 0 siblings, 1 reply; 14+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2024-04-25 5:34 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Org Mode List [-- Attachment #1.1: Type: text/plain, Size: 2405 bytes --] Hopefully all remarks addressed.. Best, /PA On Wed, 24 Apr 2024 at 19:05, Ihor Radchenko <yantar92@posteo.net> wrote: > Pedro Andres Aranda Gutierrez <paaguti@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 [-- Attachment #1.2: Type: text/html, Size: 3808 bytes --] [-- Attachment #2: 0001-Allow-native-biblatex-options-in-CITE_EXPORT.patch --] [-- Type: text/x-patch, Size: 4136 bytes --] From 2d2610b602b1a0ab073cbdd5e283e89f696a433d Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <paaguti@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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: PATCH allow explicit style= in #+cite_export: biblatex 2024-04-25 5:34 ` Pedro Andres Aranda Gutierrez @ 2024-04-26 12:24 ` Ihor Radchenko 0 siblings, 0 replies; 14+ messages in thread From: Ihor Radchenko @ 2024-04-26 12:24 UTC (permalink / raw) To: Pedro Andres Aranda Gutierrez; +Cc: Org Mode List Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes: > Hopefully all remarks addressed.. > Best, /PA Thanks! Applied, onto main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f124b616d -- 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-04-26 12:23 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-13 7:14 PATCH allow explicit style= in #+cite_export: biblatex Pedro Andres Aranda Gutierrez 2024-04-13 14:33 ` Ihor Radchenko 2024-04-14 5:22 ` Pedro Andres Aranda Gutierrez 2024-04-14 5:30 ` Pedro Andres Aranda Gutierrez 2024-04-14 7:16 ` Pedro Andres Aranda Gutierrez 2024-04-17 6:22 ` Pedro Andres Aranda Gutierrez 2024-04-17 7:00 ` Pedro Andres Aranda Gutierrez 2024-04-17 15:45 ` Pedro Andres Aranda Gutierrez 2024-04-21 13:21 ` Ihor Radchenko 2024-04-21 15:38 ` Pedro Andres Aranda Gutierrez 2024-04-22 19:46 ` Ihor Radchenko [not found] ` <CAO48Bk_2xjGrN9Qgfe7hpnDnw=do5geKe3XnEA8wJr_dn8SZYg@mail.gmail.com> [not found] ` <87ttjspaor.fsf@localhost> [not found] ` <CAO48Bk91MjUAi-AUbhKfKEZGQcJbb1yZWCNoM8U+cObUCH0bVw@mail.gmail.com> 2024-04-24 17:06 ` Ihor Radchenko 2024-04-25 5:34 ` Pedro Andres Aranda Gutierrez 2024-04-26 12:24 ` Ihor Radchenko
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).