Comments (5)
Can you give me the exact sample you are trying?
from fluid.
All the Register
methods are on this class: https://github.com/sebastienros/fluid/blob/d7a92d4c9fbefb7fd6e26708069d4149bb999e06/Fluid/IMemberAccessStrategy.cs mostly as extension methods. So have the using Fluid;
statement in your code should be sufficient to make it work.
from fluid.
from fluid.
Next code works as expected:
var model = new { Firstname = "Bill", Lastname = "Gates" };
var source = "Hello {{ p.Firstname }} {{ p.Lastname }}";
if (FluidTemplate.TryParse(source, out var template))
{
var context = new TemplateContext();
context.MemberAccessStrategy.Register(model.GetType());
context.SetValue("p", model);
var result = template.Render(context);
}
from fluid.
Ok, the Render
is definitely missing the context parameter probably, template.Render()
should be template.Render(context)
And for the Register
, it's missing the MemberAccessStrategy
, fixing it right now.
from fluid.
Related Issues (20)
- Access root object from template HOT 3
- Include statement circular dependency HOT 8
- Current local date and time not converting to specified timezone HOT 2
- Question: Introspection of parsed template HOT 6
- Question: is this library suited for implement something like Microsoft Guidance?
- {% render "filename" %} with custom extensions HOT 2
- Access properties of dictionary value HOT 1
- Fluid.Tags compatibility method after upgrading to a new version HOT 1
- Question: Update underlying Liquid version HOT 2
- Layout support doesn't seem to work in 2.4.0 HOT 10
- Hope size supports null HOT 1
- Missing fluid compatibilty table and roadmap HOT 1
- Synchronous operations are disallowed
- Fluid prints nothing inside for ..in loop HOT 2
- Make TemplateContext.LocalScope public
- Template not rendering
- Recusive variable resolving
- Include/Render Statement Cache Not Refreshed When File Content Changed HOT 3
- Any configuration option to have the parser leave uncaptured variables unchanged? HOT 4
- Using non-string type to create DictionaryDictionaryFluidIndexable fails
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 fluid.