Closed andreas-h closed 2 years ago
So the day has finally come. Someone actually needs this feature? :P
This is a known limitation. See https://ox-hugo.scripter.co/doc/custom-front-matter/#maps-of-single-and-list-values: "Maps of maps are not supported.".
I didn't implement that because I wasn't sure if all the effort needed in designing this complicated feature would be worth it.
But now I'll think of a user-friendly way of entering this table meta data in Org that would translate to that TOML table.
I will work on this, but this feature is not a high priority.
How can I get ox-hugo to create these lists (like [interests = ...] and [[education.courses]] ...) which both span over several lines, in the front matter of the exported Markdown?
Just to be clear, if you look at that link I pasted, the "interests" front-matter setting is already supported.
But the "education.courses", which is a TOML table of tables, is not yet.
@andreas-h Hello, I thought a bit more about this. While I won't have time implementing a full-fledged parsing of maps of maps type front-matter, I have added a brute-force solution that would work for any kind of front-matter in https://github.com/kaushalmodi/ox-hugo/commit/ca0e602f7ede31313e028223965bd8aca99252c6.
See https://ox-hugo.scripter.co/doc/custom-front-matter/#front-matter-extra for details.
Here's a test case: https://ox-hugo.scripter.co/test/posts/front-matter-toml-toml-extra/ (see the Markdown source link in there for ox-hugo generated front-matter + content).
Here's the source of that test from the test suite:
** Extra Front-matter :extra:verbatim:src_block:
:PROPERTIES:
:EXPORT_HUGO_WEIGHT: 5
:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :widget "about"
:EXPORT_HUGO_CUSTOM_FRONT_MATTER+: :active "true"
:EXPORT_HUGO_CUSTOM_FRONT_MATTER+: :interests '((interests . ("Artificial Intelligence" "Computational Linguistics" "Information Retrieval")))
:END:
*** TOML Front-matter :toml:
:PROPERTIES:
:EXPORT_HUGO_FRONT_MATTER_FORMAT: toml
:END:
**** Extra Front-matter (TOML, TOML extra) :toml_extra:
:PROPERTIES:
:EXPORT_FILE_NAME: front-matter-toml-toml-extra
:END:
{{{oxhugoissue(226)}}}
The ~#+begin_src toml :front_matter_extra t~ TOML block here will get
appended to the TOML front-matter.
#+begin_src toml :front_matter_extra t
# List your qualifications (such as academic degrees).
[[education.courses]]
course = "PhD in Artificial Intelligence"
institution = "Stanford University"
year = 2012
[[education.courses]]
course = "MEng in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2009
[[education.courses]]
course = "BSc in Artificial Intelligence"
institution = "Massachusetts Institute of Technology"
year = 2008
#+end_src
#+begin_src toml
# this TOML block will export to the Markdown body
#+end_src
Hey, @kaushalmodi , that's so great - thanks a lot! This actually solves all my needs :-)
I'll close this issue because, I haven't felt a real need to implement this feature in these many years (and it would be very complicated if I attempted to do it).
Also front matter extra already solves the need.
So I'll close this issue.
Thanks!
I'm using the Academic Theme. They have a way of combing the homepage from several
.md
files, one could look like this, e.g.:How can I get ox-hugo to create these lists (like
[interests = ...]
and[[education.courses]] ...
) which both span over several lines, in the front matter of the exported Markdown?