public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Reading yaml metadata
@ 2023-12-11  5:03 ss2
       [not found] ` <dac9ab6e-b3ad-4645-912e-a7f72f5c7429n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: ss2 @ 2023-12-11  5:03 UTC (permalink / raw)
  To: pandoc-discuss


[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-12 10:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11  5:03 Reading yaml metadata ss2
     [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

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).