kaushalmodi / ox-hugo

A carefully crafted Org exporter back-end for Hugo

Home Page:https://ox-hugo.scripter.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

custom front matter to support a list of elements

Titan-C opened this issue · comments

The :EXPORT_HUGO_CUSTOM_FRONT_MATTER: property supports key value pairs. The value is a string. I happen to need a list of elements in the value.

My current workaround is to use for a toml front matter

:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :animals [\"dog\" \, \"cat\", \, \"penguin\"]

Is there a possibility to directly use a list

:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :animals '("dog" "cat" "penguin")

I hadn't yet planned to support list values. I am glad to see that at least there's a workaround for that.

I use org-babel-parse-header-arguments to parse that whole property. Let me see over this week if a more elegant solution is possible.

For reference, here's the current code that parses those properties.

I quickly tried:

(org-hugo--parse-property-arguments ":a '(b \"c d\")")

and it works as expected.

So below (you wouldn't even need to double quote list elements):

:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :animals '(dog cat penguin)

should be easy to get working.

I am putting implementing this at the top of my list.

@Titan-C Try the latest version from the master (or the next update on Melpa in few hours). Let me know if it works for your use case now.


Test cases:

Thank you for this improvement. I downloaded from Melpa and it works perfectly for my current use case.