From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qPDfBI+BiGD0RQAAgWs5BA (envelope-from ) for ; Tue, 27 Apr 2021 23:26:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 2EaVAI+BiGDnNgAA1q6Kng (envelope-from ) for ; Tue, 27 Apr 2021 21:26:39 +0000 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 9807015888 for ; Tue, 27 Apr 2021 23:26:38 +0200 (CEST) Received: from localhost ([::1]:44648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbVE5-0008Lm-IK for larch@yhetil.org; Tue, 27 Apr 2021 17:26:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbVCw-0008K2-5A for emacs-orgmode@gnu.org; Tue, 27 Apr 2021 17:25:26 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:52967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbVCl-0002Ke-An for emacs-orgmode@gnu.org; Tue, 27 Apr 2021 17:25:25 -0400 X-Originating-IP: 185.131.40.67 Received: from localhost (40-67.ipv4.commingeshautdebit.fr [185.131.40.67]) (Authenticated sender: admin@nicolasgoaziou.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id EF6F31C0003; Tue, 27 Apr 2021 21:25:09 +0000 (UTC) From: Nicolas Goaziou To: rey-coyrehourcq Subject: Re: How to reinject custom function into derived backend which doesn't implement it, ex : footnote in ox-slimhtml backend. References: <2d0b1df3720133e089e4e45af09f5faf1c21f4ac.camel@univ-rouen.fr> Mail-Followup-To: rey-coyrehourcq , emacs-orgmode@gnu.org Date: Tue, 27 Apr 2021 23:25:09 +0200 In-Reply-To: <2d0b1df3720133e089e4e45af09f5faf1c21f4ac.camel@univ-rouen.fr> (rey-coyrehourcq's message of "Fri, 02 Oct 2020 22:26:43 +0200") Message-ID: <87sg3bifnu.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.70.183.197; envelope-from=mail@nicolasgoaziou.fr; helo=relay5-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619558798; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=pwnrITYNR3DVVKXSi7driPXLjYlDR273//eAF69lKM8=; b=nt6d4Oi1573Tv9bc8LtyUJnjMeIPCn8kTXaQGQdmo008tS6bVHBZeA9lGRvLj70YCZYU8Y tQ2sez7RsIfB2vYyQgjnaqxzvBGaJkv85ugwr521quo22LZKvEE/OTMEzGyuETiZNM6u3o Q+AE4xr3iS9Cuz4+JqqnWUL/sds9TCDePUeGiWPWQhQp1DX5KmJIrtTtPHBSijm2eO5jKe zXyAnuGb4L9xuiIO32tJbOJ0BrQFn4Bboec8grSGTuggdpj3IuRrubQ7uvEEkUVOzrNHxS mmN8vW4GWhexIS/ebyhDGq9FaRQ7vYmtvKHFk7AMGQtgRcb/HLgPEJ0/gZ/Vgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619558798; a=rsa-sha256; cv=none; b=DNbhJpT0o6jzgU0mnecLSVu2fOU+coOb9S/U41z893sUtgSNNyU4TVT2nOGQcrFTOA6zgc MH9vVS3/87gdAZZ4xunaVRc3QhqGYaSbXq7DJKrVH+c/zYpu5vMQg9Z1PA1zLW9yXvMsEM R8hwrB+a2FQZImT8V+YTD5Y4PXhGcVS0IN0h4PKopzUVfL+uCjIjwqUtIOMPxXaf79D9gf dPCQajZLZBl1Zv2NoZjy4kMxc4liEtKQEkYjpvfDJuSxrouST4FwbMUJhHKx4Ts9GO1HZF PC+RR+py/Y3mIbhexQDmjgkR0YFGdFqJ2GeLGNOka1JYa4t+eYsz3Ub0UyHpPw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.45 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 9807015888 X-Spam-Score: -2.45 X-Migadu-Scanner: scn0.migadu.com X-TUID: wsGcwWbRk/me Hello, rey-coyrehourcq writes: > Actually footnotes are not defined in ox-slimhtml, so as i read in the org documentation [1] ), > i try to add this capacity by simply calling vanilla ox-html function org-html-footnote-reference into translate-alist : > > (org-export-define-derived-backend 'ox-slimhtml-publish-to-html 'slimhtml The first argument of `org-export-define-derived-backend' should be the name of the new back-end, as a symbol, not the function used to publish. E.g, (org-export-define-derived-backend 'slimhtml-improved 'slimhtml ....) > :translate-alist '((bold . ox-slimhtml-bold) > > (footnote-reference . org-html-footnote-reference) > (verse-block . org-html- > verse-block) > (special-block . org-html-special-block))) > > Using the vanilla ox-html export function, everything is awesome and footnote appear in my html, normal. > > :publishing-function org-blog-publish-to-html > > But if i switch to ":publishing-function ox-slimhtml-publish-to-html" > the function You need to define your own publishing function with the help of `org-publish-org-to' and make it use `slimhtml-improved. Here you're re-using plain slimhtml, without your additions. E.g., (defun ox-slimhtml-improved-publish-to-html (plist filename pub-dir) "Publish an org file to html. PLIST is the property list for the given project. FILENAME is the filename of the Org file to be published. PUB-DIR is the publishing directory. Return output file name." (let ((html-extension (or (plist-get plist :html-extension) org-html-extension))) (org-publish-org-to 'slimhtml-improved filename (if (and html-extension (not (string= "" html-extension))) (concat "." html-extension) "") plist pub-dir))) Then you can set :publishing-function to `org-slimhtml-publish-to-html'. > There is something i don't understand in the processing of "translate-alist", so perhaps if the derived backend doesn't > implement a footnote-reference function, i cannot extend it ? You should be able to extend it. Regards, -- Nicolas Goaziou