Switch ox-hugo export from TOML to YAML frontmatter
TOML frontmatter interprets bare dates like 2022-10-31 as date literals requiring time components, causing parsing issues. YAML handles dates as strings by default, avoiding these problems. Changes: - export.ex: Add org-hugo-front-matter-format set to yaml - index.ex: Update title regex to match YAML format (title: vs title =) - quartz.config.ts: Use default FrontMatter plugin (YAML) instead of TOML
This commit is contained in:
@@ -73,6 +73,9 @@ defmodule OrgGarden.Export do
|
||||
(format "[cite:%s]" (string-join keys ";")))))
|
||||
""",
|
||||
"--eval", "(setq org-cite-export-processors '((t passthrough)))",
|
||||
# Use YAML frontmatter instead of TOML to avoid date parsing issues
|
||||
# (TOML interprets bare dates like 2022-10-31 as date literals requiring time)
|
||||
"--eval", "(setq org-hugo-front-matter-format 'yaml)",
|
||||
"--eval", ~s[(setq org-hugo-base-dir "#{output_dir}")],
|
||||
"--eval", ~s[(setq org-hugo-default-section-directory "#{section}")],
|
||||
"--visit", orgfile,
|
||||
|
||||
@@ -29,7 +29,8 @@ defmodule OrgGarden.Index do
|
||||
path
|
||||
|> File.read!()
|
||||
|> then(fn content ->
|
||||
case Regex.run(~r/^title\s*=\s*"(.+)"/m, content) do
|
||||
# Match YAML frontmatter: title: "value" or title: value
|
||||
case Regex.run(~r/^title:\s*"?(.+?)"?\s*$/m, content) do
|
||||
[_, t] -> t
|
||||
_ -> slug
|
||||
end
|
||||
@@ -76,8 +77,8 @@ defmodule OrgGarden.Index do
|
||||
|
||||
defp generated_index?(content) do
|
||||
# Our generated index uses "title: Index" in YAML frontmatter.
|
||||
# ox-hugo uses TOML frontmatter (title = "..."), so this won't
|
||||
# match user-exported files.
|
||||
# ox-hugo also uses YAML frontmatter now, so we check for our specific
|
||||
# title to distinguish generated vs user-exported index files.
|
||||
String.contains?(content, "title: Index")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user