* Org mode AUTHOR and KEYWORDS parsing seems instinctively "wrong" @ 2021-05-13 11:30 Garry Cairns [not found] ` <57d2396b-e1e3-4096-9cd7-408f615a6839n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Garry Cairns @ 2021-05-13 11:30 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1917 bytes --] tl;dr I'd expect KEYWORDS and AUTHOR to be parsed as MetaList types. But it seems they are individual strings/MetaInlines. Am I just misunderstanding the intent? Background I've used Slick as a static site generator for a little while (https://ilikewhenitworks.gitlab.io/). I don't post very often, and when I tried to write a post recently a rebuild of the code showed it no longer worked. I should be able to fix my personal issue by downgrading versions, but the root of the problem seems generally applicable. Given an org-mode file with headers: #+TITLE: Org Mode in Hakyll #+AUTHOR: Garry Cairns, Someone Else #+DATE: 2019-03-17 #+KEYWORDS: emacs, haskell #+STARTUP: showall I'd expect KEYWORDS and AUTHOR to be parsed as MetaList types. But it seems they are individual strings both from how my static site builder now fails with an expected Array got String error, and from the following output: [nix-shell:~/code/ILikeWhenItWorks]$ pandoc -s -t native posts/2019-03-17-org-test.org Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str "Garry",Space,Str "Cairns,",Space,Str "Someone",Space,Str "Else"]),("date",MetaInlines [Str "2019-03-17"]),("keywords",MetaInlines [Str "emacs,",Space,Str "haskell"]),("title",MetaInlines [Str "Org",Space,Str "Mode",Space,Str "in",Space,Str "Hakyll"])]}) This is with [nix-shell:~/code/ILikeWhenItWorks]$ pandoc --version pandoc 2.10.1 Compiled with pandoc-types 1.21, texmath 0.12.0.2, skylighting 0.8.5 Am I misunderstanding here? -- 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/57d2396b-e1e3-4096-9cd7-408f615a6839n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 2439 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <57d2396b-e1e3-4096-9cd7-408f615a6839n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Org mode AUTHOR and KEYWORDS parsing seems instinctively "wrong" [not found] ` <57d2396b-e1e3-4096-9cd7-408f615a6839n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-05-13 12:30 ` Albert Krewinkel [not found] ` <87v97myfwk.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Albert Krewinkel @ 2021-05-13 12:30 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw We aim to stay close to the Emacs reference implementation, and the new behavior is consistent with that of Org mode exporters as of org-version 9.4. The changelog for pandoc 2.10 has this info: + The behavior of the `#+AUTHOR` and `#+KEYWORD` export settings has changed: Org now allows multiple such lines and adds a space between the contents of each line. Pandoc now always parses these settings as meta inlines; setting values are no longer treated as comma-separated lists. Note that a Lua filter can be used to restore the previous behavior. Here's a sample Lua filter to restore the old behavior (untested): --- Split a string on the given separator char. local function split_string (str, sep) local acc = pandoc.List() for substr in str:gmatch('([^' .. sep .. ']*)') do acc:insert(tostring(substr)) end return acc end function Meta (meta) meta.author = split_string(pandoc.utils.stringify(meta.author,',')) return meta end See https://pandoc.org/lua-filters.html for more details. HTH, Albert Garry Cairns <garryjcairns-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > tl;dr > I'd expect KEYWORDS and AUTHOR to be parsed as MetaList types. But it seems > they are individual strings/MetaInlines. Am I just misunderstanding the > intent? > > Background > I've used Slick as a static site generator for a little while > (https://ilikewhenitworks.gitlab.io/). I don't post very often, and when I > tried to write a post recently a rebuild of the code showed it no longer > worked. I should be able to fix my personal issue by downgrading versions, > but the root of the problem seems generally applicable. Given an org-mode > file with headers: > > #+TITLE: Org Mode in Hakyll > #+AUTHOR: Garry Cairns, Someone Else > #+DATE: 2019-03-17 > #+KEYWORDS: emacs, haskell > #+STARTUP: showall > > I'd expect KEYWORDS and AUTHOR to be parsed as MetaList types. But it seems > they are individual strings both from how my static site builder now fails > with an expected Array got String error, and from the following output: > > [nix-shell:~/code/ILikeWhenItWorks]$ pandoc -s -t native > posts/2019-03-17-org-test.org > Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str > "Garry",Space,Str "Cairns,",Space,Str "Someone",Space,Str > "Else"]),("date",MetaInlines [Str "2019-03-17"]),("keywords",MetaInlines > [Str "emacs,",Space,Str "haskell"]),("title",MetaInlines [Str > "Org",Space,Str "Mode",Space,Str "in",Space,Str "Hakyll"])]}) > > This is with > > [nix-shell:~/code/ILikeWhenItWorks]$ pandoc --version > pandoc 2.10.1 > Compiled with pandoc-types 1.21, texmath 0.12.0.2, skylighting 0.8.5 > > Am I misunderstanding here? -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <87v97myfwk.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>]
* Re: Org mode AUTHOR and KEYWORDS parsing seems instinctively "wrong" [not found] ` <87v97myfwk.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> @ 2021-05-13 12:56 ` Garry Cairns 0 siblings, 0 replies; 3+ messages in thread From: Garry Cairns @ 2021-05-13 12:56 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3507 bytes --] That makes sense, thanks. Since the behaviour is fine I suspect the simplest thing for me will be to specify Pandoc < 2.10 in my cabal file On Thursday, 13 May 2021 at 13:31:00 UTC+1 Albert Krewinkel wrote: > We aim to stay close to the Emacs reference implementation, and the new > behavior is consistent with that of Org mode exporters as of org-version > 9.4. The changelog for pandoc 2.10 has this info: > > + The behavior of the `#+AUTHOR` and `#+KEYWORD` export > settings has changed: Org now allows multiple such lines > and adds a space between the contents of each line. Pandoc > now always parses these settings as meta inlines; setting > values are no longer treated as comma-separated lists. > Note that a Lua filter can be used to restore the previous > behavior. > > Here's a sample Lua filter to restore the old behavior (untested): > > > --- Split a string on the given separator char. > local function split_string (str, sep) > local acc = pandoc.List() > for substr in str:gmatch('([^' .. sep .. ']*)') do > acc:insert(tostring(substr)) > end > return acc > end > > function Meta (meta) > meta.author = split_string(pandoc.utils.stringify(meta.author,',')) > return meta > end > > See https://pandoc.org/lua-filters.html for more details. > > HTH, > Albert > > Garry Cairns <garryj...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > tl;dr > > I'd expect KEYWORDS and AUTHOR to be parsed as MetaList types. But it > seems > > they are individual strings/MetaInlines. Am I just misunderstanding the > > intent? > > > > Background > > I've used Slick as a static site generator for a little while > > (https://ilikewhenitworks.gitlab.io/). I don't post very often, and > when I > > tried to write a post recently a rebuild of the code showed it no longer > > worked. I should be able to fix my personal issue by downgrading > versions, > > but the root of the problem seems generally applicable. Given an org-mode > > file with headers: > > > > #+TITLE: Org Mode in Hakyll > > #+AUTHOR: Garry Cairns, Someone Else > > #+DATE: 2019-03-17 > > #+KEYWORDS: emacs, haskell > > #+STARTUP: showall > > > > I'd expect KEYWORDS and AUTHOR to be parsed as MetaList types. But it > seems > > they are individual strings both from how my static site builder now > fails > > with an expected Array got String error, and from the following output: > > > > [nix-shell:~/code/ILikeWhenItWorks]$ pandoc -s -t native > > posts/2019-03-17-org-test.org > > Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str > > "Garry",Space,Str "Cairns,",Space,Str "Someone",Space,Str > > "Else"]),("date",MetaInlines [Str "2019-03-17"]),("keywords",MetaInlines > > [Str "emacs,",Space,Str "haskell"]),("title",MetaInlines [Str > > "Org",Space,Str "Mode",Space,Str "in",Space,Str "Hakyll"])]}) > > > > This is with > > > > [nix-shell:~/code/ILikeWhenItWorks]$ pandoc --version > > pandoc 2.10.1 > > Compiled with pandoc-types 1.21, texmath 0.12.0.2, skylighting 0.8.5 > > > > Am I misunderstanding here? > > > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > -- 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/7266c668-28b9-4021-839f-19b4a34f5745n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 5475 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-13 12:56 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-13 11:30 Org mode AUTHOR and KEYWORDS parsing seems instinctively "wrong" Garry Cairns [not found] ` <57d2396b-e1e3-4096-9cd7-408f615a6839n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-05-13 12:30 ` Albert Krewinkel [not found] ` <87v97myfwk.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-05-13 12:56 ` Garry Cairns
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).