lck / sharptal Goto Github PK
View Code? Open in Web Editor NEWXml-based template engine for .NET platform
Home Page: https://github.com/lck/SharpTAL
License: Apache License 2.0
Xml-based template engine for .NET platform
Home Page: https://github.com/lck/SharpTAL
License: Apache License 2.0
Hi,
I want to bind a object inherit from DynamicObject and IDictionary<string, object>. I want to use article.Title to bind the field, but it always throw a exception "CS1061: 'object' does not contain a definition for 'Title' and no extension method 'Title' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) (line 468)".
I change to use the dictionary syntax "article["Title"]", but it throws "
CS0021: Cannot apply indexing with [] to an expression of type 'object' (line 468)
"
How can I to fix it?
If set, data attributes can be used instead of namespace attributes, e.g. "data-tal-content" instead of "tal:content"
Sample:
<html>
<body>
<div foo="bar" data-tal-content="'Hello world!'" />
</body>
</html>
and introduce the new @model template global variable that will reference the instance of anonymous type passed to the Render() method via the new "model" parameter
Add i18n support via namespace http://xml.zope.org/namespaces/i18n
example: ${5 < 4}
Hi
First of all, let me say that I am excited to have found this project. ZPT is one of the best inventions ever done in Zope and I am happy to see it live on in .NET.
Unfortunately I am getting a CompileSourceException with this rather simple code, I guess I am missing something?
This code fails on the last line:
public static void ForgotPassword(string toEmail, List users) { // ... Template template = new Template(tpl); string body = template.Render(new Dictionary { { "users", users.ToArray() } });
ZPT template:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns:tal="http://xml.zope.org/namespaces/tal"> <body> <ul> <li tal:repeat="user users"><span tal:replace="user.UserName"></span></li> <!-- ... -->
I also tried sending the generic List directly instead of calling ToArray on it. In the first case, the error message says "object doesn't have a property called "UserName", in the second case, "type ForgotPasswordUser does not exist".
Thanks, Claus
Is there any switch for SharpTal that allows me to see in which line is it failing to compile the template?
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.