From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29241 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: FIguring out pandoc AST and types Date: Tue, 14 Sep 2021 16:39:11 -0700 Message-ID: References: <4bd5ecbc-bd1d-442a-9558-6724174f77fcn@googlegroups.com> <3a59eb3c-352f-49f4-89f8-465aa7e86750n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26923"; mail-complaints-to="usenet@ciao.gmane.io" To: Harsh Donga , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBNHFQSFAMGQEZ7QZAXY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Sep 15 01:39:36 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ua1-f55.google.com ([209.85.222.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mQI1Y-0006kq-ES for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 15 Sep 2021 01:39:36 +0200 Original-Received: by mail-ua1-f55.google.com with SMTP id e17-20020ab03111000000b002b313609437sf341744ual.13 for ; Tue, 14 Sep 2021 16:39:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1631662774; cv=pass; d=google.com; s=arc-20160816; b=PVdCKn35C5D0ix/FjsieGyvSR3BBpDoTx+xV2qx9QZhtMIVQYrwGpZp00fneTmgsFy IlD1FVldzmjH6Ciqbpqrs7krRA6ttSYGopLgh/487RxjCbigzGTcDEdBEA/qotskdxZZ hGRZoBjAPJfGGpm1B4cydf1rYR5S3M52yJdg9AAHY1yGMd+x0RXDBGG6GWuLpbnEwVk2 p9joWlw4hGFI88WZ3fixKm4y/3e8Oni1xpEyPf6prIehJbayaE9n/vKVzpFneMgDEqfN 6Tmu3gYh7I/UimxzyT47WOVxSyGfcbJBDirGCx/3UrcsKAnPmaZVJgG0SWBNGJOPLJvI BTSA== 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:mime-version:message-id :date:references:in-reply-to:subject:to:from:sender:dkim-signature; bh=oY8clRcR0MVToEwlb7j5gMmFvN7WBGml7ZGKKR3Ibtc=; b=W+sfyGk1X6iessc0159yFPXc1FMLKLrcw1j9XBmMXCCevjyNAbUf9zseV+rRB25tyr yE7SmTQ2dbc3xGGgyi6RPipBoxlb2epVxmlr4AFg06iF+gHaNnvx0QQWHkQfRDtJrB/M Jyn8s8b8OMKY/5JIlNTJL06XLu+PqxpOv8mbW0G20iTGjYgwvVP5NQEqDcZ4YqZz5fwb C4ewvUv7PdL+LF6T/HXYq2yCQ29Skos0c67x9LvJ68bzsmqwpO8fHQ/B/ZawUgMIPDYD G1l7R53LAxCRQI3GAdoHK7SZoNFTkZEinrzKrFUZ+/1UIz4GcQxfK5yCQejw0iDnznHz tuJQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=LVvckN10; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52c as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version: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=oY8clRcR0MVToEwlb7j5gMmFvN7WBGml7ZGKKR3Ibtc=; b=AfsUzfRvjSgSPFRIzIPF/PK/Bw39qBuGTLXztpE5O0vemnM7bLYpwkcae9pfouz0wM p96p5f19Hdgt4jxqkq2sutVWNFVpAYRI7ea/aAujnbTbwi9ftLsXC7LzFbmveVMU3Wa7 bxPXJSIbRIgfL0Ewt8XKGgQ4+BphubrXany8pss5U2fcog8hdGUY177cFB1LpZRsXTU/ Ku61i17o2oiaj4EF8Ct+GRgRiUKOSA0o5Wxi+CQmFIVpPeG1stdumTP7kL6nrBfFZVAL OIJbRDv6Z5BRqANABYeOkXn/nwUwb/5dvO+hVC4rUXjleXicspFfe+rH6WdGaAClU6de OzQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :date:message-id:mime-version: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=oY8clRcR0MVToEwlb7j5gMmFvN7WBGml7ZGKKR3Ibtc=; b=eOiZMuM+nVVbDnAU2b/Fhr1pVR/5V7FghmQYIEfes5TURLNnRx29YFAgm0mkT7wDia 1bsQHk0LEirmYFQBxqMF53KQ29+paX6xl41Zi2uT3NW3REs2FEURfVd5hZA2Qpq3TIzG dmPs++O1iXFT0HK2bN2sC2vmBL7a/RmPbNMAHxco07cIHUW73TOsnpbSJHzeQ4r9fjLC bIEsaGO/BF0hLCHCF9c/eNGmvvjQcVS7u085w9WylaNLzE6tx0Y5QxCpTcLx/nRhGDHR dlvGwMUun+ciD31bKxjHf3iapehYzTqgt7IU20N3aOa9gBJ0oqtTm+VTDT8JCDj5GsaJ NY6w== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532ZnT6Ed4gOGwYIri5AlQ3QnWi9jXh/vJO1612teMAxS2cuZFB1 IbjsKL4IO71J8TqJIm9QNAw= X-Google-Smtp-Source: ABdhPJzTdkzFJD3+SqXb8BnweocuEN248P5FU895LXhEpsyT3BzXnb2NavZI54j5n98OMwGisu4Emw== X-Received: by 2002:a1f:2ecb:: with SMTP id u194mr1319704vku.12.1631662774515; Tue, 14 Sep 2021 16:39:34 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6102:44f:: with SMTP id e15ls97139vsq.2.gmail; Tue, 14 Sep 2021 16:39:32 -0700 (PDT) X-Received: by 2002:a67:c412:: with SMTP id c18mr1439066vsk.52.1631662772343; Tue, 14 Sep 2021 16:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631662772; cv=none; d=google.com; s=arc-20160816; b=A8iTcLj6chSLGL9Ce1nVCZaWLDI5szsGNcZ+qETjnNtAY4OUizuNdd0tcJZNTwxfsb 7ZaLyaS2i2kA8tk12/2BtfXIJ4xuo91dKEl8zg3iMlWMoq5lqvyCQOm3EyHzAqb6YxIZ rfEuAeUfp+eo0HTHwp4nzRdXgy2PgzIb9QR87llw+QoMIl+HanTsMdkyvl3BqmpLayUU fRoRgGOJqMemgV8KG/Z6O6wsqJPXSvXAdT9U5Aygj02V5GqM7lzKqKhWuzd7H/vCGBt+ COrokTtatks4r4oeQkJ6qKVq0RjkitU8XmzygoSIIdS9Z7qGC0Z+dUlb0hj5BoOfC12s n8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=MoqUtq7MExA+Nxto5dsn+qVCDEvY06Km8C+XbvUtrqk=; b=zyRVQbeYBuq2seTMiL5Lu1kqgjToWIYUwehcT6pT/AVJyvg5MP0n5nS4wprlQuSQaw IObmbTnSiXCIXG7DV2OH4oaYyC0y/33NgS41kRvCveOh57uWsrIT9ltDvu3fkG5zAU9o ZTKaEp3t5glZZ0YjGCZO9rknDdr7c6NlbFV0fePsaAXT6bvHhbnZcbVUWXzAJAJuOKvg RNx4z58g9ZtU3JbUnCUgJ0XZV7230tK+24MRtv7g7mZmBxxQB27aAyIG3Ya3cT5uzsOj z9XSK9wD2o3o/moOCNLPDWXdpcYKOox0JlKQB5umPW/Xzx6LhVT9oWHTIzOkFfOb27cS l3hA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=LVvckN10; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52c as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com. [2607:f8b0:4864:20::52c]) by gmr-mx.google.com with ESMTPS id u23si13221vsn.2.2021.09.14.16.39.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Sep 2021 16:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52c as permitted sender) client-ip=2607:f8b0:4864:20::52c; Original-Received: by mail-pg1-x52c.google.com with SMTP id w8so837480pgf.5 for ; Tue, 14 Sep 2021 16:39:32 -0700 (PDT) X-Received: by 2002:a63:7447:: with SMTP id e7mr17804184pgn.46.1631662770539; Tue, 14 Sep 2021 16:39:30 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id t5sm6449817pfh.140.2021.09.14.16.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 16:39:29 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id CE9FDA1A8; Tue, 14 Sep 2021 19:39:18 -0400 (EDT) In-Reply-To: <3a59eb3c-352f-49f4-89f8-465aa7e86750n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=LVvckN10; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::52c as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:29241 Archived-At: Harsh Donga writes: > 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? There isn't complete documentation of the JSON format we use, but it's all very regular and can be predicted from the AST given a few examples. Pandoc can be used to give you those examples. Or, you can look at the ToJSON and FromJSON instance definitions in the source code for Text.Pandoc.Definition and figure it out from that. However, if what you want to do is to use Haskell to create a pandoc AST, then you don't need to worry about JSON at all. JSON is just a serialization format we use for communicating with non-Haskell programs. For building a document, what you want is Text.Pandoc.Builder, as I said. The documentation contains an example to get you started.