From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uBY8Dn5odGOsZgAAbAwnHQ (envelope-from ) for ; Wed, 16 Nov 2022 05:35:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MA86Dn5odGNBPAEA9RJhRA (envelope-from ) for ; Wed, 16 Nov 2022 05:35:10 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 17746136F1 for ; Wed, 16 Nov 2022 05:35:09 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovA85-0007gZ-Ny; Tue, 15 Nov 2022 23:34:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovA83-0007gP-8T for emacs-orgmode@gnu.org; Tue, 15 Nov 2022 23:34:27 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovA80-0002UU-6w for emacs-orgmode@gnu.org; Tue, 15 Nov 2022 23:34:27 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C2849240026 for ; Wed, 16 Nov 2022 05:34:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1668573258; bh=WV/ql1uzANGsk3UrJ3xYFIcAAIUi7T7KvZ7dNT37N64=; h=From:To:Subject:Date:From; b=YGa8f+rboOptEKda79HWEXCo5ok1Xf4bNQgXor2B2L3LPGVeJMT0ve6Kq7Hcof9jz e6jNArGwwSOadMAdFH578bD1BWhg49IjXO/W4ivr52e6IdN2akgRnY3yo3hkptayaj hUbGAuOj1vl3b9td2/VNhBZLAgMtCNlsWhUy1peRr+zkVsG6vTgiqdXGYziq9aqUmL 9M9hqOcfK8njTMDZDC2g7W5z/CRBR9JkoNFnXo3Z6CwS2a6ye1lqvsReZxYBAF/iOD hyBD80XN6JV9IUaaR+rSLTiHQWoqNXiaFvXvqBOuir5i2tYWgsQCRWqJvziNsECoBq A28M0NE8iq5sQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NBqvF1bDFz9rxH for ; Wed, 16 Nov 2022 05:34:15 +0100 (CET) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [PATCH] Display ?? for missing citations on export (was: [BUG] Exporting non-existent citations in oc-basic [9.6-pre (release_9.5.5-989-gd972cf @ /home/yantar92/.emacs.d/straight/build/org/)]) In-Reply-To: <871qr6kiuv.fsf@localhost> References: <871qr6kiuv.fsf@localhost> Date: Wed, 16 Nov 2022 04:34:57 +0000 Message-ID: <87k03vcya6.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668573310; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=LhPHiVSQu7Lqse4YQ5sePomdvAiGi5wrYKhbIf0G3L0=; b=YwM2akRDBSy/WcQuhXcE+0YZSLOWfH8FnAwJKuUxKXuvai8XVPXEekjs02kyuqzCf/iTq8 GnC30LKSYgEO+y/YRgYHt9abGZMI5OWRG+GCAsewkVBGRziK4UP93ZQp1yoqqNitRB7PkK NyKCi+u06vQASNg8/NVGFSX/ROBGHrK1NcCBy+Xggh3A1P2JNT5WqX2qUj0tWA74sWjSCC Q0zTkSJItmabBc5AXrtMhnfmuWVfejqLevascHjPwk2o6N3CQpSdIBKygrogS8N2XNwO/O DHuCzPm9PC+hSMTeNf+l20OOermPlkpFBS3fOCKaD+4WgfaXbEAW+nQNIFanvQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668573310; a=rsa-sha256; cv=none; b=Q1nlrdHc4FFOW2IYU+awvWzMsUa5am8391YnvtFBA/qyVJWGyX2SE0huolCeaPnW3DET5S Eec074GVZATFpnF7LEEcFaD47yeTVLK55itkATqk14pSdnPeAzzJ7yNgw1c4xZnXdv1iTI Ld8M5Nzu5jXBtZOGIFDep3kXn6Um1g0kmTMzw1quPpQTzWW0cXCdbtRq/LF4pP92dOYBFa KVfg6xedi3J0pRhgpfEXE+O51Ad/WOd9OiBHDSms+szRTxKQI6T5WlEoR9BEKcA0kykAz6 +BvazGcqmyfRYgDc2M1Zh6UoLiUITaINDUxmsN9V6UU8M8m8IkwwRjyZt5KWqw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=YGa8f+rb; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.04 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=YGa8f+rb; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 17746136F1 X-Spam-Score: -5.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: AGojI49No4wx --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: > Consider the following Org file: > > ------------ > [cite:@key] > #+print_bibliography: > That=E2=80=99s it! > ------------ > @key is not in the default bibliography and the bibliography processor is= set to basic > > Open the file and execute C-c C-e t U (export to ascii) > > An error is thrown and export fails when attempting to print the > bibliography. The problem with error has been solved in another patch. However, the non-existing keys are exported awkwardly as "(, )". I suggest approaching the missing citations similar to LaTeX and highlight them with ??: (??, ????) by default. See the attached patch. WDYT? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-oc-basic-Display-in-place-of-missing-citations-on-ex.patch >From dc26b1d84c7745080f26e0f194a4deb003a0f88f Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Wed, 16 Nov 2022 12:29:17 +0800 Subject: [PATCH] oc-basic: Display ?? in place of missing citations on export * lisp/oc-basic.el (org-cite-basic--format-author-year): (org-cite-basic-export-citation): Display "????" for missing year and "??" for missing other fields. Reported-by: Ihor Radchenko Link: https://orgmode.org/list/871qr6kiuv.fsf@localhost --- lisp/oc-basic.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el index 3ef7a37e3..fdfee849e 100644 --- a/lisp/oc-basic.el +++ b/lisp/oc-basic.el @@ -580,8 +580,8 @@ (defun org-cite-basic--format-author-year (citation format-cite format-ref info) (suffix (org-element-property :suffix ref))) (funcall format-ref prefix - (org-cite-basic--get-author k info) - (org-cite-basic--get-year k info) + (or (org-cite-basic--get-author k info) "??") + (or (org-cite-basic--get-year k info) "????") suffix))) (org-cite-get-references citation) org-cite-basic-author-year-separator) @@ -652,15 +652,17 @@ (defun org-cite-basic-export-citation (citation style _ info) (org-export-data (mapconcat (lambda (key) - (let ((author (org-cite-basic--get-author key info))) - (if caps (capitalize author) author))) + (or + (let ((author (org-cite-basic--get-author key info))) + (if caps (capitalize author) author)) + "??")) (org-cite-get-references citation t) org-cite-basic-author-year-separator) info))) ;; "noauthor" style. (`(,(or "noauthor" "na") . ,variant) (format (if (funcall has-variant-p variant 'bare) "%s" "(%s)") - (mapconcat (lambda (key) (org-cite-basic--get-year key info)) + (mapconcat (lambda (key) (or (org-cite-basic--get-year key info) "????")) (org-cite-get-references citation t) org-cite-basic-author-year-separator))) ;; "nocite" style. -- 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--