Comments (3)
I have a PR to fix template.IsTrue
, but unfortunately I think fixing template execution is harder. The text/template
execution engine is used, and it seems to have its version of IsTrue
hardcoded.
Probably best not to "fix" template.IsTrue
if execution doesn't match it.
from safehtml.
Maybe the best thing to do is to document clearly that if .X
was previously a string or template.HTML
and is now a safehtml.HTML
or other safehtml
type, one must replace
{{if .X}}
with
{{if .X.String}}
from safehtml.
Thanks for flagging this, we'll take a look at possible solutions, although at the moment updating the documentation seems the most probable outcome. safehtml/template
tries to be as close to a drop-in replacement as possible, but the migration will never be 100% transparent, and this could be another of those divergences.
Probably best not to "fix" template.IsTrue if execution doesn't match it.
+1 for having a uniform behavior.
from safehtml.
Related Issues (8)
- tag with a version HOT 1
- Migrate packages that should not be imported to an internal directory HOT 1
- safe identifier characters should include all Unicode alphanumerics
- safe identifier characters should include '.'
- add support for html meta tag
- Add support for parsing templates text from the file system fs instead of the host operating system's file system HOT 12
- Can safehtml support custom attributes like one that HTMX requires?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safehtml.