sunng87 / hbs Goto Github PK
View Code? Open in Web Editor NEWclojure templating by handlebars.java
clojure templating by handlebars.java
Hi.
in the readme, the link to the api-documentation links to an empty site. http://sunng.info/hbs/
The default behaviour of ConcurrentMapTemplateCache that this project uses by default is not to reload automatically. It would be a good idea to either enable reloading by default (as caching map is used) or allow the user to customize reloading on or off via function.
After browsing code of both this library and handlebars.java this is the code I used to enable the reloading on my program. It would be a good idea to introduce a function similar to set-template-path! to allow setting reloading on or off.
(.setReload (.getCache handlebars/*hbs*) true))
On the readme.md there is mention of set-template-path! function
This function no longer exists:
Caused by: java.lang.RuntimeException: No such var: hbs/set-template-path!
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler.resolveIn(Compiler.java:7138)
at clojure.lang.Compiler.resolve(Compiler.java:7108)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:7069)
at clojure.lang.Compiler.analyze(Compiler.java:6648)
edit: it seems that most documentation is incorrect. defhelper does not work as documented, neither does reloading.
Please fix the documentation or at least clearly state that it's obsolete.
I get this error from two separate servers so it doesn't seem to be networking issue.
$ lein ring server-headless
Retrieving hbs/hbs/0.9.1/hbs-0.9.1.pom from clojars
Could not transfer artifact hbs:hbs:pom:0.9.1 from/to clojars (https://clojars.org/repo/): Checksum validation failed, no checksums available from the repository
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
It seems that checksum is missing. Older version can be installed just fine.
I'm not sure if this is an hbs issue or a handlebars.java issue, but I would expect both of the templates in this gist to render to the exact same output, but they do not with the current version of hbs.
I tried the same construction with handlebars.js, and it worked there (as well as every other Mustache implementation I've used). Screenshot of the handlebars.js behavior is attached.
I'm trying to use ifcontains and have no clue how it works. There is no documentation of any kind for helpers that have multiple parameters and I think there should be.
This is what I have tried based on guesses on how it could work (roles is a set)
{{#ifcontains roles :user}}user{{/ifcontains}}
{{#ifcontains roles item :user}}user{{/ifcontains}}
{{#ifcontains :user roles}}user{{/ifcontains}}
All throw an error (a variation of below)
found: ':user', expected: '}}' <p>User? {{#ifcontains :user roles}}user{{/ifcontains}}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.