From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id sPmZKhlqKWUj5QAA9RJhRA:P1 (envelope-from ) for ; Fri, 13 Oct 2023 18:02:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sPmZKhlqKWUj5QAA9RJhRA (envelope-from ) for ; Fri, 13 Oct 2023 18:02:33 +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 6CE366640B for ; Fri, 13 Oct 2023 18:02:33 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=Noxrj3MS; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697212953; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=WNamJhOiPF0ReGVU+dd9v/QhS8Ss6h8f1hySM8So+Vo=; b=g5NBKSvj9GUmcrflc4nQnQ/samViQMWp5ki03Gk4MUbPMpeVI8E7O7goNa/6PejG7SaVtU B9k1cJtAQytvMscu7m2V7wQcqIOGSH1zWLb6F/qvxN8pNUVjGDmW8iUd1widyzeKck7Znw c95sOWdVmiobQj1Pk061KMs96ZwzkLL7WyqAc7YugsrdkeGLAKeKltIlARX7joPNKh7Sd9 iQ1ntl5Mha5Z+Ur+upuAlHzjQg/n4Khgcm6kRfduWdAFg53Y+MEHMM3QWW8++9e3d5pVqW diVBq8gUB3jUgvk1dWCbwDSBI4XSC2oaxYzfIMF0Xo+eLK8PLkwqb6x+nNPJaQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697212953; a=rsa-sha256; cv=none; b=HgmEohF0F2ZjQ5r7j7DvHUyiR4NLyM1XAIArYfWM7ZvBSuiErz2rEZwW3TGjCv1vWpq8Gx Pl7rlWGVMe0z9sE2VEY3vi1PUdRIDQQWp322KH8MgjGCssHXkNUhRktq63f+QmQqNLYOW7 +GJGnn4YCqM0AXrAmD+gwPws9D/l+LG8nB/DfLsYbUz/XR9otk+m1VYVY1eQz9j34/tWXi 8lJ1R3mNu1o2zeqp0j3WNLsdcmB1erKfkrSyif7EpEM+In2lI7nnftz8lcDNkHQ92967hD hsukT1eylKqmn4bYB3RTVSPmgkTIkBCmkxSy3xbbHRmrV9fmNbNsl1ysT2rL5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=Noxrj3MS; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrKaT-000472-Ra; Fri, 13 Oct 2023 12:00:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrKaN-00045A-6N for emacs-orgmode@gnu.org; Fri, 13 Oct 2023 12:00:23 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrKaK-0008Af-5J for emacs-orgmode@gnu.org; Fri, 13 Oct 2023 12:00:22 -0400 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-505748580ceso2818728e87.3 for ; Fri, 13 Oct 2023 09:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697212816; x=1697817616; darn=gnu.org; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=WNamJhOiPF0ReGVU+dd9v/QhS8Ss6h8f1hySM8So+Vo=; b=Noxrj3MSocD1k3XCXAZqHFlZEE1feO3utSExK11A444BI5AUzq785/oqkdGN8fMjPz 0RKO1A4MYJA5m5rzskeQhFOWo5ZGUznzP0u7uAO3Bp2jYkl0gsfXcgx7yeacALT/+JNe H6aCmyDtYNg2n3idG+RhEwD789mFy9bbKWfDI3eSL6ZS+mL6ANwgZXAzIfL3j36mFXxe jm/VUowOJdbPA7yupLY6+LYslBWlE2Ar3ms6ENs5AiOOllwSyMHpLwjfZ5Qj2T9DY8uf Cfl4G9aII++BTbR8LAL5nK5lmUvYQq4peZNqf6np9tfPqzRo6t1aXW5fPwIauuxydafb TBXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697212816; x=1697817616; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WNamJhOiPF0ReGVU+dd9v/QhS8Ss6h8f1hySM8So+Vo=; b=hkWxOylEYedOM9PbVsjZ5JTj++0pnK0J/1urIaeeZkxfr5HXCSyHw5pkucg4KdqmQO M7W5H1gtMBCocMe34+SlEdxHnI0SlL6hC8LO2Xf52CzsaWsN2/uFRUALKSfOUV6ZVclF HhGJ3rZERkemXORDTv4UChliPRVWVEIKCXiSyUkCiMuZJ9yrbo4YAWEzYF6Q1/TCoXJb G9KeGkgAu/ASRyNR3AUHyt6Vl5Y5M0dkh0auoIgsELbHJtxY4Jn7wyHS7Y0Xj5qn6ckI w/2QfWX6gdHCU4Vp8yrGnLoGL3uCuuxBylLI1anwv4EWUK7RxJBBwTrdMlq9f8F8RAK0 zdWQ== X-Gm-Message-State: AOJu0YyJevnVJ0AqpjoOEgxoeoGqQI8P4O7oiDg2xa0hGA2/slo2MFj6 qn3wLV41lpm/lLb+Ic6mosZARGPv8eo= X-Google-Smtp-Source: AGHT+IFozp7qioLTGVPLQnFyAf6f/x7dlt0hvcGN6buimQTkjgqWhrYsMnQwC/ismSMFtuQVCrOAlw== X-Received: by 2002:a05:6512:488:b0:507:9a49:3f23 with SMTP id v8-20020a056512048800b005079a493f23mr1546805lfq.18.1697212815752; Fri, 13 Oct 2023 09:00:15 -0700 (PDT) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id q24-20020ac246f8000000b004fba82dde47sm3426688lfo.123.2023.10.13.09.00.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Oct 2023 09:00:15 -0700 (PDT) Message-ID: <243f586a-f150-481c-8eec-17ffcacaf993@gmail.com> Date: Fri, 13 Oct 2023 23:00:13 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [proof of concept, tip] 'Templates with arguments' using org src blocks Content-Language: en-US, ru-RU To: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= , orgmode References: <87bkdc5g2t.fsf@posteo.net> From: Max Nikulin Mail-Followup-To: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= , orgmode In-Reply-To: <87bkdc5g2t.fsf@posteo.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=manikulin@gmail.com; helo=mail-lf1-x12d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, WEIRD_QUOTING=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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: 2.83 X-Migadu-Queue-Id: 6CE366640B X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: 2.83 X-TUID: RMlHTsWdYD6N On 06/10/2023 15:07, Juan Manuel Macías wrote: > And, finally: > > ┌──── > │ #+header: :var table = table1 > │ #+header: :var notes = "\\item [1] First note\n\\item [2] Second note" > │ {{{template(tptable,table notes)}}} > └──── Usage is quite close to "#+call:", but it does not support specifying arguments using "#+header:" https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-org.html I would still consider noweb (table1 is omitted): --- 8< --- #+property: header-args:org :exports results :results replace :noweb yes #+NAME: tptable #+begin_src org :exports none ,#+begin_table ,#+ATTR_LaTeX: :options [b] ,#+begin_threeparttable $table ,#+begin_tablenotes $notes ,#+end_tablenotes ,#+end_threeparttable ,#+end_table #+end_src #+header: :var table = table1 #+header: :var notes = "\\item [1] First note\n\\item [2] Second note" #+begin_src org <> #+end_src --- >8 --- or "%(param)s" substitutions in python (another variant f"""{param}""" is inconvenient for LaTeX): --- 8< --- #+property: header-args:python :python python3 :results org :noweb yes :exports results #+property: header-args:org :exports results :results replace #+NAME: tptable #+begin_src python :exports none return """\ ,#+begin_table ,#+ATTR_LaTeX: :options [b] ,#+begin_threeparttable %(table)s ,#+begin_tablenotes %(notes)s ,#+end_tablenotes ,#+end_threeparttable ,#+end_table """ % locals() #+end_src #+header: :var table = table1 #+header: :var notes = "\\item [1] First note\n\\item [2] Second note" #+begin_src python <> #+end_src --- >8 ---