emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Bruce D'Arcus" <bdarcus@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [PATCH] oc-basic: support biblatex date field
Date: Fri, 29 Oct 2021 08:27:39 -0400	[thread overview]
Message-ID: <CAF-FPGNJr6zsLY+NHNm9oFsmC_arX2VoFNFqFAwz_M1oDV_uHw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 132 bytes --]

This is a tiny change that just checks for a 'date' field if 'year' is
nil, and if present, grabs the first four characters.


[-- Attachment #2: 0001-oc-basic-Support-biblatex-date-field.patch --]
[-- Type: text/x-patch, Size: 1729 bytes --]

From feee2ca6d54d3495050de334c258438950494372 Mon Sep 17 00:00:00 2001
From: Bruce D'Arcus <bdarcus@gmail.com>
Date: Fri, 29 Oct 2021 08:17:43 -0400
Subject: [PATCH] oc-basic: Support biblatex date field

* lisp/oc-basic.el (org-cite-basic--print-bibliography,
org-cite-basic--get-year): Check 'date' field if 'year' nil.
 lisp/oc-basic.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 1a01ea408..1c5634341 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -345,7 +345,9 @@ patterns."
   ;; the cite key, as a string, and SUFFIX is the generated suffix
   ;; string, or the empty string.
   (let* ((author (org-cite-basic--get-field 'author entry-or-key info 'raw))
-         (year (org-cite-basic--get-field 'year entry-or-key info 'raw))
+         (year
+          (or (org-cite-basic--get-field 'year entry-or-key info 'raw)
+              (substring (org-cite-basic--get-field 'date entry-or-key info 'raw) 0 4)))
          (cache-key (cons author year))
           (pcase entry-or-key
@@ -371,7 +373,9 @@ ENTRY is an alist, as returned by `org-cite-basic--get-entry'.
 Optional argument INFO is the export state, as a property list."
   (let ((author (org-cite-basic--get-field 'author entry info))
         (title (org-cite-basic--get-field 'title entry info))
-        (year (org-cite-basic--get-field 'year entry info))
+        (year
+         (or (org-cite-basic--get-field 'year entry info)
+             (substring (org-cite-basic--get-field 'date entry info) 0 4)))
          (or (org-cite-basic--get-field 'publisher entry info)
              (org-cite-basic--get-field 'journal entry info)

             reply	other threads:[~2021-10-29 12:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 12:27 Bruce D'Arcus [this message]
2021-11-02 17:44 ` [PATCH] oc-basic: support biblatex date field Nicolas Goaziou
2021-11-02 18:00   ` Bruce D'Arcus
2021-11-03 15:16     ` Nicolas Goaziou
2021-11-04 20:47       ` Bruce D'Arcus
2021-11-04 22:03         ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAF-FPGNJr6zsLY+NHNm9oFsmC_arX2VoFNFqFAwz_M1oDV_uHw@mail.gmail.com \
    --to=bdarcus@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).