From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29236 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:28:20 -0700 (PDT) Message-ID: 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_4186_602232903.1631622500502" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31130"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD75NRVM24GBBZNKQKFAMGQENN6QXXQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Sep 14 14:28:25 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f184.google.com ([209.85.167.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mQ7Y0-0007sM-BS for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 14 Sep 2021 14:28:24 +0200 Original-Received: by mail-oi1-f184.google.com with SMTP id n9-20020a0568080a0900b002689a4834e4sf8467491oij.12 for ; Tue, 14 Sep 2021 05:28:24 -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=FG1/3zv4kuNxaLpU6Kd6LRC01Ws5CXD+8RE22N33Z+I=; b=pxAJlfgZoQt0K3kPx9VMZhWP2Oe5EPPvNoeroOxE3qiqV2BEBhmU6waYtJ9I0MqjJ4 RhXJVpryjN3Q6HfOV2YZwOicPMQCRAPSGrvY3GwK4pwEbBaABvME0A028O8FCUVw+DOC VwnF4eJwz7bCYtDqBr4iFSoqyvVNboiszBaXdIY+Sdd3HE+mOMxG8M1KnwOGwPi4VWgV ZguVLWWuQfHbbY0xVy1NU4aLiMTkFvMZ+OeRVZqs4DhuTWhP/dKhZsqdzsUQrvUzrpy7 lMoGoZJ0C1fPU7f9+Bw0m0eqLi8xZ6eMnhu0UZVAHoTZ57njVW4wq4t88fJ4qCrijxSu tOdA== 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=FG1/3zv4kuNxaLpU6Kd6LRC01Ws5CXD+8RE22N33Z+I=; b=Q5R3UXfeDMTGYuilb1BPFWu7dRXG26nKl8XhyoN7k0kl47x+EQhFEpCcmGu1EyOI93 7XLD2GRGPM0NqQLF/WNMWR8YxYU410+fyT809mYZltPtyr3Qrbzf1AZBf8zED7RCYlV6 BxCO99XZqB+fqopvlRmyVIB3KgmKl0z/9pcdukkAB8ovz9g+cnAPasbUBW5+Oxam6nQa rPIOd16HdHXx49DF2t0I0a/hO8EW68qckaWoekAMWTsg5ICeu1gxiD6SuCGxiJmEMHbH 9Mgvy4/gX/Anl8iPtAv1pw1b6HxISto5TTnd8SUWX0nxekMwMKYCeSouo19/3uGvyVZC EAug== 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=FG1/3zv4kuNxaLpU6Kd6LRC01Ws5CXD+8RE22N33Z+I=; b=5TeNWDZotPB9FZpP4PogiSja7nSO+Be7mbCRdHVG41Gbnl90pQMYD3OifGZJHoedig ZUzOgQ+kQLEdGElyhU6ehHcHmHT3eKtstrXJAeqdga/QqY0MZa9ZF0G6UL2hCk4iNXbR CQuSlC6hg/2hkQnlwCepXBkh0scRXAzsmKHfjmoK2tQwOL0Qc+VfkDCnUQTR0C5BUkI9 1bvsSygZJ3epTyBYKwc2riEppoNVLi6PWV+0vEOuxM+mipvvkwjIA61NrsWwM6UNdqsn v4vsbR5MNgBNe6+zYF6ldmLYyEPzJ1I+Y9gJX2Xx1zxnJ1CwU0QxCGi1Vo/qt6a5yrTN qKzA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530c3SfvOWM+CTwDpTGoc1MM4NXNXA0Nq1uM6i4js0cNZsZ5lnYh EhG3PeZGO36UDvaQLxZuLRY= X-Google-Smtp-Source: ABdhPJzU/iIZttdZc2Y+8QahMc4acZSUVJAYnz9XefOv8ss2yhZGysZ5rf0z4YYkrOibw71j068w6Q== X-Received: by 2002:a54:4491:: with SMTP id v17mr1263882oiv.94.1631622502851; Tue, 14 Sep 2021 05:28:22 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:7ad3:: with SMTP id m19ls3009888otn.2.gmail; Tue, 14 Sep 2021 05:28:21 -0700 (PDT) X-Received: by 2002:a05:6830:4c1:: with SMTP id s1mr13926644otd.221.1631622501099; Tue, 14 Sep 2021 05:28:21 -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:29236 Archived-At: ------=_Part_4186_602232903.1631622500502 Content-Type: multipart/alternative; boundary="----=_Part_4187_1280284740.1631622500502" ------=_Part_4187_1280284740.1631622500502 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 the 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/f3dfb122-d074-45e4-887c-06dc47c72ff4n%40googlegroups.com. ------=_Part_4187_1280284740.1631622500502 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 the figure out by looking at output how actually = all types are stored in JSON?

It would be really h= elpful 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 <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/f3dfb122-d074-45e4-887c-06dc47c72ff4n%40googlegroups.= com.
------=_Part_4187_1280284740.1631622500502-- ------=_Part_4186_602232903.1631622500502--