From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33513 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "'William Lupton' via pandoc-discuss" Newsgroups: gmane.text.pandoc Subject: Re: Reading yaml metadata Date: Tue, 12 Dec 2023 10:22:10 +0000 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000069438060c4d6dee" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31717"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBX7I4CVQMGQET6EQAII-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Dec 12 11:22:29 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ed1-f57.google.com ([209.85.208.57]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1rCzuG-00082T-Un for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 12 Dec 2023 11:22:28 +0100 Original-Received: by mail-ed1-f57.google.com with SMTP id 4fb4d7f45d1cf-5510488fcf9sf1449719a12.1 for ; Tue, 12 Dec 2023 02:22:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702376548; cv=pass; d=google.com; s=arc-20160816; b=GaFZMpgIBvd5bx9mfMu+V/yH8B32wOxo1YMZXYgYHOcUpNNuHUd47QLksGVuw6XOC3 XuN6jkvzXBWkr68g1pA7whzrPfy5oKhCabfIUxT0Po6KduygBTgmPjsGp2LhMdMOBTU5 VUwiUfsaSdUhLvxH5ibI9A8rcP+gjoTcOLcyvUWMD/Cwznx+pwNd6rQUK2XRfjSdlGj8 sE/LTJvFKIrXlwdaF1yJYfXAbBVZE63VjttXuFvXHvtfhxWtRgGyWa/5FcqtMpANJdrP pvYjHSDXT9MjcGsa+EiT0EsV/G7GDmY21B1R/MNaSiwjkcG6bpiWkkpNjCoLDEdgKx9Y 9rpw== 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:to:subject:message-id:date :from:in-reply-to:references:mime-version:dkim-signature; bh=cLD0fuBS5wsVvWhF06MuYn7P1tMPi84lu8Lnb1KXJ9A=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=eSfUyGuh3fRiZHHTrysQTt6ANQf+trbWK8miOJSWPLVxWk9utF29C+rhF/IJ4jgS9q +hXsyCOQceNbNEleC333lBeB6QQfUmFKy9oD89hqCNQwXqsHVeIMabVly9XRpS8Mnb42 Z4Mj4FOOZ89qUjj/5NMDtD1U80BoJZwRqqR6gDKbX/mmej2X3pqBujHVGXEf8LxTNvGd WAZJChsePmYxGD3GfcYwt/pfxyPBH8X410b3Dg0IVK/M+w3Y0EEfB3uuFkRhAwovKN72 swYEMmUam9gzjCkhUJRywxfaMm56a5Q0q7C3l/rhH2Rh6m+vGUI2wHdTWd4PUXhkUsSR JdRQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=DoIAqTtV; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52d as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1702376548; x=1702981348; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=cLD0fuBS5wsVvWhF06MuYn7P1tMPi84lu8Lnb1KXJ9A=; b=UQtOYFl7A5w96TYncTvZ1rI73D52u5gvpH5Pn5wugjMMtSGCq36wUcbtewTE5o/nSp UhfYQQqzmcIjJjcPoJI3NNfE2ucLyLQtd0Mg1z4iTqrN59fdot4wInxm4E9aRz6FXFHU mG+MBaH96Nf+g0aT3Dfs3p/00kVK9Qqqe4ZA+NHi7oKYK/E88nY+WbX4vamzTwtLy81E 7qvxGA42yXwVc8NOXUHxPqKLoDnJGYXEOdFieimGg4ifFaYt66str4y5vLyMfdS1Dtll l7+/jAVBrJvs85GZTdGE8j1H2zLaaduA6O9z/q7GVWxWhuISHNsEpaPvVAJ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702376548; x=1702981348; 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-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cLD0fuBS5wsVvWhF06MuYn7P1tMPi84lu8Lnb1KXJ9A=; b=HLF3oKChOYCMI3T8Hqmp1p6CZi5CpL9DQ+sePD2JrRLFJ7k5EOUuspmAprA/vNe2UZ 89YEbaj1ahn7xMLYlM0hAKwAkWeT/jUG8xjlh8dlCgmTx/P1bO0mtvigIS93NYv3GabZ +wjOeB7N2XIXhlZiv8W8r0QUFEiCGSl6TfvF2mFDIJPJKCbz4+osX49pAzAfZIwMOQE4 dp0qtd0IwLluVsyXrNKe/EoMkSDYMG4tmo380xGVdaT5RiljF4+tjL4tXM6VX3rx8gwR O5K+ZWaF+AXhn X-Gm-Message-State: AOJu0YympkJwP3sk9HaUCChgtKByqwD+gu435f33io0zWY/K4vXQyAfc TajitmQ9x2n6wN7EGlgpF/c= X-Google-Smtp-Source: AGHT+IH+rCurynwzR2V+DopdsjBdupqmvSXSqqZz7j7EdZGWjL/L7JYX+xV2jkwFaFDWUlRdLvYDfg== X-Received: by 2002:a50:9b1b:0:b0:551:5646:ade8 with SMTP id o27-20020a509b1b000000b005515646ade8mr740414edi.34.1702376548148; Tue, 12 Dec 2023 02:22:28 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6402:4517:b0:551:46b6:345e with SMTP id ez23-20020a056402451700b0055146b6345els50893edb.1.-pod-prod-04-eu; Tue, 12 Dec 2023 02:22:22 -0800 (PST) X-Received: by 2002:a17:906:225d:b0:a1d:251a:4056 with SMTP id 29-20020a170906225d00b00a1d251a4056mr3131427ejr.8.1702376542163; Tue, 12 Dec 2023 02:22:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702376542; cv=none; d=google.com; s=arc-20160816; b=c4qzMWRsUM2lADa4hv4NIvhNsQM8o3V71+O28brN+y1lkcfU6VMcxlF/MuNj6kjv7G VJACdU2IE18Ir3E1xOL14bvwdFtUfHULR3IlwsQOAkiF1tbQHGD/XmHqCPl4v5CJxsH4 Q4TcBPRkB9BVx8vpdNtfkX5NS5NQK7rrXsykOYDm2zQwzSnyYcNd/bOjyKk7Z4PiuPku Cabv+2h+i1JH136oknXZoF9o1JlklW654REdMaZqidateKcCiB+fjF55l6FHu5FYkl7W 5/M0tRwwYeGDJPDO+YHdnujT6k45j1WGXsXPp+30bbZjsQvr5kMgu1Tpmu+d4I3hG2lR zUrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=b4Qpiy8XHHpcvvJz5n/Jk0cztLAfmC27OdcFDa6a5j4=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=tW3DVt0LdPGP2YDGiIKuouSvsqFsyP5HgJrDo/biNa6OBOiXT8JqY1xq7U74a7mczz Crz2N3VpncUEDvlTr2c9W8yr5ogaWzlOuw7nMmIHTORGz473J3zl/YAxsrazXnoRJhti 9DlVfVQKRhE1a+EO+mbhTymGueGxkvcQnnMlJ1K4vhFgoDOqvzxh0wQ1FCLUfMjDp8rY fLDcrSoCMMS+oQlT04pbSnO8RzwHiWpv8kLFAJMHElYx37ij+lNPViTN2zXfyqwZEEKm 5N+zmbm656PBPDzDzN+z4xkZnrVcgwlVeuQkuyX9uyohGePuQFpfhrBmDL8EaHgpyW0c D4qw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=DoIAqTtV; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52d as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org Original-Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com. [2a00:1450:4864:20::52d]) by gmr-mx.google.com with ESMTPS id dt10-20020a170907728a00b00a1b84033db7si408856ejc.1.2023.12.12.02.22.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Dec 2023 02:22:22 -0800 (PST) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52d as permitted sender) client-ip=2a00:1450:4864:20::52d; Original-Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-54cb4fa667bso7810538a12.3 for ; Tue, 12 Dec 2023 02:22:22 -0800 (PST) X-Received: by 2002:a17:906:2c6:b0:a1f:9bd2:7f67 with SMTP id 6-20020a17090602c600b00a1f9bd27f67mr2042614ejk.123.1702376541421; Tue, 12 Dec 2023 02:22:21 -0800 (PST) In-Reply-To: X-Original-Sender: wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=DoIAqTtV; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52d as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org X-Original-From: William Lupton 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:33513 Archived-At: --000000000000069438060c4d6dee Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I don't use org myself, but I'm wondering whether the org reader supports YAML metadata blocks. *% *pandoc --list-extensions=3Dorg -ascii_identifiers +auto_identifiers +citations -east_asian_line_breaks -fancy_lists -gfm_auto_identifiers -smart +task_lists On Tue, 12 Dec 2023 at 01:27, ss2 wrote: > Maybe attaching the files was inconvenient. > > Haskell code > ``` > import qualified Data.Text as T > import Text.Pandoc > import Text.Pandoc.Walk (query) > > -- Extract YAML metadata from document > getMetaData :: Pandoc -> Meta > getMetaData (Pandoc meta _) =3D meta > > -- Read an org document with a yaml metadata block and print it > printDocWithMetaData :: IO () > printDocWithMetaData =3D do > input <- readFile "root.org" > let readerOpts =3D def { > readerStandalone =3D True, > readerExtensions =3D enableExtension Ext_yaml_metadata_block > (getDefaultExtensions $ T.pack "org") > } > eitherDoc <- runIO $ readOrg readerOpts (T.pack input) > doc <- handleError eitherDoc > let metaData =3D getMetaData doc > print metaData > ``` > > Input file (root.org): > ``` > --- > title: Hello, World! > author: > - name: Your Name > affiliation: Your Affiliation > --- > > * Introduction > > Hello, World! This is a simple org-mode document with a YAML header. > > * Conclusion > > Thank you for reading! > ``` > > Std out: > ```Meta {unMeta =3D fromList []}``` > > The input file contains a yaml metadata block yet the pandoc reader isn't > extracting it. > > > On Sunday, December 10, 2023 at 11:03:41=E2=80=AFPM UTC-6 ss2 wrote: > >> Hello Everyone, >> >> I'm simply trying to read a markup file (org in this case). I'm able to >> read its contents but not the metadata. I've tried reading the >> documentation and looking at a few examples and I'm not sure what I'm do= ing >> wrong. The code snippet and file I'm reading are attached below. Here is >> the output when calling the function: >> >> Right (Pandoc (Meta {unMeta =3D fromList []}) [Para [Str >> "\8212",SoftBreak,Str "title:",Space,Str "The",Space,Str >> "document",Space,Str "title",SoftBreak,Str "author:"],BulletList [[Plain >> [Str "name:",Space,Str "Author",Space,Str "One",SoftBreak,Str >> "affiliation:",Space,Str "University",Space,Str "of",Space,Str >> "Somewhere"]],[Plain [Str "name:",Space,Str "Author",Space,Str >> "Two",SoftBreak,Str "affiliation:",Space,Str "University",Space,Str >> "of",Space,Str "Nowhere"]]],Para [Str "\8230"],Header 1 ("",[],[]) [Str >> "Root"],Header 1 ("",[],[]) [Str "Nav"],BulletList [[Plain [Link ("",[],= []) >> [Str "posts"] ("posts/hello-world.org","")]],[Plain [Link ("",[],[]) >> [Str "stream"] ("stream.org","")]]],Para [Str "About",Space,Str "me."]]) >> >> As you can see the metadata is empty even though there is a yaml metadat= a >> block in the source file. >> >> My build depends on pandoc >=3D 3.1 && < 3.2 and pandoc-types >=3D 1.23= . >> >> Any help would be greatly appreciated!! >> >> Best, >> P >> > -- > 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/c1b6d4fe-8cd5-482c-b351-= be20a658b8d3n%40googlegroups.com > > . > --=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/CAEe_xxhm5nqFVMMAq%3DzUTA%3DSLo4bAf3gQ0DDaKVLSx9a5A7HPw%40ma= il.gmail.com. --000000000000069438060c4d6dee Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I don't use org myself, but I'm wondering whether = the org reader supports YAML metadata blocks.

