From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32371 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matan Bendix Shenhav Newsgroups: gmane.text.pandoc Subject: Re: Layout Hooks in a JSON => PDF Pipeline Date: Tue, 21 Mar 2023 09:12:39 -0700 (PDT) Message-ID: References: <9b05df21-d6cc-4312-963b-d706b24e4f38n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1694_183768598.1679415159631" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9880"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCK7POGS44GRB6FO46QAMGQE64MSBPQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Mar 21 17:12:45 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oa1-f60.google.com ([209.85.160.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1peebM-0002K9-8E for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 21 Mar 2023 17:12:44 +0100 Original-Received: by mail-oa1-f60.google.com with SMTP id 586e51a60fabf-17afa2c993csf7987702fac.2 for ; Tue, 21 Mar 2023 09:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; t=1679415163; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=0FVN3VzeXLgcQrOPT3/EvOZdU78BW1YGZEwwzq49l+c=; b=J/LdASt7RPHDY5tBLLE2Od/nZD6kJ9MfUGSrA21n7nrr00NZRtmd95sNvMZ8B4omeN YEsNTK/G45fZMIgvYbkPcwpnX43e2/HrSWfC0hv8lx1SL6StzdVVUHT5itPgAaGEy/SJ kPlG2vjwym5xXeRIOgyx9nu9IiuAd9wiw0mxpU5tf+uzEAxNMaMxierLUgu5Ilno4nbl LxNRsky+4qY6e4cgnQE2y3vxUvjWhVrpffBG8xU6eWPtODrev+g4EU1g+CPlJbVuBWhO CBROWt/YOTWTGxBdIQY3ctMcwx7L16o7K6Ji2LaWHLVsXVNYa/ih8JDW6rteoOctPnNn /D4w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679415163; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=0FVN3VzeXLgcQrOPT3/EvOZdU78BW1YGZEwwzq49l+c=; b=XoinEcgKmWD8xBmdMNtA70ShFNKPqaNyzCwWkEKwUWN98dBCsQZh6To8BbDtyFjbUE TO64cCjz9Saec8lqqPCup61xy5DTs4fcMt6VwU1zA2QJ+4nBVxVMhD3/Oap5dJyH8/BO ovRxroGulz4gSgSlxhBCoozsXyoAGPGfBpJ51sx66PpCSvanWTepljdbeqaNsmMs3w7m va0z2VG2/AAmcOn1vRVgUUnzEd29Y4hW9xCc+gvtWrr1W39MODOIlps8u3rm/z8S44ny 3kzp5TyXz+mDS7qz3/DL0YePXawnMcsxPIp7ELMpilwaTLWJ8Xg9AD5/p5G7R9wLEC5c SKGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679415163; 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:references:in-reply-to :message-id:to:from:date:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=0FVN3VzeXLgcQrOPT3/EvOZdU78BW1YGZEwwzq49l+c=; b=Yk0i8PDhM07izCRin8Rxj7bqrZqFOki6Hst07Hz90LpqWOTUaUhZQ1LMcmhaSK6W46 l98q82JV8TxxxPXfo/gYFQqXeMochBcOxZkiSfjSVun1tIuC3Mezu+JN5oC6lit15YFL W59sWJGMDyjyrTVXe4fwWFu3Px+hcgWY4Yzr7UTTK7ztjM4Hh/2udam2lK4PjGj8Ce5s 3MFbxi9p9L0rOuogvLjgbznJv8X8GGbOQMNdHxbHnQmvh38+VPAao8zQ3/LvCm/Z/hEq cWJ+/3H817Z5Ry4J3aQ/Ff0sK2H91gyYc3g1+xbxMcUzoyKMqpBFS++dP6S5XRidUyft Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKUbVtXRaBfcRjdTIEIp9v5AmWYe1PZR6QYMjt20HB5ehJ0IOXFy kEHrZJTpcwYRn8Nq+QapjIA= X-Google-Smtp-Source: AK7set8EELgiaw/j1n3Tii6jNDXmGM/z3znxaYpuZlfIzFrse07kDHE9UipIBnZlzGYVBFuQaTEOdw== X-Received: by 2002:a4a:df12:0:b0:534:ed09:a018 with SMTP id i18-20020a4adf12000000b00534ed09a018mr865642oou.1.1679415163146; Tue, 21 Mar 2023 09:12:43 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:e999:b0:177:b908:1eda with SMTP id r25-20020a056870e99900b00177b9081edals5618479oao.1.-pod-prod-gmail; Tue, 21 Mar 2023 09:12:40 -0700 (PDT) X-Received: by 2002:a05:6870:c90a:b0:172:7220:6905 with SMTP id hj10-20020a056870c90a00b0017272206905mr1236454oab.0.1679415160305; Tue, 21 Mar 2023 09:12:40 -0700 (PDT) In-Reply-To: X-Original-Sender: m.shenhav-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:32371 Archived-At: ------=_Part_1694_183768598.1679415159631 Content-Type: multipart/alternative; boundary="----=_Part_1695_282111788.1679415159631" ------=_Part_1695_282111788.1679415159631 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for clarifying! Reading the docs on filters, if I understand=20 correctly the idea is something like this: Input =3D> Reader =3D> AST =3D> Filter =3D> AST =3D> Writer =3D> Output But if I need to write a custom reader anyway, why would I need to encode= =20 additional transformations in a filter? Couldn't I just encode it into the= =20 AST when I read it in in the first place? On Tuesday, March 21, 2023 at 2:31:14=E2=80=AFPM UTC+1 Bastien DUMONT wrote= : > Your custom reader can store the required information in divs, spans or= =20 > attributes (for the elements that support it). Then, when writing to LaTe= X,=20 > you can use a custom filter to convert this information to LaTeX code. > > A word of caution: in your figure, the LaTeX engine comes after Pandoc=20 > (Pandoc outputs a TeX file taking account of the custom template; then th= is=20 > TeX file is processed by the LaTeX engine).=20 > > Le Tuesday 21 March 2023 =C3=A0 05:31:48AM, Matan Bendix Shenhav a =C3=A9= crit : > > I'm looking to implement a web app which allows users to write articles= =20 > which > > automatically get typeset into newspapers. I will be consuming JSON dat= a=20 > and > > want to output PDFs, and want to understand how to provide limited=20 > control of > > element positioning (especially of images) through some sort of layout= =20 > hooks. > >=20 > > Articles will be written in a simple linear rich-text format, but some= =20 > limited > > settings would allow users to control elements of positioning, in=20 > particular > > whether images would appear inline inside a column or blown up to full= =20 > page > > width. > >=20 > > Editing is highly contained to keep things simple. Users select a=20 > collection of > > articles and pick their preferred order, and the application can decide= =20 > the > > details of how to position them. The output is a section of the=20 > newspaper, N > > pages long, as a PDF. > >=20 > > The web editor will output the content in some sort of JSON format=20 > (probably > > extending [1]this API), but if necessary I can easily convert this into= =20 > HTML > > (and indeed, I will have to anyway for the use to view the content in t= he > > editor). > >=20 > > If I understand correctly, the Pandoc pipeline should be something like= =20 > this: > >=20 > > Screenshot from 2023-03-21 13-25-28.png > >=20 > > My main question is about provide element-level hooks to allow to input= =20 > JSON to > > influence output layout. As a simple example, let's say the user adds= =20 > some > > images into the markup. Some images should be inline, while others=20 > should be > > full page width or even full page. > >=20 > > How do I implement such hooks in this sort of Pandoc pipeline? > >=20 > > Thank you for your time! > > =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= =20 > an email > > to [2]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [3] > https://groups.google.com/d/msgid/ > > pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com= . > >=20 > > References: > >=20 > > [1] https://editorjs.io/base-concepts/#what-is-clean-data > > [2] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [3]=20 > https://groups.google.com/d/msgid/pandoc-discuss/9b05df21-d6cc-4312-963b-= d706b24e4f38n%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/f2109e96-b0b2-42da-b19a-0312a41f5952n%40googlegroups.com. ------=_Part_1695_282111788.1679415159631 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for clarifying! Reading the docs on filters, if I understand correct= ly the idea is something like this:

=C2=A0=C2=A0=C2=A0 Inpu= t =3D> Reader =3D> AST =3D> Filter =3D> AST =3D> Writer =3D&= gt; Output

But if I need to write a custom reade= r anyway, why would I need to encode additional transformations in a filter= ? Couldn't I just encode it into the AST when I read it in in the first pla= ce?

On Tuesday, March 21, 2023 at 2:31:14=E2=80=AFPM UTC+1 Bastien = DUMONT wrote:
Your custom reader can store the required information in divs, spans or at= tributes (for the elements that support it). Then, when writing to LaTeX, y= ou can use a custom filter to convert this information to LaTeX code.

A word of caution: in your figure, the LaTeX engine comes after Pandoc = (Pandoc outputs a TeX file taking account of the custom template; then this= TeX file is processed by the LaTeX engine).=20

Le Tuesday 21 March 2023 =C3=A0 05:31:48AM, Matan Bendix Shenhav a =C3= =A9crit :
> I'm looking to implement a web app which allows users to write= articles which
> automatically get typeset into newspapers. I will be consuming JSO= N data and
> want to output PDFs, and want to understand how to provide limited= control of
> element positioning (especially of images) through some sort of la= yout hooks.
>=20
> Articles will be written in a simple linear rich-text format, but = some limited
> settings would allow users to control elements of positioning, in = particular
> whether images would appear inline inside a column or blown up to = full page
> width.
>=20
> Editing is highly contained to keep things simple. Users select a = collection of
> articles and pick their preferred order, and the application can d= ecide the
> details of how to position them. The output is a section of the ne= wspaper, N
> pages long, as a PDF.
>=20
> The web editor will output the content in some sort of JSON format= (probably
> extending [1]this API), but if necessary I can easily convert this= into HTML
> (and indeed, I will have to anyway for the use to view the content= in the
> editor).
>=20
> If I understand correctly, the Pandoc pipeline should be something= like this:
>=20
> Screenshot from 2023-03-21 13-25-28.png
>=20
> My main question is about provide element-level hooks to allow to = input JSON to
> influence output layout. As a simple example, let's say the us= er adds some
> images into the markup. Some images should be inline, while others= should be
> full page width or even full page.
>=20
> How do I implement such hooks in this sort of Pandoc pipeline?
>=20
> Thank you for your time!
> =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
>=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 [2]pandoc-discus...@= googlegroups.com.
> To view this discussion on the web visit [3]https://groups.google.com/d/msgid/
> pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com.
>=20
> References:
>=20
> [1] https://editorjs.io/base-concepts/#what-is-clean-dat= a
> [2] mailto:pandoc-discu= s...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [3] https://groups= .google.com/d/msgid/pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40= googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter


--
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/f2109e96-b0b2-42da-b19a-0312a41f5952n%40googlegroups.= com.
------=_Part_1695_282111788.1679415159631-- ------=_Part_1694_183768598.1679415159631--