From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29237 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Harsh Donga Newsgroups: gmane.text.pandoc Subject: Re: FIguring out pandoc AST and types Date: Tue, 14 Sep 2021 05:30:47 -0700 (PDT) Message-ID: <3a59eb3c-352f-49f4-89f8-465aa7e86750n@googlegroups.com> References: <4bd5ecbc-bd1d-442a-9558-6724174f77fcn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_4084_1735043811.1631622647209" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2682"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD75NRVM24GBB6FLQKFAMGQETJZN6OI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Sep 14 14:30:50 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f59.google.com ([209.85.161.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mQ7aM-0000VZ-5y for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 14 Sep 2021 14:30:50 +0200 Original-Received: by mail-oo1-f59.google.com with SMTP id a127-20020a4a4c850000b029028b35f322edsf10628120oob.9 for ; Tue, 14 Sep 2021 05:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=/7oQKPeZOCsVDq1ZVPadhj346jMwht0p7t+WY11d0YU=; b=RfprviDlfEjqPAVAN29kkHjuMSX7ZId8LDVFtYMWmWUj9tsO1FXvBd4JLbDaDA5Zpp GW5hPIlwEEavALQqfYSIXI3gbMYt8C3IQ1jNSUufLH+OYTZRFVCZruEugoh8z06CouSf CLziIMqd2HxN6onLXgCbCl8xZs6iV370D25UGmROUlI8tBost4g1hNfxc2eMZRYsMdXW L6H3rHBZax9HwP3isjUQzYlhGowTa+XojwJKxWlBIzHsMrHyorRnhiZW17p4KICMouaQ NNtxNnfEAPf2p+z4nnDE9W5DOyKBo3kYJMoxXZ0xxdch81s6GpauKP6rqp3dDKInPkBn uq0g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inclusivestem-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=/7oQKPeZOCsVDq1ZVPadhj346jMwht0p7t+WY11d0YU=; b=dYbYRz/Y0gNKmUjoXdvI+LOqYpvZhuSevKacbNm2WtDc7KYMxWAE0+oAvNWMyx+pxy fo+p0y2+xovyZ0xVo6nlyxKsflJ51wWN2uoOKd7Df7LgGWho1r+Xv7FWVAhtU74yA6yT Br2tETEYPxv9qCHIVKp9Yg2tBdgcO6Pji4ZGgnXjtQdgRyTPBLKbNBQMZQn6a9hb81ut zj9oh20XvFWgJc0ofCjn6rBc0DQT4jqrUFC0J8kV6ZsjFc7oIljysABifpx7R+vtyNL2 J/8WYmfqSvvCb/ceRwKXFXwfvrRGp3w2IoUkB9rHly7TDOlciw76HosAoCM+3qwr+QLn gyDw== 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:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=/7oQKPeZOCsVDq1ZVPadhj346jMwht0p7t+WY11d0YU=; b=fD2weaeUNo7CHj/weG3ekv6yu/cccl519w91kD9G6LMgrs5ClHa7PGTN6WbWVcgzWd NTlwNzIOHQcWiRNn7A5ay86oa7YeO3Ep879RSOehVT5O9DA9rY4fftrs6IV6z5RYqnIN BQo2h+pJN1xKeJMmZ75HiylFwcQDzzIWzF+2KBARF0z93AQ7SfOk0pT80DObQfGD1+RP DEG9X5Qd7Sm7fQd4ZoupqZMBMCcWkrXgk2kmD5PoaulN/uRkqW2YRgkZNDgPMIO+bWrf +IAbRzpowg8lMrjpjpn5Gf6Dm6T3st8BreFKr65foyqUm8fGZ9UImbCl/dQemz3ByGbB GAyw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531E3nWvVIRvtjr1tS99l5oh/pqB+H7AAYpJcMb/6eJIqeQNNU67 HzlmBDiWobnZ9Y80LZ3VuCM= X-Google-Smtp-Source: ABdhPJyZ8Z5E+jHm+kKWmNz1CJQueYCVQhcIZnst+SDengjjRd3fEaawdMA52luhW9MwfRvHVe8TyQ== X-Received: by 2002:a4a:2c49:: with SMTP id o70mr13744748ooo.71.1631622649117; Tue, 14 Sep 2021 05:30:49 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:4408:: with SMTP id q8ls3004851otv.7.gmail; Tue, 14 Sep 2021 05:30:47 -0700 (PDT) X-Received: by 2002:a05:6830:90e:: with SMTP id v14mr14668451ott.222.1631622647727; Tue, 14 Sep 2021 05:30:47 -0700 (PDT) In-Reply-To: X-Original-Sender: harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@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:29237 Archived-At: ------=_Part_4084_1735043811.1631622647209 Content-Type: multipart/alternative; boundary="----=_Part_4085_135133211.1631622647209" ------=_Part_4085_135133211.1631622647209 Content-Type: text/plain; charset="UTF-8" Thank you for your response, It is getting really hard for me to parse and build pandoc using pandoc types, as I am Haskell beginner. Please correct me if I am wrong, but the only way to see the JSON output is by trying out pandoc? I mean for covering all the pandoc-types, I will have to put everything in a document then parse using pandoc? And then figure out by looking at output how actually all types are stored in JSON? It would be really helpful if there can be another way around it! On Thursday, 9 September 2021 at 22:50:45 UTC+5:30 John MacFarlane wrote: > Harsh Donga writes: > > > Okay, being new to Haskell some of the questions might seem vague and > some > > straightforward to you, I apologize in advance for that. > > > > 1. How can I create pandoc type variables, where exactly do I look if I > > want to make a table object purely using Haskell then convert it to JSON > > AST/other formats > > You want to look at > > > https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pandoc-Builder.html > > > 2. How can I convert my own JSON (storing elements analogous to HTML) to > > pandoc AST > > If it's a custom JSON format, then you'll need to parse it to a > pandoc AST using a Haskell JSON parsing library (like aeson). > Alternatively, you could convert your JSON format to the JSON > serialization pandoc uses (which you can inspect using > pandoc -t json). > > > 3. is there any way possible to make pandoc type variables using other > > languages like JS, Python... > > As noted above, you can construct a JSON document that represents > the pandoc AST; pandoc can then read this (pandoc -f json). > > To understand pandoc's JSON serialization, the best thing to use > is pandoc itself. > > pandoc -t native > > will give you a look at the pandoc AST > > pandoc -f native -t json > > will show you how pandoc represents AST elements in JSON. > > -- 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/3a59eb3c-352f-49f4-89f8-465aa7e86750n%40googlegroups.com. ------=_Part_4085_135133211.1631622647209 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you for your response,

It is getting really hard f= or me to parse and build pandoc using pandoc types, as I am Haskell beginne= r.

Please correct me if I am wrong, but the only w= ay to see the JSON output is by trying out pandoc? I mean for covering all = the pandoc-types, I will have to put everything in a document then parse us= ing pandoc?
And then figure out by looking at output how actually= all types are stored in JSON?

It would be really = helpful if there can be another way around it!

On Thursday, 9 September 202= 1 at 22:50:45 UTC+5:30 John MacFarlane wrote:
Harsh Donga <ha...-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> writes:

> Okay, being new to Haskell some of the questions might seem vague = and some=20
> straightforward to you, I apologize in advance for that.
>
> 1. How can I create pandoc type variables, where exactly do I look= if I=20
> want to make a table object purely using Haskell then convert it t= o JSON=20
> AST/other formats

You want to look at

https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pand= oc-Builder.html

> 2. How can I convert my own JSON (storing elements analogous to HT= ML) to=20
> pandoc AST

If it's a custom JSON format, then you'll need to parse it to a
pandoc AST using a Haskell JSON parsing library (like aeson).
Alternatively, you could convert your JSON format to the JSON
serialization pandoc uses (which you can inspect using
pandoc -t json).

> 3. is there any way possible to make pandoc type variables using o= ther=20
> languages like JS, Python...

As noted above, you can construct a JSON document that represents
the pandoc AST; pandoc can then read this (pandoc -f json).

To understand pandoc's JSON serialization, the best thing to use
is pandoc itself.

pandoc -t native

will give you a look at the pandoc AST

pandoc -f native -t json

will show you how pandoc represents AST elements in JSON.

--
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/3a59eb3c-352f-49f4-89f8-465aa7e86750n%40googlegroups.= com.
------=_Part_4085_135133211.1631622647209-- ------=_Part_4084_1735043811.1631622647209--