From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iHkXIwgjMWPWDwEAbAwnHQ (envelope-from ) for ; Mon, 26 Sep 2022 05:56:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id nZIfIwgjMWOHhQAA9RJhRA (envelope-from ) for ; Mon, 26 Sep 2022 05:56:56 +0200 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 51851C947 for ; Mon, 26 Sep 2022 05:56:55 +0200 (CEST) Received: from localhost ([::1]:34082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocfEk-0002y1-2f for larch@yhetil.org; Sun, 25 Sep 2022 23:56:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocfDz-0002xm-Fb for emacs-orgmode@gnu.org; Sun, 25 Sep 2022 23:56:09 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:40737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocfDv-0000vy-33 for emacs-orgmode@gnu.org; Sun, 25 Sep 2022 23:56:06 -0400 Received: by mail-pl1-x631.google.com with SMTP id b21so5072180plz.7 for ; Sun, 25 Sep 2022 20:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=Ag6AiGRXDAOvEehtPMk9DWWSMTkW9ZrmtrRouDxqRSk=; b=a3QaZnAfy+q3rleHYMddCvtQWY+lPWwoAQoFbWKrQ4uhhKTI9k3weKRwcjva/0URF/ CC+iEws13W8IkUQ9n1SgJfmA8R5e2fSlZkX10GBhsxrV7wCxLQRFO3BM0rwgnha3ps7L w0MrJuJHCi4JxehaRm7wkN7e8vak22yafZpPubkOw1ehO5hvV08S65E/dE13lYpaRAqw /Pf6yAW5wAHwpdY6YrjUeEv0KWFu8T3Nf20UwYX12JC3as5/o4By51PfYa1tnEbb/zNo J5uimGcvhzI1PEOQAXbxfTjIsYwTRiXh0lajvEct97XUicu5BNUL8R6QyRdYUcdBRQxB f0Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Ag6AiGRXDAOvEehtPMk9DWWSMTkW9ZrmtrRouDxqRSk=; b=T8WYYnTOtJWUqR6Z4NSK0RNhYubIkPjOYycWdnA81pkpw8gIDpuEpLiuDoGabyHUR+ 1tkC6zjGMePCp+TIgknUXevkHyqkjfkbuEJ9KVENVokN6S3uJYQzREIwjgb/HbGiwh9n Mvk82LceCcviGlcUc73H/5lqlF0FQYKObLGO/ALYRAmcddRlPquUE4Swfkr9mYDf1dXt XZGrzL/XG7mDrj+TbrAikl/HudJ30MNvUxdL0CQ5bCH8l+m+6EUGXCagVvjtXTj8TAX7 +aHUkVkKi7+PvBCYUKURuzp/vfufMWTlpN6o8jEJ7jSXcWCrCT46ejCfb5J5iFdwUDYL amfA== X-Gm-Message-State: ACrzQf1IV8oW8P7XlvoZVUOgJL3G2gL3xaWiIcVTqfFxz3K+M68AIooY FcjqqGU+U74cTKMHASR/t0k= X-Google-Smtp-Source: AMsMyM4teWuI1IrAgK92HjKiX7T5xn+rHrtHRoCrFXkv06thyIbSGQSO0Qwzc4UgdIfz6FOCjNEFpg== X-Received: by 2002:a17:903:2347:b0:178:1046:929e with SMTP id c7-20020a170903234700b001781046929emr20128621plh.110.1664164561084; Sun, 25 Sep 2022 20:56:01 -0700 (PDT) Received: from localhost ([2409:8970:a80:3a4:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id p6-20020a170902780600b0016be834d54asm7795369pll.306.2022.09.25.20.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 20:55:59 -0700 (PDT) From: Ihor Radchenko To: Juan Manuel =?utf-8?Q?Mac=C3=ADas?= Cc: orgmode Subject: Re: [Patch] Pre-/postpend arbitrary LaTeX code to a section In-Reply-To: <87a66nmzfb.fsf@posteo.net> References: <87o7vcsw8m.fsf@posteo.net> <87czbqyy5i.fsf@localhost> <87sfkmdkxa.fsf@posteo.net> <878rmdxg17.fsf@localhost> <878rmcvlcz.fsf@posteo.net> <87czbna4e4.fsf@localhost> <87h70wbzd3.fsf@posteo.net> <875yhct9eh.fsf@localhost> <87a66nmzfb.fsf@posteo.net> Date: Mon, 26 Sep 2022 11:56:49 +0800 Message-ID: <87czbi7pq6.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=yantar92@gmail.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664164615; 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=Ag6AiGRXDAOvEehtPMk9DWWSMTkW9ZrmtrRouDxqRSk=; b=qhWGQyZUqKe4N/EHECPcf3RvVsk9aXmB6+4FoKdt+kyhAm1be31EQ2t4mhDuaTCJRC69a9 y1FDpmnHM2Xzj1JtR3ykx67tSPwtWkV7rwQ50t0bvTSrypJrmb+SvXu1tdbjZEYuNX1Do0 kK/vP/XYBTBxyvn6M31hDtgIoOK8qD2QyjOmSSe4X8BDPkYyeio6zhak2ibkCCadbHguPv u5nc9cMfYGzHIylFYL67ps8ZVxQkrRDxeVcp6wRKf3OEPRtgxEOQds3TEGkEFxrLf7Dd1T Nk1GAiEXFVOZEsBr6SCEyQf1BPC4ByTcRGTEdcfLRgJhdPJi5Sd8n7A8KighYQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664164615; a=rsa-sha256; cv=none; b=hRfKglfpKaK0hQK3HwSu+/0klr4viecI5ek7fZRo0u27YmgDmX5V+6PBootwzSVj/Iyxws /Lf+ckaoXP/5KnE8SyMP/WBuduYSwF/VXnv8XXzNYSpntmWGOjBP6OAz1zUR57aKj8fgs8 2ODTN68U0mV69GouJP5d/wk8WtQ3IsMjU5XDtb79SEGX9ne+OqMI0IqcT1AlpRYdWvQZkb Z1mgU8RyIECmjj/CRLPJBPTT0HEnZRMy3zA4cHdCoM/FG/aInBajb8A9oq6oJ4nFTXAcLm AgxmVQuBnPW7nthohA3IAPdriOqE8Mg4xr6tR19r6KypF/a4BDJ2P1n3gwLrrA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a3QaZnAf; dmarc=pass (policy=none) header.from=gmail.com; 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: -1.84 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a3QaZnAf; dmarc=pass (policy=none) header.from=gmail.com; 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: 51851C947 X-Spam-Score: -1.84 X-Migadu-Scanner: scn1.migadu.com X-TUID: v6dkF6PUJ3A2 Juan Manuel Mac=C3=ADas writes: > Going back to the earlier :ATTR_BACKEND: issue as a property for > headings, I've been doing some testing and scribbled down a possible > function[1] whose code is almost entirely stolen from > org-export-read-attribute, with some modifications. Evaluated at the > headline, it returns the value of the ATTR_BACKEND property as a plist. > And then that plist could be easily manipulated on each backend to > format export_template conveniently. For example: > > * headline > :PROPERTIES: > :ATTR_LaTeX: :export_template \begin{myenv}\n%s\n\end{myenv} > :ATTR_LaTeX+: blah blah blah > :END: > > =3D=3D> (:export_template "\\begin{myenv}\\n%s\\n\\end{myenv} blah blah b= lah") > > I don't know if that would be the way to go... What I have in mind is to modify `org-export-read-attribute' directly. Then, we can call `org-export-read-attribute' in `org-export-data'; resolve the refs in the template (re-use code from `org-babel-ref-resolve' and `org-babel-parse-multiple-vars'); do normal export and pass it to the template. Before running the normal export, we strip :export_template from the INFO to avoid issues with ox-html which puts every single attr into the generated html. --=20 Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92