From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32570 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Open Discussion: Features of Templating Date: Tue, 9 May 2023 19:35:02 +0200 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009679fa05fb462d2b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30825"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBVEI5KRAMGQEVLUNQRA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue May 09 19:35:21 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-vk1-f189.google.com ([209.85.221.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pwRFB-0007lL-5n for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 09 May 2023 19:35:21 +0200 Original-Received: by mail-vk1-f189.google.com with SMTP id 71dfb90a1353d-44fda64b04dsf4521240e0c.2 for ; Tue, 09 May 2023 10:35:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683653720; cv=pass; d=google.com; s=arc-20160816; b=HBPqrBFIq9/059+usRSnGRaKdmIVT+PKAfG01S+vkDb7jGYUR34OWs7LN7ybPYpr3P h8fPRT9kirtVGdsiFXWg5pZWwbKz9P5LBn3nnb+UEDNVjX2otoM3d1RQyYgWWDua/M/V rAWFk3/1sWa/RtOBX8o62SRwe8cMegE33jkGpqgjbEwlrPzSP/ABWkluKD4pnO20Ejsw kCwW57W55A3YRznn++73RwN0LwlvlVilw+pi6SAnQHK0K5CKa9xx3ux8o/q3I3cAHQl1 6Ikdjd8KWjwZLqm/bW15cNd6HCMtxHwfzZ1rj6YF9Y4e7+O0FWzV1G4TzqNqwBjJs+WP HLng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=lw4LcQcqlQmigH0t/NwsT6dT1b4fzQqB2zBNA4ueM4U=; b=paaQvyTGop2AiuOiXoVLsX70U8fiwCSeJ6CkX3DNXd5OaOiwL1G5EL3+zCkQSGsb2s DtoGScEOHmqQYzKk50rF8GUNDtruY9DOdRGevxMctWQogD7nPLSQHq8MiTWK02/Lrgob IecqbJDVVzE/zxV7oPboqrBn0WFkd66uPuI8Qr8zdliJ6fXy513Ngs0rqY4S85AtHxZP QGme5rQiRvSzW2E/U6lMAT74YARRkrdZRRR+I53jObbvbe/YbPNSrC++OtTch2Wcmqh4 AmfdNK1If4nXXLzYZpBFk5yBPhDXZlSaC2twMRwry6oVrl6XDNcuoumvSUOL8qvjNHPe P+OA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=gP7lQkNM; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::1129 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1683653720; x=1686245720; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:sender :from:to:cc:subject:date:message-id:reply-to; bh=lw4LcQcqlQmigH0t/NwsT6dT1b4fzQqB2zBNA4ueM4U=; b=ZOgIz6YRA6nmj7Pmc1H9rtRgytzS0YssdVWD/I1dBz0FvMIwg8wEus3OetmzU8JTbE DE5d7E7k77yDcB6AILH0DRh5zv8k9cz1lhdfBz5knN0MO1AtldyZ3nnOC42wxK744Wqc 3GY/2KxfL47/Z275xtsLLHeILNGITrHwrB2BkNhU1c+kwp7RGXF78sQ7eis3dr7UCxYA ugubRQa7PrKQZZ97usbZlns8lcvWqUKVci0JVDl9PkCi9JJiIOt/28iubYdbU4eHQpyu phc3kJCGqYg60ykk4mNr/9IwALs3cpusA3kK1UiJ4U2mgv4Mn7k3uvbrD+Hw725QnUXy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683653720; x=1686245720; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=lw4LcQcqlQmigH0t/NwsT6dT1b4fzQqB2zBNA4ueM4U=; b=DKi9rzmwFQXWKaZtKTimj6i2xSO8jM/P/fV9qQvXiw94EpnqNExUNbglwdppHPPrLP E8fVkzCQGA9o1dX1EFdip9EW4yytPv8K1URZEd0DwrnDjkL4h1vahffUU0BsHmO1OM9b KlNJP/bWUlSIpY/8DdfZiXvDxLByacf+J3J5mSeFsFidjgG+RKRPBDgAHd8vNz3Zx3I5 1EVIWtR29IV5pxJz+fxpfiBySRsZFYzj+A0CxkzB4J2LeOR7k57HPwOaOLr//scHsJuj saJFSfHffPhHHbbwlhb082mUm/aboaFzLLc7V01pQx2DGRp/QrwSLLNeIW3hISsdJNuq uJMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683653720; x=1686245720; 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-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=lw4LcQcqlQmigH0t/NwsT6dT1b4fzQqB2zBNA4ueM4U=; b=A2F69uuddTlwBSm+iRkPgPQqWqKwDu9DWEq+i18+lbeTR/lQWwJUuCWmtFC/eQc5k6 akwU9VR9bOaps+Z/6T01Ipazhnkd4T5CKbtGrvDz1E1GcRHgTEmXbX7kpf/mZYRI1OR9 9WCFs+uyaC8D/1eqYzHWiYIifiEBWc+dSVrPj4TDHErLrZ/ChWHImLHoLbuA9pjx11gk 5CZnuQWCwCxapoK0DbtIrpvCj5IexdfrGsE/kP21As/dXHo4ePMVKU4hLT7pkIagJL25 /gu9Pr Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDxHt6tjyyQHkAR0JgMYUb6yPsDYTDf9Ntv6Gs0WyH4EtyoiNPHk UI2A72k+RoNKVlVzc20sJZo= X-Google-Smtp-Source: ACHHUZ6IztgDWRzeh47urRu+KgUQcpqYn+XgJrWe+rAIx78kiL2LO3vpTlkayGXUU7bwWY/t3VIxFA== X-Received: by 2002:a1f:1cd5:0:b0:44a:fa96:ac40 with SMTP id c204-20020a1f1cd5000000b0044afa96ac40mr7641511vkc.1.1683653718649; Tue, 09 May 2023 10:35:18 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6102:3347:b0:436:1e7:5141 with SMTP id j7-20020a056102334700b0043601e75141ls1402183vse.1.-pod-prod-gmail; Tue, 09 May 2023 10:35:15 -0700 (PDT) X-Received: by 2002:a67:fd98:0:b0:434:536c:7078 with SMTP id k24-20020a67fd98000000b00434536c7078mr5114384vsq.26.1683653715544; Tue, 09 May 2023 10:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683653715; cv=none; d=google.com; s=arc-20160816; b=QLx/gu6rENQ1wB/sSsp88NFW13Y+QrHA3aOkGk06RDHAyR3xPnf3PvBkBd4OavkUYT iTOu6n+g0yoi28RbC1vj7qYEdSsO3TDnGnIS7lY8z6vwKQxBpH4j2KUpCykN34g/zTdV h4Bs1PKWfH9vZu3nnq1t69sRQ+vzWLx5Sks1pPfBdvd0HH3tCnoS8zNM85Ov+GCOxxtw jkF2Fo00gI+PJK/rH71NkrkvlsXbIGKO4Czpl7E4BEvbw6KPucy1NbR5nOGyY0zgqpIz FSO51pVFlX24ZMS8ZpHQxEcgIFkLx4DBwl9/voMFiGw4rHo1NBDnls0CdErDkS8H0ZgN sU9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=o+hN7S6iPfOGhFST9RXBY7Dr3ZOg989nlzd5B7FlvQA=; b=Wvga1FH5ZQFyFGWDPIuW03uiY42t3/zfFGe4MLw22P659A+jbXVuzInekj0J3P+ObS 2a8fqpzv5/eCAtJjya9QgRS45C5D+Lxy7NhKNNZYWAsTECRPO+BO/bf7Vzt1b2iKmK5m a3HD00CwTSY85CtjFk79TwnaMG4hsEd0slkWp5Xr8B75O27g/Czt6qKF+fz+DTkGFide 0MvE4bzmc3LZwpwNqsVK6j26Zg2UfmlRpESbOdCTfNsD5tO9zhP9A184q8bfGC/cxBS+ mNpskSSN9biKKiMf27+LhgECLe+z22/DqstVrL7qeCCyhDGMUNKL2EUmpyGZ71uBowga AaRA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=gP7lQkNM; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::1129 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com. [2607:f8b0:4864:20::1129]) by gmr-mx.google.com with ESMTPS id y31-20020a9f3262000000b00780b3e54780si993493uad.1.2023.05.09.10.35.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 May 2023 10:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::1129 as permitted sender) client-ip=2607:f8b0:4864:20::1129; Original-Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-559e317eef1so91164167b3.0 for ; Tue, 09 May 2023 10:35:15 -0700 (PDT) X-Received: by 2002:a81:bb46:0:b0:55d:edf3:9e0a with SMTP id a6-20020a81bb46000000b0055dedf39e0amr8882784ywl.27.1683653714670; Tue, 09 May 2023 10:35:14 -0700 (PDT) In-Reply-To: X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=gP7lQkNM; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::1129 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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:32570 Archived-At: --0000000000009679fa05fb462d2b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable There are several things which have to be decided for something as simple as equality comparison. I have no idea how hard or easy it would be to implement it in any form for Pandoc templates, but will point to some decisions which might need to be made. Pandoc variables/metadata can be of several types: strings, booleans, complex data structures =E2=80=94 lists and key=E2=80=94value mappings whic= h in turn can contain any type. I=E2=80=99m not sure if Pandoc treats numbers as distinct= from strings; metadata seems not to. This raises several questions: What happens when the compared objects are of different types: are they silently unequal or is there a warning or an error? How do complex data types compare to each other: content or object equality, same keys or also same values, or same number of keys for mappings? Same items or same number of items for lists? You probably end up needing a length operator! If there are going to be size comparison (less/greater (or equal)) how is size determined. I touched on that above for complex data types, but there are problems for strings too: do we compare byte length or (UTF-8) character length? (I hope the latter!) I don=E2=80=99t know to what extent = metadata contains AST-like objects at the template processing stage, but if they do how do they compare: similar to complex data data structures and/or text content equality? If both there may be need for an operator which stringifies its operand. Shall it be possible to regex match strings? It may be possible to mimic the way Pandoc=E2=80=99s Lua API does these thi= ngs, perhaps even possible to reuse code but pretty soon you will start to have features similar to a general programming language. Where do you draw the line? You could even allow embedding for example Lua, but that may clash with more core templating features, there may be security concerns, and how do you pass what to Lua-land? I have thought a lot about this kind of thing, having put quite some work into creating a small template-like (pre)processor =E2=80=94 I call it an interpolation engine because it can=E2=80=99t really handle formatting of multi-line blocks. Two things which I needed to decide were whether to support complex data structures and whether it should be possible to assign values to variables. For now the answer is yes to the first =E2=80=94 with = the limitation that you can only compare string and/or number xor boolean leaf values =E2=80=94 and no to the second. In core only comparison, pattern mat= ching and true/false =E2=80=94 Lua style where only `false` and `nil` evaluate as= false =E2=80=94 or empty/nonempty =E2=80=94 empty string and 0 also evaluate as false =E2= =80=94 boolean evaluation with something like a ternary operator syntax is in core but there is extensibility by letting the program using the engine supply functions to do arbitrary things, with a syntax for calling and passing arguments to such functions. There is also a mechanism for inserting characters by codepoint or entity name. The thing is that even with comparison etc. built in from scratch and with the limitations on what can be compared a lot of decisions and different operators had to be made. I ended up with several things which made the language not-so-small anymore: - Distinct logic operators for if-true/if-false and if-non-empty/if-empty (they are modular `??` vs. `?!` and `&?` vs. `&!` but anyway! - Distinct operators for numeric (e.g. `=3D=3D#`) and case-folded (e.g. `=3D=3D?`) comparison in addition to straight string comparison (e.g. `=3D= =3D`). Added complication: there is (of course) no numeric pattern matching, but the parser has to take special note of attempts to use the would-be operator! - Distinct =E2=80=9Ctext=E2=80=9D =E2=80=94 parenthesis delimited, with i= nterpolation =E2=80=94 and =E2=80=9Cstring=E2=80=9D =E2=80=94 quotes delimited without interpolation. - Distinct string-variable/function/character-by-id/math interpolation syntaxes (and math is basically an additional DSL which isn=E2=80=99t fully implemented yet!) - Distinct string and math variable spaces. - Support methods for doing expansion-like things with function arguments= . - There are all of for/while/until style loops (although limited to the kinds of comparisons described above). The outcome: I have switched to a simpler syntax which basically is sprintf on not quite as much steroids: (1) Arguments are specified as variable names inside the string. (2) Custom conversions implemented as functions passed when instantiating the formatter object. (3) Custom conversions can have almost arbitrary names, including multi-character names. (4) Multiple arguments per format specifier are possible: (a) by default this means =E2=80=9Cuse the value of the first existing = variable corresponding to a name in the argument list=E2=80=9D, but (b) custom conversions can use the arguments (all strings) however they please, including using them as embedded format strings. Nothing more, but (2), (3) and (4)(b) make a wide variety of extensibility possible =E2=80=94 including everything the more complex syntax described a= bove does =E2=80=94, so inevitably I wrote a =E2=80=9Cmicro=E2=80=9D implementat= ion which leaves any non-standard argument parsing to custom conversion functions and in core supports only single variable name arguments and standard sprintf conversions. /bpj Den tis 9 maj 2023 16:08Stephan Meijer skrev: > I would like to create an open discussion around this. > ------------------------------ > > Hi all, > > As I understand, the templating engine Pandoc uses is built-in. This is > all good, but I feel like there are some missing features. > > One feature I personally miss: > If-statement conditions > > What I miss most, is being able to create conditions in if-statments. For > example: > > %if(pagetitle =3D=3D "null")% > ... > %endif% > > Currently this seems not possible. > > Other users that have noticed this: > > - > https://stackoverflow.com/questions/45404607/if-conditionals-in-pandoc= -templates-depending-on-value-of-a-variable > > ------------------------------ > > Feel free to add your own points. > > -- > 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 > email 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/dbe4c60c-1178-406f-b794-= ce8c9807c2c1n%40googlegroups.com > > . > --=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/CADAJKhC%3D5P-rTeCFbuuVE%2B5YG7b2ND7r%2B0v7vQGoEzFOyAjsDw%40= mail.gmail.com. --0000000000009679fa05fb462d2b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
There are several things which have to = be decided for something as simple as equality comparison. I have no idea h= ow hard or easy it would be to implement it in any form for Pandoc template= s, but will point to some decisions which might need to be made.
<= div dir=3D"auto">
Pandoc variables/metadata can = be of several types: strings, booleans, complex data structures =E2=80=94 l= ists and key=E2=80=94value mappings which in turn can contain any type. I= =E2=80=99m not sure if Pandoc treats numbers as distinct from strings; meta= data seems not to. This raises several questions: What happens when the com= pared objects are of different types: are they silently unequal or is there= a warning or an error? How do complex data types compare to each other: co= ntent or object equality, same keys or also same values, or same number of = keys for mappings? Same items or same number of items for lists? You probab= ly end up needing a length operator!

