From 112c5671e5f55ea1d9e5e9fb6dd647e6a739c9ac Mon Sep 17 00:00:00 2001 Message-Id: <112c5671e5f55ea1d9e5e9fb6dd647e6a739c9ac.1714117826.git.info@protesilaos.com> In-Reply-To: <0fb81645aafb780116465e13758601ff1183e043.1714117826.git.info@protesilaos.com> References: <0fb81645aafb780116465e13758601ff1183e043.1714117826.git.info@protesilaos.com> From: Protesilaos Stavrou Date: Fri, 26 Apr 2024 10:49:26 +0300 Subject: [PATCH 2/2] Guard against nil label value for footnotes * lisp/ox-html.el (org-html-footnote-section) (org-html-footnote-reference): Check if label is a string before passing it to 'string-to-number'. This fixes the case where we are exporting some footnotes with a label and some without a label. --- lisp/ox-html.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 95ecb44..0237e61 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1886,7 +1886,8 @@ (defun org-html-footnote-section (info) ;; - the footnotes are re-numbered by ;; `org-export-get-footnote-number'. If the label is not ;; a number, keep it. - (when (equal label (number-to-string (string-to-number label))) + (when (and (stringp label) + (equal label (number-to-string (string-to-number label)))) (setq label nil)) ;; `org-export-collect-footnote-definitions' can return ;; two kinds of footnote definitions: inline and blocks. @@ -2754,8 +2755,10 @@ (defun org-html-footnote-reference (footnote-reference _contents info) ;; the footnotes are re-numbered by ;; `org-export-get-footnote-number'. If the label is not a ;; number, keep it. - (label (if (equal label (number-to-string (string-to-number label))) - nil label)) + (label (if (and (stringp label) + (equal label (number-to-string (string-to-number label)))) + nil + label)) (id (format "fnr.%s%s" (or label n) (if (org-export-footnote-first-reference-p -- 2.39.2