From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29744 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Gregory D. Weber" Newsgroups: gmane.text.pandoc Subject: Re: Two treatments of same input file Date: Thu, 09 Dec 2021 15:29:50 -0500 Message-ID: <40aa7ce4ce0d3663e7060018f7366f2a940462c8.camel@gmail.com> References: <736c254f-44fe-49f8-9556-2f4c83c4e5a0n@googlegroups.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="6636"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.36.5-0ubuntu1 To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDVM5VNNVUEBBRGOZGGQMGQEUO5W6KA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Dec 09 21:29:59 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qt1-f189.google.com ([209.85.160.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mvQ3D-0001Yd-PP for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 09 Dec 2021 21:29:59 +0100 Original-Received: by mail-qt1-f189.google.com with SMTP id 4-20020ac85744000000b002b2f329efc2sf10805235qtx.12 for ; Thu, 09 Dec 2021 12:29:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639081798; cv=pass; d=google.com; s=arc-20160816; b=XM/7Kmz1/i2Kx5HncrUAV4bMlUHlV6I/qE5mz8fr5tXvmol6fB/n+Cc2Jf3VS0HYGr jlH/QUSdeu4K4eSS/uRZpBNuKSrkSMTIcVx9LTq19nwu6yOTSLYaWK0L9hbqRTccYLzs XLByc/PCd11w0rtB9zQrTKbhVVS0sBwsE/fgB5u/qbQF1HUAjnbGU85Jsm/93b8Dmlkr 00dWEmjxxn4ibJsLoZeWKusQ8pXUaR3dlUnBV8X5cKmFMcnqRWgX0g+2f74LiOlziz04 jpivPRH0XpfTWvRg8gBICWlFpnxum0qTOqAGXai+tOiDe+cWOve7oq70Pq1Il9tL3bdh T1rQ== 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 :mime-version:user-agent:references:in-reply-to:date:to:from:subject :message-id:sender:dkim-signature:dkim-signature; bh=HZpIaqSJdsZke7GkEvk4psioCHgbzPFq/a1kUhtHC40=; b=MV+cCT5rkQYQwrrB2fj027PjlYQv/c95Nv72sYzamYpM+NvCjUYw3HpGozEtxDtc5j FTfZmP7CwBbAc7mKr5DFd1nXpxrqzSp4WuiALzErwRoLrmpujfIWirvEZYCK4iEnMUnr CfM7MADJIeC2xYFLI3j2/DlprMG37zBMIljMgx2quPcvLTu+4UGcGgODOTegYDhIZo58 Nj91M4t9899N1mNG7vLuO5hDwznsg98J4QswN6Vfr3XYECssp8BQ6y1JEnCZ+EJte7Y6 rCgPq09KPCBAE4IO0EyCeb/VvVR9c/eyVkVPKEOauTy6L/yIhRZOzJc+BxSd0E6VwBoe OLEg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nH7Bh4MX; spf=pass (google.com: domain of spottedmetal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::f31 as permitted sender) smtp.mailfrom=spottedmetal-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=20210112; h=sender:message-id:subject:from:to:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=HZpIaqSJdsZke7GkEvk4psioCHgbzPFq/a1kUhtHC40=; b=VD0rCEdol/IzQp0GhoMV9ERK2dccYjWPYFtmA3rR8540X0FRDovv3/58rf4h1qaDDb BisqoNAvL5olUjjssEm/qwhNrXR8CqNxGWSXZNFcnbQLcZcjaYETMk3QGT1frUIJAhcU PnTbSiYu/gE3BJmOmQX//oc3JRS6E1LkzWIEAXaV/L603BZfSt+sQ5cdna6eYehFEWBp R7FcRqwq+mpXyVjiwdmnaRs5fYyvH4wcLmYJxA9S9CdMGFZ3MJPr8Xg++Py/Tu67FJOz /dZ19qX9o1Q+XS3whZJnm0noocNIPqs27TmEPKVV9+GKKI2sjXWOlfjsH8y7dWcMTuCo fDGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=HZpIaqSJdsZke7GkEvk4psioCHgbzPFq/a1kUhtHC40=; b=b8j+JGCi0YEN3a3qtpOkFF+UkP9ZRLOLCkBbKjMSbYjwHdH/UXmtDKEYqte8LNO+QT VKP+WEXZ4bZBDUWqKdybk2o5tpoeryi3lj2HT9QmfDmFDisGf3649FxqD8i5rf13UQOe LSKlmundyWUjEZwNdyUfGHMFzzO1aNPq7oY9QG71ZVt00Xs5TZJCNZBNuehhsgluTgLI BjYOebY8/V4It8A4JFdJ+Mzy6X0hRzYM0oPS/xkYEIXOjfXNF56pmpel98To+pFjIt1v 570pblES5/QfiKrzOyTy/viF3l0t8of+rDoWzA669hCFi61MVf6abvFqsmRxp1MBcECT M/pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:message-id:subject:from:to:date :in-reply-to:references:user-agent:mime-version :content-transfer-encoding:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=HZpIaqSJdsZke7GkEvk4psioCHgbzPFq/a1kUhtHC40=; b=xPuxIW+fc83wu9dPQXGJMXoQEUHDzFs/XyrpwOG+5GN8IG+5PjSJq8yrhnA7unesD0 zx9MquEpXGF0TJXNuGW4/r6p6lTh6pfL1a+GXf85EaaetLrBmZ5sfMXKa7U5unYDjdxU ZoleTkn4h8UJ2eqRMGjtB/wa4oYzoDsaGXow9LUS78GJNp5uklTnygrI7nocn6GK9kqP Y1nrGl/O32NJazVG3iT0BMDBLdS+H0Ry4VvmWfNWbqsHqTXDKN2OyH9CPJf1/mLIQzbK p4yXMAk+++rhHt1pYcpbyrUMYc/pkgKg5GJ35ML58zXbRHvbbBaEK Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5327S31QEYvBRwolR0IsVB0l68QilXeN9gJOTNHZlXxWSelt/cp4 4tRH8Fet9ZX76Kfv1DouSi4= X-Google-Smtp-Source: ABdhPJwcExB8ruS0gFzBxcBTiLF2CdItCMA+PYCT7nupakzNbTJhxNZgwPEpWlVdEUPBohiwHL/hwQ== X-Received: by 2002:ac8:5f95:: with SMTP id j21mr20445681qta.323.1639081798312; Thu, 09 Dec 2021 12:29:58 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a0c:9d41:: with SMTP id n1ls3630301qvf.8.gmail; Thu, 09 Dec 2021 12:29:56 -0800 (PST) X-Received: by 2002:a05:6214:2345:: with SMTP id hu5mr18945357qvb.76.1639081796629; Thu, 09 Dec 2021 12:29:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639081796; cv=none; d=google.com; s=arc-20160816; b=RSu86XVWS55zr6Hl+cBpZiFQGxO1UAo591BrbfziK5TVyK4m2FCEVj04RNQ12Zaxi2 9/V9Hu37M/KfTmHdbxpAJVmQsPRJ2vZ6n4tLWos0VwMQqX/nFECAEZ6gyHJpceiB0W11 SK0yD7nX8upyDV4aKmUA/WtHFZqsd5u34Lc2XLTGvZALNqvNUHQaAKitPv1X+gdFTuUX +Ctgt/LoIVtjmefl9dCsKaNp75ZmvA9XTD7Ho042W6fS9VPgw18oxJoAMVR5S5ygAffC 8+3dnd/5BacyA41BR+8nr917HoPRE5jXfW48ugqapgtwTcCY+EL2u/HbzstYz4BEgsZD 5rHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:dkim-signature; bh=0eE10zkrsNPJfLUfM890Y2AkuIXhveioOTdi7bqYzHc=; b=ojT0V+WcVXTpKJijhExgh6w3M9NeXDF7hS2t45c1BUOVdXxDzKOvf89ymz5Gsc/w95 HAchjg0Xv/hkpZtsthD2upeNlX0wUE99VAuF18zHg9sZ5Lnmy7IVwNxgyWG08hI1PPW+ Pgg4QyKshiIxNPHg4+vKCZ2ZVTMCS9pyd2uKihb9QyY37yYcmhlK9aZs9no8giCV5lm1 lS10aNcGuoCtvIoVibuK17hZ8/aKgFD6brRqNe58FGDqErEtx9o9I57xHRivpAvqG80R uNFeVajWEa0BkFG4BArAMwwymZgvkfBBr8Vb+Y+XHomIgjbJ/+WJdxXvvZZbv3FddCkD T5+A== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nH7Bh4MX; spf=pass (google.com: domain of spottedmetal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::f31 as permitted sender) smtp.mailfrom=spottedmetal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com. [2607:f8b0:4864:20::f31]) by gmr-mx.google.com with ESMTPS id f38si178077qtb.3.2021.12.09.12.29.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Dec 2021 12:29:56 -0800 (PST) Received-SPF: pass (google.com: domain of spottedmetal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::f31 as permitted sender) client-ip=2607:f8b0:4864:20::f31; Original-Received: by mail-qv1-xf31.google.com with SMTP id bu11so6237570qvb.0 for ; Thu, 09 Dec 2021 12:29:56 -0800 (PST) X-Received: by 2002:ad4:56a6:: with SMTP id bd6mr18684197qvb.129.1639081796108; Thu, 09 Dec 2021 12:29:56 -0800 (PST) Original-Received: from sparrow ([192.182.165.255]) by smtp.googlemail.com with ESMTPSA id v21sm635888qta.0.2021.12.09.12.29.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 12:29:55 -0800 (PST) In-Reply-To: X-Original-Sender: spottedMetal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nH7Bh4MX; spf=pass (google.com: domain of spottedmetal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::f31 as permitted sender) smtp.mailfrom=spottedmetal-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:29744 Archived-At: On Thu, 2021-12-09 at 09:48 +0000, Bastien DUMONT wrote: > You can handle all of this using a Lua filter.=20 I suspected the answer might lie in that direction. So now it's time for m= e to learn some Lua. Okay, thanks for your advice! > Assuming that your first heading will always start with "A" and the secon= d > with "Code to Produce a", I rewrote slightly your input in test.md: >=20 > ``` > ~~~ {.html heading=3D"Form with a Button"} >
> >
> ~~~ > ``` >=20 > Then I wrote in test.lua: >=20 > ``` > local HEADING_LEVEL =3D 2 >=20 > function CodeBlock(block) > if block.attr.attributes.heading then > local raw_heading =3D block.attr.attributes.heading > local html_object_heading =3D pandoc.Header(HEADING_LEVEL, 'A ' .. > raw_heading) > local html_object =3D pandoc.RawBlock('html5', block.text) > local code_block_heading =3D pandoc.Header(HEADING_LEVEL, 'Code to pr= oduce a > ' .. raw_heading) > return { html_object_heading, html_object, code_block_heading, block = } > end > end > ``` >=20 > With the command pandoc test.md -L test.lua, I got the desired result. >=20 > You may want to modify it in order to adapt it to your real needs (like > setting a "header-level" attribute on your raw block, etc.) >=20 > Le Wednesday 08 December 2021 =C3=A0 06:52:34PM, Gregory Weber a =C3=A9cr= it : > > I'm work on creating a set of examples of HTML, JavaScript, and SVG cod= e. > > Each comes from a single source file, from which I want to produce a > > web page showing > > (a) the result of rendering the HTML or SVG or executing the JavaScript= ; > > (b) the code itself, viewed as if in a text editor, and (ideally) with > > syntax highlighting. > >=20 > > The best way I can think of doing this involves making two > > transformations of the source file, running pandoc on each of them, > > and the combining the outputs, probably by running pandoc a third time > > with a custom template. > >=20 > > I'm wondering if there's any better way? > >=20 > > Here's a small example: > >=20 > > (1) Original source file: > >=20 > >
> > > >
> >=20 > >=20 > > (2) Intermediate file 1: > >=20 > > ```{=3Dhtml5} > >
> > > >
> > ``` > >=20 > > (3) Intermediate file 2: > >=20 > > ~~~~{.html} > >
> > > >
> > ~~~~ > >=20 > > (4) Desired final output would be something like this: > >=20 > > ... > >=20 > >

A Form with a Button

> >=20 > >
> > > >
> >=20 > >

Code to Produce a Form with a Button

> >=20 > > > >=20 > > ... > >=20 > >=20 > > -- > > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2] > > https://groups.google.com/d/msgid/ > > pandoc-discuss/736c254f-44fe-49f8-9556-2f4c83c4e5a0n%40googlegroups.com= . > >=20 > > References: > >=20 > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2]=20 > > https://groups.google.com/d/msgid/pandoc-discuss/736c254f-44fe-49f8-955= 6-2f4c83c4e5a0n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=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/40aa7ce4ce0d3663e7060018f7366f2a940462c8.camel%40gmail.com.