public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: Harsh Donga
	<harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: FIguring out pandoc AST and types
Date: Thu, 09 Sep 2021 10:20:29 -0700	[thread overview]
Message-ID: <m24kat3btu.fsf@MacBook-Pro-2.hsd1.ca.comcast.net> (raw)
In-Reply-To: <4bd5ecbc-bd1d-442a-9558-6724174f77fcn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

Harsh Donga <harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> 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.


  parent reply	other threads:[~2021-09-09 17:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09  8:45 Harsh Donga
     [not found] ` <4bd5ecbc-bd1d-442a-9558-6724174f77fcn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-09 17:20   ` John MacFarlane [this message]
     [not found]     ` <m24kat3btu.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-09-14 12:28       ` Harsh Donga
2021-09-14 12:30       ` Harsh Donga
     [not found]         ` <3a59eb3c-352f-49f4-89f8-465aa7e86750n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-14 23:39           ` John MacFarlane
     [not found]             ` <yh480k35q63exs.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-09-16 11:52               ` Harsh Donga
     [not found]                 ` <68431aed-736c-425d-8745-14ffdc5468a9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-16 16:40                   ` John MacFarlane
     [not found]                     ` <m2ilz0lbie.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
2021-09-17  4:18                       ` Harsh Donga
     [not found]                         ` <4b3e7960-d144-44e0-9b48-a044db45f885n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-09-17 19:25                           ` 'Daniel Gnoutcheff' via pandoc-discuss
     [not found]                             ` <b467908f-a4ce-35b9-ba30-ef55e9e70958-rbQqYLFhARYurNyw8EiOWEB+6BGkLq7r@public.gmane.org>
2021-09-18 10:53                               ` BPJ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24kat3btu.fsf@MacBook-Pro-2.hsd1.ca.comcast.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).