% pandoc --list-extensions= =3Dorg

-ascii_identifiers

+auto_identifiers

+citations

-east_asian_line_breaks

-fancy_lists

-gfm_auto_identifiers

-smart

+task_lists


On Tue, 12 Dec 2023 at 01:27, ss2 &l= t;okubo.peyton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> = wrote:
Mayb= e attaching the files was inconvenient.

Haskell co= de
```
import qualified Data.Text as T
impor= t Text.Pandoc
import Text.Pandoc.Walk (query)

-- Extract YAML met= adata from document
getMetaData :: Pandoc -> Meta
getMetaData (Pan= doc meta _) =3D meta

-- Read an org document with a yaml metadata bl= ock and print it
printDocWithMetaData :: IO ()
printDocWithMetaData = =3D do
=C2=A0 input <- readFile "root.org"
=C2=A0 let readerOpts =3D def {
=C2= =A0 =C2=A0 readerStandalone =3D True,
=C2=A0 =C2=A0 readerExtensions =3D= enableExtension Ext_yaml_metadata_block (getDefaultExtensions $ T.pack &qu= ot;org")
=C2=A0 }
=C2=A0 eitherDoc <- runIO $ readOrg readerO= pts (T.pack input)
=C2=A0 doc <- handleError eitherDoc
=C2=A0 let = metaData =3D getMetaData doc
=C2=A0 print metaData
```

