-
DescriptionHow can I access and iterate over the following metadata in a quarto document? staff: admin: testing: I want to produce the following in the document: Admin Staff: John Doe. Any pointers on the best way to implement this? |
Beta Was this translation helpful? Give feedback.
Answered by
cscheid
Jul 5, 2023
Replies: 1 comment 1 reply
-
There are at least two ways:
Let me give you an example of the latter. In your document, you write: ---
filters:
- filter.lua
admin:
staff:
- name: John Doe
- name: Jane Doe
# note here that i'm not using the indirection you want; but you should
# be able to adapt this to your needs.
---
Admin Staff: []{#admin-placeholder} -- filter.lua
local admin_staff
local capture_meta = {
Meta = function(meta)
admin_staff = meta.admin.staff
end
}
local replace_list = {
Span = function(span)
if span.identifier == "admin-placeholder" then
local result = pandoc.Inlines({})
for i, v in ipairs(admin_staff) do
result:insert(pandoc.Span(pandoc.utils.stringify(v.name)))
if i < #admin_staff then
result:insert(pandoc.Span(pandoc.Str(", ")))
end
end
return result
end
end
}
return { capture_meta, replace_list } This file produces this output: ![]() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rputikar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are at least two ways:
Let me give you an example of the latter. In your document, you write: