emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] oc-basic: support biblatex date field
@ 2021-10-29 12:27 Bruce D'Arcus
  2021-11-02 17:44 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce D'Arcus @ 2021-10-29 12:27 UTC (permalink / raw)
  To: org-mode-email

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

Bruce

[-- 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))
          (key
           (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)))
         (from
          (or (org-cite-basic--get-field 'publisher entry info)
              (org-cite-basic--get-field 'journal entry info)
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-04 22:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-29 12:27 [PATCH] oc-basic: support biblatex date field Bruce D'Arcus
2021-11-02 17:44 ` 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

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