Giter VIP home page Giter VIP logo

chevron's Issues

RegisterTemplate fails if name contains integers

Got the exception when I generated some "names" using Guid.NewGuid().ToString("n"). So essentially;

var handlebars = new Chevron.Handlebars();
handlebars.RegisterTemplate(Guid.NewGuid().ToString("n"), content);

Tried passing "1", fails as well.

MsieJavaScriptEngine.JsRuntimeException : Compile error: Expected identifier

Non-Windows platforms

From the readme:

V8 will, in theory, run on a non windows platform (I have not done any testing of this).

Unfortunately this isn't the case with ClearScript. ClearScript only works on Windows as it uses C++/CLI which is not cross-platform. There are ways to use V8 from Linux or Mac OS, but you need to use a different JavaScript engine. In ReactJS.NET I'm using a fork of VroomJs with JavaScriptEngineSwitcher. VroomJs does run from Mono as it's got a vanilla C interface.

Run additional scripts after loading handlebars

A lot of handlebars helpers are distributed as collection of helpers in one .js file.
Now in Chevron it is necessary to register each helper separtly.
It would be handier if somewhere a set of files to run after running handlebars.js could be specified to register those helpers.

Nancy.ViewEngines.Handlebars.V8.Sample not working

Hi Simon,

Just had a go at trying to get that sample working.

First problem I think is Views/Index.handlebars and Views/_MyPartial.handlebars are not set with Build Action 'Content' and Copy if newer.

Second problem is when I go to http://localhost:8888 nothing is rendered.. so not sure what is going wrong

Keen to get this working :)

[Q] What is Approvals?

Hi,

I tired Chevron.IE, Chevron.IE.Merged and Chevron.Jint but no success.
Also Added MsieJavaScriptEngine.

Which assembly is for Approvals?

Thanks.

Handlebars cannot use json.net objects as template data

Is there anyway to make this work?

            [Test]
            public void CanUseJArrayValues()
            {
                var jObject = new JObject {{"County", new JArray {"Kane", "Salt Lake"}}};

                string actual;

                using (var handleBars = new Handlebars())
                {
                    handleBars.RegisterTemplate("county", "{{County.length}}");
                    actual = handleBars.Transform("county", jObject);
                }

                Assert.That(actual, Is.EqualTo("2\r\n"));
            }

Chevron.IE.Merged appends "\r\n"

Ran a simple template, and the engine adds \r\n at the end.

var template = "<h1>Test {{Tag1}}!</h1><p>Test {{Tag1}}.</p><p>Test {{Tag2}}?</p>";
var model = new {Tag1 = "First", Tag2 = "Second"};

using (var handleBars = new Chevron.Handlebars())
{
    handleBars.RegisterTemplate("test", template);

    return handleBars.Transform("test", model);
}

Support running "other" js, or exposing engine

Hi,
Was wondering whether you might consider exposing the engine on Handlebars.cs so we could load in other general javascript.

e.g. I want to support date formatting, and would ideally register a helper that depends on moment.js.

Thanks,
Chris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.