If there are going to be size comparison (less/greater (or equ= al)) how is size determined. I touched on that above for complex data types= , but there are problems for strings too: do we compare byte length or (UTF= -8) character length? (I hope the latter!) I don=E2=80=99t know to what ext= ent metadata contains AST-like objects at the template processing stage, bu= t if they do how do they compare: similar to complex data data structures a= nd/or text content equality? If both there may be need for an operator whic= h stringifies its operand. Shall it be possible to regex match strings?

It may be possible to mimic= the way Pandoc=E2=80=99s Lua API does these things, perhaps even possible = to reuse code but pretty soon you will start to have features similar to a = general programming language. Where do you draw the line? You could even al= low embedding for example Lua, but that may clash with more core templating= features, there may be security concerns, and how do you pass what to Lua-= land?

I have thought a l= ot about this kind of thing, having put quite some work into creating a sma= ll template-like (pre)processor =E2=80=94 I call it an interpolation engine= because it can=E2=80=99t really handle formatting of multi-line blocks. Tw= o things which I needed to decide were whether to support complex data stru= ctures and whether it should be possible to assign values to variables. For= now the answer is yes to the first =E2=80=94 with the limitation that you = can only compare string and/or number xor boolean leaf values =E2=80=94 and= no to the second. In core only comparison, pattern matching and true/false= =E2=80=94 Lua style where only `false` and `nil` evaluate as false =E2=80= =94 or empty/nonempty =E2=80=94 empty string and 0 also evaluate as false = =E2=80=94 boolean evaluation with something like a ternary operator syntax = is in core but there is extensibility by letting the program using the engi= ne supply functions to do arbitrary things, with a syntax for calling and p= assing arguments to such functions. There is also a mechanism for inserting= characters by codepoint or entity name. The thing is that even with compar= ison etc. built in from scratch and with the limitations on what can be com= pared a lot of decisions and different operators had to be made. I ended up= with several things which made the language not-so-small anymore:

