From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: is there a macro to have backend-specific behavior? Date: Thu, 01 Feb 2018 13:02:36 +0100 Message-ID: <87bmh8yl2b.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehDZm-0006LU-BS for emacs-orgmode@gnu.org; Thu, 01 Feb 2018 07:02:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehDZh-0007Wi-QN for emacs-orgmode@gnu.org; Thu, 01 Feb 2018 07:02:46 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:52551) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehDZh-0007T8-KN for emacs-orgmode@gnu.org; Thu, 01 Feb 2018 07:02:41 -0500 In-Reply-To: (Alan Schmitt's message of "Thu, 01 Feb 2018 10:58:31 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Alan Schmitt Cc: emacs-orgmode Hello, Alan Schmitt writes: > Is there a way to define a macro that has different behaviors depending > on export backend? I have macros that use the @@latex:foo@@ syntax, but > in that case I "foo" is supposed to be literal latex. > > My use case is this one: I have a link to a custom id, and I want to > export it as [[#id]] in latex and [[file:file.org::#id]] for html > *before* link resolution happens (so that the custom id in the latex > export is substituted with the correct label). > > Is this possible? Could you simply preprocess the document to export with a function doing the change above? Functions in `org-export-before-parsing-hook' are called with the back-end as the sole argument. Regards, -- Nicolas Goaziou