From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33019 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JJ Newsgroups: gmane.text.pandoc Subject: Re: Setting a template based on YAML metadata blocks Date: Thu, 3 Aug 2023 00:11:27 -0700 Message-ID: References: <6CAC3AED-3628-4F25-BBB9-D3CEA9CECA36@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2318"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCX65AVTRILBBK5GVWTAMGQEJLUAXRY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Aug 03 09:11:44 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f60.google.com ([209.85.161.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qRSUp-0000R8-9k for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 03 Aug 2023 09:11:43 +0200 Original-Received: by mail-oo1-f60.google.com with SMTP id 006d021491bc7-56c9a555c0esf798299eaf.3 for ; Thu, 03 Aug 2023 00:11:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691046702; cv=pass; d=google.com; s=arc-20160816; b=hGklho+8HF8tZu7p/HNJMjW8gQoxNIdqyF6hOmV/xEoLeSB130YW+M9pHVV8ox57KV tvfEZSgS4++9oWl/n1Hf/bnmQRvDAhnQoYfuAUv1tjAlMEzSY0SP+ThOjg+cWKHrjMRR N7D8ytqubBcUVg7qeFTyvZY+sahMzy98JflA6yPVvEs5tqORN3lnWH7JKb6mcLE3Lzvq AdX8E9G7tsu1SGgfmW79We2U83B8KQZ27Hh0WlM16CbRuawRxbNAz6kHXeklbZA9w51V kNxUngtU5Il3blOk+fhhUocoHtCqz7eGp8HJTIwpY5xCmhk2VCMV273teATE3GGFpEHY 18XA== 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:content-transfer-encoding :to:subject:message-id:date:from:in-reply-to:references:mime-version :sender:dkim-signature; bh=O2a17ov/cTU/rb+jnf1eOLUkw5VwbvhlwOrPnxqkhCc=; fh=lLQIEFjEvwB5V09Eekf1lUzB91+XbNjkKM1v5wGHJFY=; b=q7JWwLMK69ih85AG6/1R8t379mET3z6Vehffs+v71p8XpvgS7sfmwibTZ94LTlPhR3 GkUHzqK04nPyat7cU0yWOasrrsn2n0Tl1+pvLMlygvE+AUzcz3FmY/tN4UMS8Z84DAof Sf/hkLhWu7k2UY1EDhphhatWMIl1NP01/r4TNUEOLHrp9l/qkCj9ldpEQ+NcX7VZoEBU M7MPq9qLVhIHuGNsxAP9KnCdgjCFAT1aNLQXWKCJmOEnIYT7UEJTbnYUMpL0M8x1JWu9 6zp4rvwsStAQUBXJfHxqQEHvFX5jN9zzThpUtj5PCn1BRueD1CofHMJmOuw6PWY9I1uM IyDQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@toki-la.20221208.gappssmtp.com header.s=20221208 header.b=feSBn7d8; spf=pass (google.com: domain of jj-pl4xscvadcE@public.gmane.org designates 2607:f8b0:4864:20::b30 as permitted sender) smtp.mailfrom=jj-pl4xscvadcE@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1691046702; x=1691651502; 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 :content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:sender:from:to:cc:subject:date :message-id:reply-to; bh=O2a17ov/cTU/rb+jnf1eOLUkw5VwbvhlwOrPnxqkhCc=; b=irF9H16cVKlZe5GCItIN+4/bicjXWm5f8yEY7d8a4tSwmNr0PCVzMN7JYwcJP+LVND 9gbjRWyouxJJu6CUmSdkbl+iPOlKYEzLJTgO0Bkv471Z4s41YZJWzl5WMHF4A3NM4wO6 Cve21pc0xaE/qRxhC4y4KitmJS5omNyXcJipiy29v9DVgaa8wtpfDqMKKpsQ+h5N8Nmn 2mj9dQhj+Ls6gCvO6fm18DIIp3M1bMOqit1MAaZhZr0yIWFA7LFhtWQoto++v7xchoaz s7TirnBxhHpSk2CzDDOr/h+TrEyuxz1Q/pKNN X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691046702; x=1691651502; 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 :content-transfer-encoding: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=O2a17ov/cTU/rb+jnf1eOLUkw5VwbvhlwOrPnxqkhCc=; b=F3JgI3XghmoVrES0f++0HYTwdII5sZ1A6tQnodTlV/s0DyUa0GnKVW8dVtSA4ZXo/K t7pQolZUjLYA7tr+yplhasNRlWuaBL9zAlQBgmvOY5ImpMgnA3IMPg7w/20UvpHc1kdI egLpXatN0sBujTSYsdgxfXBov5YzchjxaeMPpB1Qgff0tzkMp5VyseE7TXgWesTKqqwa MNbKsJeE/NaZXwm+dwBLN18RlqDHKtseT+bpAmvDSgz0QBj1nKOmyW+80/ Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ABy/qLYbELYhlk8hwZX2cfBWrJAg+fo+jYmJMXFJ0bsl5ZQZnpumCtQ5 kuA2u3eQq0pOLDysUFQ/oLU= X-Google-Smtp-Source: APBJJlHXv0K1QuhGhiN6xXiIcmzXOCzZSYCLka31gxpuvLIF7g1IGND0E0lKr0yyZ+MaSM4nKaUuQQ== X-Received: by 2002:a4a:3015:0:b0:56c:812a:924c with SMTP id q21-20020a4a3015000000b0056c812a924cmr11976458oof.1.1691046702036; Thu, 03 Aug 2023 00:11:42 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a4a:3397:0:b0:56c:afcc:5ba9 with SMTP id q145-20020a4a3397000000b0056cafcc5ba9ls3383312ooq.0.-pod-prod-04-us; Thu, 03 Aug 2023 00:11:39 -0700 (PDT) X-Received: by 2002:a4a:6c09:0:b0:56d:10bb:c2d3 with SMTP id q9-20020a4a6c09000000b0056d10bbc2d3mr2964696ooc.0.1691046698984; Thu, 03 Aug 2023 00:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691046698; cv=none; d=google.com; s=arc-20160816; b=hMVQBhVk+rO/0V8IQyER46Doce6T4CTz2VSWzTt2A7nALDcvIgkq8OIGONB902nv9Z QDgOhA3ocVOc/nS1Rnw+ZAkbjUm1RAKJWACovbzfHvh2lGyGCblzp2C39/LGhz4PZOlH bYuPjxp38VnJG1laNv3/PYMWH8uUPEZXs5SEQrjERhAKGPEHl4DKVLLCO1U5FH/crfTb N4whn7YDhybwpCO9pbDhnrpDKJD3FhT+aFcgUlqKG1wbPD6ORI9Rl/OEXH488yW2MvMB 0kv0b9ijeK0J3XedDkTZ8JQQxTpNk3RyOoIdSsEQlylTA57fBmQ5KLAH5vSIOXQXbARV Iszg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=z5dU/tjFSmbZRo9hIom8vBwsMjfavZYTT6DXp/j06DE=; fh=lLQIEFjEvwB5V09Eekf1lUzB91+XbNjkKM1v5wGHJFY=; b=wI0awb7uPxKa3y3jgMC1x+h6ekzFtYZ/cwzYm7WXj+sX7NYZciPWokiPq5AL1NN2ZD 3GL3NzqSkd9rJQ58jtExB8dFoWcKiyGEUEVJxF4YWmn5GEBO2vpfTyXSRJGiyj8CfkIO jS7IYvhEXqfMeS42gYptPHlSsesB9b9B80iYN77L6m5OR3MWMbRm73vthcK3CANA6MMq u+sy5zNTQiyeP7N68EfvvvOAxh7ZY0IqMTx8Ew0IIXC/T56tW7LK4DhwQWXKavGOuY+d LWBydd7C7zlMx4c2FowtNhXrQdGkSgh5aXOD4pRRboeeP+WBjnkLt2MThxM2KoFrDfAK 4CxQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@toki-la.20221208.gappssmtp.com header.s=20221208 header.b=feSBn7d8; spf=pass (google.com: domain of jj-pl4xscvadcE@public.gmane.org designates 2607:f8b0:4864:20::b30 as permitted sender) smtp.mailfrom=jj-pl4xscvadcE@public.gmane.org Original-Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com. [2607:f8b0:4864:20::b30]) by gmr-mx.google.com with ESMTPS id b16-20020a056820135000b0056ceeb78424si384292oow.1.2023.08.03.00.11.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Aug 2023 00:11:38 -0700 (PDT) Received-SPF: pass (google.com: domain of jj-pl4xscvadcE@public.gmane.org designates 2607:f8b0:4864:20::b30 as permitted sender) client-ip=2607:f8b0:4864:20::b30; Original-Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-d35a9d7a5bdso626903276.0 for ; Thu, 03 Aug 2023 00:11:38 -0700 (PDT) X-Received: by 2002:a25:4287:0:b0:d0e:794f:64ef with SMTP id p129-20020a254287000000b00d0e794f64efmr17223776yba.0.1691046698329; Thu, 03 Aug 2023 00:11:38 -0700 (PDT) In-Reply-To: <6CAC3AED-3628-4F25-BBB9-D3CEA9CECA36-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> X-Original-Sender: jj-pl4xscvadcE@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@toki-la.20221208.gappssmtp.com header.s=20221208 header.b=feSBn7d8; spf=pass (google.com: domain of jj-pl4xscvadcE@public.gmane.org designates 2607:f8b0:4864:20::b30 as permitted sender) smtp.mailfrom=jj-pl4xscvadcE@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:33019 Archived-At: > I'd need more information about what exactly you're trying to do. Oh, I've just been playing around with using pandoc as an SSG ("including" my website's header across pages) to get a sense for how it works. (yes i know, there are nice frameworks like hakyll - this is very much just for learning!). A Lua filter seems nice. > html4 and html5 are separate output formats (but `html` defaults to `html= 5`). That's why. The templates are a bit different. Interesting, the behavior I'm seeing might be a bug then. Only `default.html5` works as a default HTML template, placing `default.html` in `data-dir/templates/` does not override anything. Then also only files ending in `.html`, not `.html5`, seem to be referenceable without the extension with the template flag (ex. --to html --template "funky" only works if a `funky.html` exists, not `funky.html5`). On Wed, Aug 2, 2023 at 9:23=E2=80=AFAM John MacFarlane wrote: > > > > > On Aug 1, 2023, at 11:16 PM, JJ wrote: > > > > Hello, I've been acquainting myself with pandoc for the past few days. > > It's quite neat. I particularly do like pandoc's markdown flavour: > > it's everything I've ever wanted out of such an extension! I had some > > questions that I've been unable to find answers to in the manpage or > > elsewhere, however. > > > > Is it possible to specify a template that pandoc is to use in a YAML > > metadata block? Presumably this would only work with --standalone. > > I've attempted `template: ` after seeing it elsewhere and hoping it > > may work, but no dice. This seems like a common enough use case that > > I'd imagine there is an option I am missing: or perhaps people on this > > mailing list have external solutions. (though I was hoping to avoid > > the use of sed: for no reason other than I've only had to use pandoc > > in my script so far, which has been quite neat) > > No. You can use a defaults file for this. We try to separate metadata f= rom processing instructions. > > > Also, what is best practice for "including" HTML fragments in pandoc? > > I've found nothing in pandoc for this purpose so far - which, well, > > makes a lot of sense. I was planning on first trying to rework things > > to rely entirely on templates, and then in the event of failure just > > sed-ing it up. But I harbour some concerns about accidentally > > replacing text strings or code blocks. > > I'd need more information about what exactly you're trying to do. In the= template, you could include a variable and then populate it from a file us= ing --variable myvar=3D$(cat myfile.html). In the document itself, there's = no built-in way to do this, but you could use a small Lua filter to replace= some element of the text (say, a code block marked with the file name to b= e included) with raw HTML from a file, which would be passed on unmolested = to the output. > > > Also also I am curious: what is the background behind *default* html > > templates needing the .html5 extension, but regular html templates > > using .html? This threw me for a bit of a loop for a bit. > > html4 and html5 are separate output formats (but `html` defaults to `html= 5`). That's why. The templates are a bit different. > > > > -- JJ > > > > -- > > You received this message because you are subscribed to the Google Grou= ps "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/ms= gid/pandoc-discuss/CABHcm%3Dpt_xyOKPCvieJH-QNvArZnCosb_h7xp4g_0RNJ0EECgQ%40= mail.gmail.com. > > -- > 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/msgi= d/pandoc-discuss/6CAC3AED-3628-4F25-BBB9-D3CEA9CECA36%40gmail.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/CABHcm%3DrAT_j28acnFL-NBAZpQjQrtxPKXZ7KMT4MjSqZNnjbOg%40mail= .gmail.com.