-=C2=A0 =C2=A0Distinct logic ope= rators for if-true/if-false and if-non-empty/if-empty (they are modular `??= ` vs. `?!` and `&?` vs. `&!` but anyway!
-=C2=A0 =C2=A0Distinct operators for numeric (e.g.= `=3D=3D#`) and case-folded (e.g. `=3D=3D?`) comparison in addition to stra= ight string comparison (e.g. `=3D=3D`). Added complication: there is (of co= urse) no numeric pattern matching, but the parser has to take special note = of attempts to use the would-be operator!

=
-=C2=A0 =C2=A0Distinct =E2=80=9Ctext=E2=80=9D =E2=80=94 p= arenthesis delimited, with interpolation =E2=80=94 and =E2=80=9Cstring=E2= =80=9D =E2=80=94 quotes delimited without interpolation.

-=C2=A0 =C2=A0Distinct string-variable/fun= ction/character-by-id/math interpolation syntaxes (and math is basically an= additional DSL which isn=E2=80=99t fully implemented yet!)

-=C2=A0 =C2=A0Distinct string and mat= h variable spaces.

-=C2= =A0 =C2=A0Support methods for doing expansion-like things with function arg= uments.

-=C2=A0 =C2=A0Th= ere are all of for/while/until style loops (although limited to the kinds o= f comparisons described above).

The outcome: I have switched to a simpler syntax which basically = is sprintf on not quite as much steroids:

=
(1) Arguments are specified as variable names inside the = string.

(2) Custom conve= rsions implemented as functions passed when instantiating the formatter obj= ect.

(3) Custom conversi= ons can have almost arbitrary names, including multi-character names.
=

(4) Multiple arguments per fo= rmat specifier are possible:

=C2=A0 =C2=A0 (a) by default this means =E2=80=9Cuse the value of the = first existing variable corresponding to a name in the argument list=E2=80= =9D, but
=C2=A0 =C2=A0 (b) custom conversions can us= e the arguments (all strings) however they please, including using them as = embedded format strings.

Nothing more, but (2), (3) and (4)(b) make a wide variety of extensibility= possible =E2=80=94 including everything the more complex syntax described = above does =E2=80=94, so inevitably I wrote a =E2=80=9Cmicro=E2=80=9D imple= mentation which leaves any non-standard argument parsing to custom conversi= on functions and in core supports only single variable name arguments and s= tandard sprintf conversions.

/bpj


Den tis 9 maj 2023 16:08Stephan = Meijer <me-nPKYAObcRdo6Blr+0TYHagC/G2K4zDHf@public.gmane.org= > skrev:

I would like to create an open discussion around this.


=

Hi all,

As I understand, the templating eng= ine Pandoc uses is built-in. This is all good, but I feel like there are so= me missing features.

One feature I personally miss:

If-statement condi= tions

What I m= iss most, is being able to create conditions in if-statments. For example:<= /font>

%if(pagetit= le =3D=3D "null")%
...
%endif%

Currently this seems not possible.

=

Other users that have notic= ed this:


Feel free to add your own points.

--
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 pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/dbe4c60c-1= 178-406f-b794-ce8c9807c2c1n%40googlegroups.com.

--
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://g= roups.google.com/d/msgid/pandoc-discuss/CADAJKhC%3D5P-rTeCFbuuVE%2B5YG7b2ND= 7r%2B0v7vQGoEzFOyAjsDw%40mail.gmail.com.
--0000000000009679fa05fb462d2b--