Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whiskers doesn't read frontmatter in files encoded as UTF-8 with BOM #178

Closed
autumn-mck opened this issue Apr 9, 2024 · 2 comments · Fixed by #179
Closed

Whiskers doesn't read frontmatter in files encoded as UTF-8 with BOM #178

autumn-mck opened this issue Apr 9, 2024 · 2 comments · Fixed by #179
Labels
whiskers Issues relating to whiskers

Comments

@autumn-mck
Copy link
Member

Only noticed this because one of the files I was working with was already encoded as UTF-8 with BOM for some reason, and was giving errors about variables that I defined in the frontmatter not being found.

eg

---
whiskers:
  version: 2.0.2
accent: "mauve"
---

accent: {{ accent }}

encoded as UTF-8 with BOM gives the output

Warning: No Whiskers version requirement specified in template.
This template may not be compatible with this version of Whiskers.

To fix this, add the minimum supported Whiskers version to the template frontmatter as follows:

---
whiskers:
    version: "2.0.2"
---

Error: Single-output render failed

Caused by:
    0: Template render failed
    1: Failed to render 'test.tera'
    2: Variable `accent` not found in context while rendering 'test.tera'

This really isn't a big deal, I've already easily re-encoded the files as just UTF-8, but it'd be nice if whiskers either gave a more useful error message, or read the frontmatter, in this case

@backwardspy
Copy link
Member

interesting issue, thanks for raising this. perhaps we can attempt to detect encoding and, if it succeeds, use that to load & write (where applicable) the files.

@nekowinston nekowinston added catwalk Issues relating to catwalk whiskers Issues relating to whiskers and removed catwalk Issues relating to catwalk labels Apr 25, 2024
@backwardspy
Copy link
Member

this is fixed from a file reading perspective. writing other encodings is covered under catppuccin/whiskers#7. thanks again for raising this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whiskers Issues relating to whiskers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants