From: ss2 <okubo.peyton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Reading yaml metadata
Date: Sun, 10 Dec 2023 21:03:41 -0800 (PST) [thread overview]
Message-ID: <dac9ab6e-b3ad-4645-912e-a7f72f5c7429n@googlegroups.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1719 bytes --]
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 doing
wrong. The code snippet and file I'm reading are attached below. Here is
the output when calling the function:
Right (Pandoc (Meta {unMeta = 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 metadata
block in the source file.
My build depends on pandoc >= 3.1 && < 3.2 and pandoc-types >= 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/dac9ab6e-b3ad-4645-912e-a7f72f5c7429n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 2190 bytes --]
[-- Attachment #2: root.org --]
[-- Type: application/octet-stream, Size: 252 bytes --]
---
title: The document title
author:
- name: Author One
affiliation: University of Somewhere
- name: Author Two
affiliation: University of Nowhere
...
* Root
* Nav
- [[file:posts/hello-world.org][posts]]
- [[file:stream.org][stream]]
About me.
[-- Attachment #3: Example.hs --]
[-- Type: text/x-haskell, Size: 392 bytes --]
import qualified Data.Text as T
import Text.Pandoc
-- Read an org document with a yaml metadata block and print it
printDocWithMetaData :: IO ()
printDocWithMetaData = do
input <- readFile "root.org"
let readerOpts = def {
readerStandalone = True,
readerExtensions = extensionsFromList [Ext_yaml_metadata_block]
}
doc <- runIO $ readOrg readerOpts (T.pack input)
print doc
next reply other threads:[~2023-12-11 5:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 5:03 ss2 [this message]
[not found] ` <dac9ab6e-b3ad-4645-912e-a7f72f5c7429n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-12-12 1:27 ` ss2
[not found] ` <c1b6d4fe-8cd5-482c-b351-be20a658b8d3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-12-12 10:22 ` 'William Lupton' via pandoc-discuss
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=dac9ab6e-b3ad-4645-912e-a7f72f5c7429n@googlegroups.com \
--to=okubo.peyton-re5jqeeqqe8avxtiumwx3w@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).