Input file (root.org):
```
---
title: Hello, World!=
author:
=C2=A0 - name: Your Name
=C2=A0 =C2=A0 affiliation: Your = Affiliation
---

* Introduction

Hello, World! This is a sim= ple org-mode document with a YAML header.

* Conclusion

Thank = you for reading!
```

Std out:
= ```Meta {unMeta =3D fromList []}```

The input file= contains a yaml metadata block yet the pandoc reader isn't extracting = it.


On Sunday, December 10, 2023 at 11:03:41=E2=80=AFPM UTC-6 ss2 wrote= :
Hello Eve= ryone,

I'm simply trying to read a markup file= (org in this case). I'm able to read its contents but not the metadata= . I've tried reading the documentation and looking at a few examples an= d I'm not sure what I'm doing wrong. The code snippet and file I= 9;m reading are attached below. Here is the output when calling the functio= n:

Right (Pandoc (Meta {unMeta =3D fromList []}) [= Para [Str "\8212",SoftBreak,Str "title:",Space,Str &quo= t;The",Space,Str "document",Space,Str "title",Soft= Break,Str "author:"],BulletList [[Plain [Str "name:",Sp= ace,Str "Author",Space,Str "One",SoftBreak,Str "af= filiation:",Space,Str "University",Space,Str "of",= Space,Str "Somewhere"]],[Plain [Str "name:",Space,Str &= quot;Author",Space,Str "Two",SoftBreak,Str "affiliation= :",Space,Str "University",Space,Str "of",Space,Str= "Nowhere"]]],Para [Str "\8230"],Header 1 (""= ,[],[]) [Str "Root"],Header 1 ("",[],[]) [Str "Nav= "],BulletList [[Plain [Link ("",[],[]) [Str "posts"= ;] ("posts/hello-world.org","")]],[Plain [Link ("&= quot;,[],[]) [Str "stream"] ("stream.org","")]]],Pa= ra [Str "About",Space,Str "me."]])

=
As you can see the metadata is empty even though there is a yaml metad= ata block in the source file.

My build depends on = pandoc >=3D 3.1 =C2=A0&& < 3.2 and pandoc-types >=3D 1.23.=

Any help would be greatly appreciated!!

Best,
P

--
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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https= ://groups.google.com/d/msgid/pandoc-discuss/c1b6d4fe-8cd5-482c-b351-be20a65= 8b8d3n%40googlegroups.com.

--
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://gro= ups.google.com/d/msgid/pandoc-discuss/CAEe_xxhm5nqFVMMAq%3DzUTA%3DSLo4bAf3g= Q0DDaKVLSx9a5A7HPw%40mail.gmail.com.
--000000000000069438060c4d6dee--