diff --git a/ox-gfm.el b/ox-gfm.el index a8da135..84665cb 100644 --- a/ox-gfm.el +++ b/ox-gfm.el @@ -239,31 +239,20 @@ contextual information." (defun org-gfm-footnote-section (info) "Format the footnote section. INFO is a plist used as a communication channel." - (let* ((fn-alist (org-export-collect-footnote-definitions info)) - (fn-alist - (cl-loop for (n _type raw) in fn-alist collect - (cons n (org-trim (org-export-data raw info)))))) - (when fn-alist - (format - "## %s\n%s" - "Footnotes" - (format - "\n%s\n" - (mapconcat - (lambda (fn) - (let ((n (car fn)) (def (cdr fn))) - (format - "%s %s\n" - (format - (plist-get info :html-footnote-format) - (org-html--anchor - (format "fn.%d" n) - n - (format " class=\"footnum\" href=\"#fnr.%d\"" n) - info)) - def))) - fn-alist - "\n")))))) + (and-let* ((fn-alist (org-export-collect-footnote-definitions info))) + (format + "## Footnotes\n\n%s\n" + (mapconcat (pcase-lambda (`(,n ,_type ,def)) + (format + "%s %s\n" + (format (plist-get info :html-footnote-format) + (org-html--anchor + (format "fn.%d" n) + n + (format " class=\"footnum\" href=\"#fnr.%d\"" n) + info)) + (org-trim (org-export-data def info)))) + fn-alist "\n")))) ;;;; Template