From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32437 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: bapt a Newsgroups: gmane.text.pandoc Subject: latex template syntax vs Lua filters Date: Mon, 3 Apr 2023 14:49:35 -0700 (PDT) Message-ID: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_9488_1910945336.1680558575828" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35751"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDG3FYUYQUCBB4MTVWQQMGQE5R54SAY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Apr 03 23:49:41 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f183.google.com ([209.85.167.183]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pjS3Y-00097P-3i for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 03 Apr 2023 23:49:40 +0200 Original-Received: by mail-oi1-f183.google.com with SMTP id q206-20020acad9d7000000b00389899548dbsf3260008oig.22 for ; Mon, 03 Apr 2023 14:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; t=1680558579; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=CIAOUunVsJI1cJuoUlPQesRMrCnPExvB1x7SVLDubY8=; b=Zcy1MnbAZ0kaIITd0Dal1Rf7Vlysx6pC1PlC9Ll8dtV+LQalpVkruu1c8OWUa9PivG OIMePHQeUfbI5dzUhJkFNweS7xSkGmgz+xTCijQ/544lg+geD3vFua5CT6EZ2RL0yExM QGWta7I5oOlhr0x+pPQAmrdltHX/KqCSsvrW1oD7rdVYVERWYWrpgsVS29OMDmED6mgN NY46IZ/Sojpn9ArRuylRi3JOk9RR0yym+pl4mpY6rs78//jVBRpFXF14jHlzQiF4gi2/ mnHj4AgJIi7d1U6TT+kE3gpyG2XE0ukS9mUdOvqWQ7+QdT7qe42Orx/SZdeVj54vZIfj 4ebg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680558579; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=CIAOUunVsJI1cJuoUlPQesRMrCnPExvB1x7SVLDubY8=; b=BKsZll7gCvEYOfuj5XTxdBwvBHPB8nYw/ZjpL37/qvqX2Y+hSIHDkemjpKePwmfABZ 3AOM6vG4s7o4T5qzW7alhOLLj/YcpO6Pu9ITh2nacXzIP7pLR+UGqLmXn+WRXX7qvk5R iq98h1gdohVRAZEMHFVPUHMB6fNl5G9kOpL9h02taGYw7FnVzrRkrpERk2wim6CvO/A2 VAoTz6AE/o8+Ic09HELBKJkfzkZBNgV5mGo+VEaL6yn5hctSXgB3kTYdR7bk+VT7nsVa q+g7CMS7eDAd7s3gwGbYgqCcycS04q2kYr1sfbLoyUayDWISVi5BAR150k1EUOHCk45I Letw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680558579; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:message-id:to:from:date :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=CIAOUunVsJI1cJuoUlPQesRMrCnPExvB1x7SVLDubY8=; b=16Y1GmrTive4YcZXDFzmpRyt/nDCOqL0jv2pgOmzlKjxWfiok1/iukvXi6rXTUqJxc DiCJACje+6BFdpPFOZ2Ga267TuQdXJwMWDyz4d1ec/5idn2jhsYWh6wAJzzfMrmXKGrW cy3KBfYgdr6evA1UVefqD/lUPu3DqXgJHzDFKqSp8EHqa7RFD4NL0+G1gAepwl2d7bMS FECJcHKSVjZGS7yj+G7Vit58CddIYKztqFg/6t4qzFfA4q4rxhEQh+Ms3XbkyyqwAVaJ qg80PPqCnlNxzY8eGYmkaM65Fjs/9m3sHIupm0/MevlE6uhLQL/uJ1hWRFkEjqg/2L8r 3YNA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AAQBX9eutLXjQovO9mqz+DgObf3WamoyAMESHJnYawga9NkyEYTo4GU+ KtgKSkpcf9ire7t0T7rUANA= X-Google-Smtp-Source: AKy350Z3qNn2VmScgoT+OvlLFzMblNiY4BoFdJCNFx9t42Ol2Hq+au+2RXt4S4S51jLU4U31AfUmuw== X-Received: by 2002:a05:6870:a412:b0:17e:71a3:e509 with SMTP id m18-20020a056870a41200b0017e71a3e509mr322135oal.8.1680558579036; Mon, 03 Apr 2023 14:49:39 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:189d:b0:386:d196:f854 with SMTP id bi29-20020a056808189d00b00386d196f854ls3341892oib.7.-pod-prod-gmail; Mon, 03 Apr 2023 14:49:36 -0700 (PDT) X-Received: by 2002:a05:6808:984:b0:387:1ad9:af08 with SMTP id a4-20020a056808098400b003871ad9af08mr263052oic.10.1680558576562; Mon, 03 Apr 2023 14:49:36 -0700 (PDT) X-Original-Sender: auguieba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:32437 Archived-At: ------=_Part_9488_1910945336.1680558575828 Content-Type: multipart/alternative; boundary="----=_Part_9489_826502003.1680558575828" ------=_Part_9489_826502003.1680558575828 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I'm curious to understand the status of / motivations for the=20 "mini-language" described in https://pandoc.org/MANUAL.html#template-syntax It has become quite complex, with partials, pipes, etc. presumably in=20 response to ever-increasing needs to fine-tune the string processing and=20 formatting in LaTeX templates. A rather intricate use-case I recently came= =20 across is to process a list of author-affiliations from Metadata into the= =20 format requested by a particular journal =E2=80=93 for instance: https://github.com/quarto-journals/acs/blob/main/_extensions/acs/title.tex#= L1 to follow instructions along those lines in the latex class: % repeat the \author .. \affiliation etc. as needed % \email, \thanks, \homepage, \altaffiliation all apply to the current % author. Explanatory text should go in the []'s, actual e-mail % address or url should go in the {}'s for \email and \homepage. % Please use the appropriate macro foreach each type of information % \affiliation command applies to all authors since the last % \affiliation command. The \affiliation command should follow the % other information % \affiliation can be followed by \email, \homepage, \thanks as well. I'm a bit puzzled by the design choice in pandoc templates =E2=80=93 would = it not=20 be (much) easier to process variables in Lua, a fully fledged language with= =20 built-in support for string manipulation, loops, etc.? I can imagine a partial "custom writer" of sorts that would be in charge of= =20 producing, say, the formatted author-affiliation for a given format (latex,= =20 html, etc.), by manipulating the AST in Lua. This function would be called= =20 to insert the required content into the TeX file.=20 In fact, this can be done right now by adding a generic=20 `$insert-author-affiliation$` placeholder in the latex template, and using= =20 a Lua filter to generate the corresponding data in the AST. Clearly I'm missing something =E2=80=93 there must be a good reason for the= =20 development of the mini-language for templates, beyond the simple scenarios= =20 (basic for/if constructs). I could see the value of performing simple tasks= =20 directly in the target latex template, but when it gets as complex as the= =20 example above I don't quite follow. Many thanks, baptiste --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/d890f12c-84d1-4ab8-a836-0da8fb9c8caan%40googlegroups.com. ------=_Part_9489_826502003.1680558575828 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I'm curious to understand the status of= / motivations for the "mini-language" described in

<= /div>
https://pandoc.org/MANUAL.html#template-syntax

It has become quite complex, with partials, pipes, etc. presumably= in response to ever-increasing needs to fine-tune the string processing an= d formatting in LaTeX templates. A rather intricate use-case I recently cam= e across is to process a list of author-affiliations from Metadata into the= format requested by a particular journal =E2=80=93 for instance:

https://github.com/quarto-journals/acs/blob/main/_extensi= ons/acs/title.tex#L1

to follow instructions alon= g those lines in the latex class:

% repeat the \autho= r .. \affiliation etc. as needed
% \email, \thanks, \homepage, \altaf= filiation all apply to the current
% author. Explanatory text should g= o in the []'s, actual e-mail
% address or url should go in the {}'s fo= r \email and \homepage.
% Please use the appropriate macro foreach eac= h type of information

% \affiliation command applies to all auth= ors since the last
% \affiliation command. The \affiliation command sh= ould follow the
% other information
% \affiliation can be followe= d by \email, \homepage, \thanks as well.

I'm a b= it puzzled by the design choice in pandoc templates =E2=80=93 would it not = be (much) easier to process variables in Lua, a fully fledged language with= built-in support for string manipulation, loops, etc.?

I can imagine a partial "custom writer" of sorts that would be in c= harge of producing, say, the formatted author-affiliation for a given forma= t (latex, html, etc.), by manipulating the AST in Lua. This function would = be called to insert the required content into the TeX file.

In fact, this can be done right now by adding a generic = `$insert-author-affiliation$` placeholder in the latex template, and using = a Lua filter to generate the corresponding data in the AST.

Clearly I'm missing something =E2=80=93 there must be a good re= ason for the development of the mini-language for templates, beyond the sim= ple scenarios (basic for/if constructs). I could see the value of performin= g simple tasks directly in the target latex template, but when it gets as c= omplex as the example above I don't quite follow.

Many thanks,

baptiste


--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/d890f12c-84d1-4ab8-a836-0da8fb9c8caan%40googlegroups.= com.
------=_Part_9489_826502003.1680558575828-- ------=_Part_9488_1910945336.1680558575828--