From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yLuMEq0yJGIhGAAAgWs5BA (envelope-from ) for ; Sun, 06 Mar 2022 05:03:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id AOInD60yJGLgXgAAauVa8A (envelope-from ) for ; Sun, 06 Mar 2022 05:03:57 +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 E600115C73 for ; Sun, 6 Mar 2022 05:03:56 +0100 (CET) Received: from localhost ([::1]:35098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nQi7f-0005Wk-Q9 for larch@yhetil.org; Sat, 05 Mar 2022 23:03:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQi74-0005WZ-R6 for emacs-orgmode@gnu.org; Sat, 05 Mar 2022 23:03:18 -0500 Received: from mout01.posteo.de ([185.67.36.65]:41173) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQi72-0008At-Hx for emacs-orgmode@gnu.org; Sat, 05 Mar 2022 23:03:18 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 895AD240026 for ; Sun, 6 Mar 2022 05:03:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1646539394; bh=ibit9UmG1kfb0go0b7HyJa/YHHN7kKAkvn7VXsTm9Z4=; h=From:To:Cc:Subject:Date:From; b=Uwf3BwpRcuCeJddAObYD3ydAEyPQAxEGceE7+Ul+Dk5MjyC9vjLavcpn096zzgMY4 fKLyz8UwLPu750QEn2L7eQq1pKjopVP9VrSdkIYOpPhag9PM0JQ2dS/FwUsQnuANWV vaUiEfjnZ/ahSe6H/iB+icGlNFmyfnw1YuMSjM930D1g75V9E7g2oSzdYKFDAY1Wri /Ij2JrqzAwWkCuyKZE+SB/EzgJflqgxWOvXbwfd/0YYRqD5XHWYRlegSwWbi/oihgd mU6HZBf93GHBW40ZkJdPatxeRzYfGP1L+poiJwwrFyieQ8TuPk0kOiuo1wnGWNpkbW V3qMHFtZZmFeA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KB7H55CP5z9rxP; Sun, 6 Mar 2022 05:03:13 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: M. =?utf-8?B?4oCYcXVpbnR1c+KAmSBHw7xsa2Vy?= Subject: Re: Filter for HTML footnotes? References: <87k0d81k7z.fsf@guelker.eu> Date: Sun, 06 Mar 2022 04:03:10 +0000 In-Reply-To: <87k0d81k7z.fsf@guelker.eu> ("M. =?utf-8?Q?=E2=80=98quintus?= =?utf-8?Q?=E2=80=99_G=C3=BClker=22's?= message of "Sat, 05 Mar 2022 16:40:16 +0100") Message-ID: <87czizu3r5.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" 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=1646539437; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=fQiM4+RAIUP9tHzpr+hQM4DuV+waSKj8DYV09eJopB8=; b=nrzGWRxlhcuEova2u7qWjhgZ5q9IleYFmlPF5mkRd2ZcpBduOTxS0sYz0bMCTsxovVHC9w 2N4WYHNkN5Eg2wQIeIdYE1OLxQyendlAgQ/Z61WnsmZXE+1tFSEeXc9SXX34EARGU5fzzs Xj2pQchfhzlHEh2XfXO56b2ZnH/X4AoynkTlZJGlWP2DzaSqeBGDR/ksphjtxm+AFI8PVd 2TloSdakSxZe7Wisf1OoUuPXCgrGDJiQGRcAYitNLmZNnthLyTPbW4JrNsY+DcDENW33jJ fGXEsuE9sZEHBjfT++54e/NBrx7n/tUUZeH3/fcRgjhyQ5h4Ph8GoWvKFCQY4g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646539437; a=rsa-sha256; cv=none; b=C52R3IBsViA/OfUv2egwdDEiytqK88asIgXPtd7Z0V3CWZkmKT9BH/b0wmzlcC/Kp6E3Qr b27F2Smso7gKkMMijtOXeKyQGH2hPCX0pjhlmz9F1SkqAZN1GNruWvJ8jE7Vzs84YPHw5M mfGdkCoD1qHB7n4VE1+HBkIXMUS2PiWGecN+OqbKKiZlb3ipTnPEwNHhE4+88wIsXwq2Y8 9YFDL7rLVp2daiTsZPv8qZpCZ9ZFwbh2oN66XIINgSMR9XkbAA6Ic779Xn5/UrCxJiur8k LH33YBUkioEkF7M9MabwuE1K6RFO3hQZpdozAsC7b8kic7+hdPKLJyCSEJuZlg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Uwf3BwpR; 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: -8.73 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Uwf3BwpR; 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: E600115C73 X-Spam-Score: -8.73 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8YWDdu9/wbeF M. =E2=80=98quintus=E2=80=99 G=C3=BClker writes: > I recently discovered export filters and found some useful applications > for them. For instance, the scientific domain I work in (law) uses > footnote citations, and in these footnotes we abbreviate some words > which would otherwise be written out in ordinary text, like name > particles. Since I use org-cite these footnotes are automatically > generated. So what I did was to write a filter which abbreviates these > words on export in footnotes. I added the filter function to both > org-export-filter-footnote-definition-functions and > org-export-filter-footnote-reference-functions and indeed, when I export > to LaTeX or ODT it does its job just fine. However, when I export to > HTML instead, it does not. When I looked at the text passed to the > filter when exporting as HTML, it turned out what the function receives > is not the content of the footnote, but only the markup for the footnote > number. That came a bit by surprise. > So, what is the correct way to target the content of a footnote in a > filter across backends? Hi, I think a function for `org-export-filter-parse-tree-functions' would work better here. For example, this function replaces "lorem ipsum" with "foo" in all footnote definitions: #+BIND: org-export-filter-parse-tree-functions (fnt-filter-replace) #+begin_src emacs-lisp :exports results :results none (defun fnt-filter-replace (tree backend info) (org-element-map tree 'footnote-definition (lambda (fnt) (let* ((contents (org-element-interpret-data (org-element-contents fnt))) (contents-new (with-temp-buffer (insert contents) (save-excursion (goto-char (point-min)) (while (re-search-forward "lorem ipsum" nil t) (replace-match "foo" t nil))) (org-element-parse-buffer)))) (apply #'org-element-set-contents fnt (list contents-new)))) info) tree) #+end_src Best regards, Juan Manuel=20