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

Add option to treat missing variables as errors #53

Open
wants to merge 123 commits into
base: master
Choose a base branch
from

Conversation

cbroglie
Copy link

This is a breaking change as it changes the API to follow the idiomatic Go convention of returning errors.

I don't expect it to be merged since the project does not appear to be maintained, just sharing in case anyone else is looking for this functionality.

Chris Broglie and others added 30 commits July 21, 2015 20:12
Previous behavior was to just return a string which was either the
rendered template or the value of err.Error(). Callers can now
explicitly handler errors.

This is a breaking change to the API.
It's an error if you try to render a missing variable, but it's
acceptable to check for its existence
Add support for examining the parsed tags
Roughly 40% of the tests are failing at this point, and have been
disabled :(
Fetching golint is failing due to the Travis CI containers being rate
limited by go.googlesource.com
fix(isEmpty): Ignore empty strings on list iteration.
This adds an extra function `FRender` that accepts an io.Writer as its
first argument in order to support direct writing to some sink. The name
has been chosen for consistency with the fmt package.
This adds support for rendering layouts directly to an `io.Writer`.
Support rendering directly to an io.Writer
roblillack and others added 30 commits June 7, 2021 23:56
…-for-sections

Fix building context stack for inner elements of sections
This also changes the spec_test behavior to make tests opt-out rather
than opt-in as nearly all are passing.
Update mustache/spec submodule to latest
…sections

Fix rendering non-false value sections
Exposes a missing variable control to the command-line to allow render
to fail on missing variables `--allow-missing-variables=false`.
…ssing-vars

mustache: expose missing variable control
Migrate to github actions and un-vendor golangci-lint.
Update Golang and packages to latest versions
Experimental support for lambda sections
The manual page at mustache/mustache moved to GitHub pages
As a library user, we needed a way to translate error messages coming from the library.
This pull request introduces a way to let library users customize error messages if they want. It is as well fully retro-compatible as it doesn't change the current error messages.

What the pull request changes:

* Make the error type public
* Add an error code to let library users identify the error reason
* Add a `Reason` attribute for errors cases that need the name of the entity generating the error
* Make the `Line`, `Code` and `Reason` attribute public to let library users customize (translate) error message
* Keep the current error messages
Otherwise errors are not shown on term when redirecting stdout to a file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.