From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29724 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Two treatments of same input file Date: Thu, 9 Dec 2021 09:48:17 +0000 Message-ID: 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="6982"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBNVCY6GQMGQEBTSADKA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Dec 09 10:49:45 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f63.google.com ([209.85.167.63]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mvG3d-0001dh-6B for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 09 Dec 2021 10:49:45 +0100 Original-Received: by mail-lf1-f63.google.com with SMTP id n18-20020a0565120ad200b004036c43a0ddsf2430956lfu.2 for ; Thu, 09 Dec 2021 01:49:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639043384; cv=pass; d=google.com; s=arc-20160816; b=lmQC+PefvNP98IZIWkyBlr8lLJFF3bfRWosdT0Yz5Pjg8UWI/jkwGPGJN0cCWqMO7Q GRZTNuAwISGkEIMrrko3UK8R1bdb0FhwaOf01WYPpyH5cO8hvks3Sd3pJnILtU19VqlW uXr5FnvSvcd91Ed4b1s2R0TDQBYAAeeO63yFe/DZZ/TQZwCuw42DbXa59BHcSXoKLMKn s+5WdR2n4jWFTjElvUTDgNUoJhS4zHqAYT40pVfdMsX5AtM1yrNYKmgBM/Jef3Ypir+y RDLJX/zlJiW+r2oHPnJlaQaRJMHPkswkvZ8rRCYimWo5iHtB5zNJV+PDW7ENF8g0mJ7V OHog== 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:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=Z6GAj072P6T0zOF57UImqyolA9x7mH11pA74zbk/V8g=; b=gfoDhKNKcGD0oWGvu0hFMP86JwKqyvAtLIntjhxjK8aGjg85nJJdGi83KHSUE3TkE6 +Gcg1uXe/5Tk389TIzftUFRVCaUYz8ApXZgMxKRwDJ8beHeCiQkz3PqVln+UIeT7nXes 8z+Z5kWU2eUamrbBrifmk2Vj1KgtrVvLkDzH++dG96Ig458HW6yfPQNvmd9RPLUDRbJg BiI+Zf/hE28hsa33wXQUeRm4YhTqf5BjU/9fCu+o52k4HpBi/jpEZf5PMyi6SQVfTJnv Y1SBWP71hVO7+QH6q0BtepFUT5q+H9tOmkfdEh4Rd8qQ3dWIv2wMTHL9UUMrzJdysiWd /iwg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=sPSvZL3K; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :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=Z6GAj072P6T0zOF57UImqyolA9x7mH11pA74zbk/V8g=; b=bdB3lzaLKIsNuQieCt2c608z8syNRJmTY+WD2sC8t8KpFmlVQa6St8j7vD+ujcwvZy LyTdiNZ+3utxm8LgPn2epQTN0+elliw7JIoWoX2YqyjnRTil1M7IGX1J/vLgGXEziZzf 0nakbjOvAvTfqSAei7vRkCBbeMMaI6o9ChItSUBmP/lQTZ40h3YfB2i3x4t1gSCMc/cG lCLQNMp+DYLLeobzroAueQw0yuBjmUcaY9ukWFkPLKl/HAQYU0QQp2cFBMnijpTTLX4k JyWy019544gm22r3BxNhuLsLuhynNhkJh+F3uLeDhEYt+atI3Hj+nHuKHAhzxxu6oXh6 qD2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to: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=Z6GAj072P6T0zOF57UImqyolA9x7mH11pA74zbk/V8g=; b=4LShbWiqK7AvcJE2PAXbvyYqjTwx1TS66al5z+c+oOAvDGKewQhnxUoPiZfesFOy2r 4MR5+bngVrgadrmqJBfczECIm6AmDSZadmdbDDIBHjla34gHi14YIslX4vINydnMYpjg P87pmdbS5s8RpInLzzR2wQgLr6Zajg6hGC7ZcBQN8xP3MrMlR6W76fBxy0Tgrf0TLKcV qB+ixlgEKOLDArZm4LQDUQtYf/ThUSHb6xppcZ7vjKLf0mXcTded1EyVbn1pqYkQewK3 iXJqEBOMCyhwvSeiAjotO/jUbv8nOp2PZ8LAKqhSKQib Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533MU8gFH0Rldpv2cy++pd15Xu2ZstDzxoSmqUX2C+dzJcmOiQ7f osOX3lhAyr8jo8jwDvxKbNM= X-Google-Smtp-Source: ABdhPJw3woi/4InTNenR18t2WvhgtvyLFrOv7vBw0VFmLltUkFSS3vaAw+T+iqle8CWcZlPytSDfUQ== X-Received: by 2002:a05:651c:1722:: with SMTP id be34mr5075953ljb.52.1639043384635; Thu, 09 Dec 2021 01:49:44 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:651c:b1f:: with SMTP id b31ls791261ljr.0.gmail; Thu, 09 Dec 2021 01:49:42 -0800 (PST) X-Received: by 2002:a2e:9056:: with SMTP id n22mr5411274ljg.127.1639043381923; Thu, 09 Dec 2021 01:49:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639043381; cv=none; d=google.com; s=arc-20160816; b=uCfeYZ75k5FZG6A6bHyIHvUI3R1IAW388XSp5vTISiPQvlbzjva4iBAzBTH0lnjjZs WeQx7qsZ6JXh82llKfPaWW2lXXvCpjxV6Ox6ToR0Tlh8wM+AG6Kjt2/F7kfBSdOp+711 3yLwJmvKGic8Fx323eK4j1wIK9TDmDB11q0hdyk1ENroPNRhFb8q6n0HrV1Et7SXZzfk 600ATqzJlijv1CYdEIutGh3+LiunDplviXCTw80va5NgvtGIgmydSm8HpCeGESmJe9ux PbFFnzgVx4wtz39HonJN7xObk5pz6oeEzkqXzx0dn14wfbNynR+RRmVU+Hqqtn/29hbu mVSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=Rn7MT3YWEvDGcjCCv3cgV6/pYIA7PRtjw82Zanv8BUg=; b=yFxAS6J59hqpDj/xKgYvIY4V60qiblzoRUhU4mmCP1lxP0dU1EN52Z/xB6MqoD95dQ gWgLAtuRbwUH74yQAUYNaVuQAZzmXe9eh9TfuIFyGURWtUP8xpqa1kVPIlOsVfu6TwZ1 o3GxGrW1+AfvCS9f4PCqR6td+duyl2A8PpT8AHip9burF3xDuBIK4MIHZ6PQUbiEQbUl rVy9ijs5echb/rfxsAyhN1W8+kHizvLt629NYP3m6QLbSjpy5byPXDFU2cx8Ge1N2lCB 4Ev7KsOPOBZBihxJKxuLCinffqT01LY4v2ESHFw6MJEswrClZsb5whLUVcUm7YPPX5DA 8Plg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=sPSvZL3K; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout02.posteo.de (mout02.posteo.de. [185.67.36.66]) by gmr-mx.google.com with ESMTPS id r15si240155ljp.1.2021.12.09.01.49.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 01:49:41 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) client-ip=185.67.36.66; Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id EB308240122 for ; Thu, 9 Dec 2021 10:49:40 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4J8q502zH8z6tmQ for ; Thu, 9 Dec 2021 10:49:40 +0100 (CET) Content-Disposition: inline In-Reply-To: <736c254f-44fe-49f8-9556-2f4c83c4e5a0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=sPSvZL3K; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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:29724 Archived-At: You can handle all of this using a Lua filter. Assuming that your first hea= ding will always start with "A" and the second with "Code to Produce a", I = rewrote slightly your input in test.md: ``` ~~~ {.html heading=3D"Form with a Button"}
~~~ ``` Then I wrote in test.lua: ``` local HEADING_LEVEL =3D 2 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 prod= uce a ' .. raw_heading) return { html_object_heading, html_object, code_block_heading, block } end end ``` With the command pandoc test.md -L test.lua, I got the desired result. You may want to modify it in order to adapt it to your real needs (like set= ting a "header-level" attribute on your raw block, etc.) Le Wednesday 08 December 2021 =C3=A0 06:52:34PM, Gregory Weber a =C3=A9crit= : > I'm work on creating a set of examples of HTML, JavaScript, and SVG code. > 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 Groups > "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/m= sgid/ > pandoc-discuss/736c254f-44fe-49f8-9556-2f4c83c4e5a0n%40googlegroups.com. >=20 > References: >=20 > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/736c254f-44fe-49f8-9= 556-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/YbHQ4fLbj/vJ65mY%40localhost.