template-engine

Generating HTML using a template from a .NET application

早过忘川 提交于 2019-11-30 03:52:53
问题 I have a .NET console application that needs to generate some HTML files. I could just construct the HTML in a StringBuilder and write the contents out to a file, but I was thinking it would be nicer to use some kind of template file with placeholders for where the data goes and then process my data through it at runtime. I'm guessing there are ways to use aspx, or T4, or some of the alternative view engines that you can use with ASP.NET MVC, but I don't know what would be easiest to

react-engine vs other template engines

假装没事ソ 提交于 2019-11-30 03:12:23
问题 I was wondering to use paypal's React Engine (https://github.com/paypal/react-engine), but I have some doubts: What are the benefits over other template engines like Handlebars? Why upload .jsx files, and not (jsx precompiled/transformed) .js files? (This one should be faster because don't have to do deal with the transformation at the server). I have been researching but I get confused. Thanks 回答1: The main difference between react-engine and template engines is only when the browser enables

What is the best code template facility for Emacs? [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 01:30:42
Particularly, what is the best snippets package out there? Features: easy to define new snippets (plain text, custom input with defaults) simple navigation between predefined positions in the snippet multiple insertion of the same custom input accepts currently selected text as a custom input cross-platform (Windows, Linux) dynamically evaluated expressions (embedded code) written in a concise programming language (Perl, Python, Ruby are preferred) nicely coexists with others packages in Emacs Example of code template, a simple for loop in C: for (int i = 0; i < %N%; ++i) { _ } It is a lot of

Which templating engine can I use with both JS and PHP? [closed]

旧街凉风 提交于 2019-11-29 20:57:19
I'm looking for a simple Template engine that works both on client side with JS ánd on server side with PHP. That means I want to be able to use the same template definition for both use cases. Do you know any templating engines that have official implementations in both JS and PHP? If you like JS->PHP priority :) then you have this two jquery-tmpl compatible template renderer for PHP backend https://github.com/abackstrom/jquery-tmpl-php https://github.com/xyu/jquery-tmpl-php If you prefer more PHP->JS priority :) then you can try this Javascript implementation of popular PHP templating Smarty

Render an ERB template with values from a hash

陌路散爱 提交于 2019-11-29 20:25:20
I must be overlooking something very simple here but I can't seem to figure out how to render a simple ERB template with values from a hash-map. I am relatively new to ruby, coming from python. I have an ERB template (not HTML), which I need rendered with context that's to be taken from a hash-map, which I receive from an external source. However, the documentation of ERB, states that the ERB.result method takes a binding . I learnt that they are something that hold the variable contexts in ruby (something like locals() and globals() in python, I presume?). But, I don't know how I can build a

Is it possible to have nested templates in Go using the standard library? (Google App Engine)

ε祈祈猫儿з 提交于 2019-11-29 18:42:26
How do I get nested templates like Jinja has in the python runtime. TBC what I mean is how do I have a bunch of templates inherit from a base templates, just filing in blocks of the base templates, like Jinja/django-templates does. Is it possible using just html/template in the standard library. If that is not a possibility, what are my alternatives. Mustache seems to be an option but would I then be missing out on those nice subtle features of html/template like the context sensitive escaping etc.? What other alternatives are ther? (Environment: Google App Engin, Go runtime v1, Dev - Mac OSx

How to load a template from full path in the template engine TWIG

女生的网名这么多〃 提交于 2019-11-29 18:33:34
问题 I'm wondering how to load a template from it's full path (like FILE constant give). Actually you have to set a "root" path for template like this : require_once '/path/to/lib/Twig/Autoloader.php'; Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem('/path/to/templates'); $twig = new Twig_Environment($loader, array( 'cache' => '/path/to/compilation_cache', )); And then : $template = $twig->loadTemplate('index.html'); echo $template->render(array('the' => 'variables', 'go' =>

Executing javascript inside Handlebars template

时光怂恿深爱的人放手 提交于 2019-11-29 18:10:25
问题 I'm totally new to js template engines. Handlebars seems to be the popular choice. I don't dislike the syntax for doing conditions, loops and so on, but since I'm perfectly capable of and feel more comfortable using plain old js and I'm not planning to let anyone who doesn't know js touch my templates, I'm asking if Handlebars supports this. Of course the most popular choice isn't always the best. I'm more of a Mootools guy and jQuery drives me crazy(great library, just not for me). So if

Mustache Templating: nested templates

时光毁灭记忆、已成空白 提交于 2019-11-29 11:38:41
问题 How can I use a nested template within mustache? Is there a way to do the same? var tmpl="{{#data}} {{values}} Name: {{name}} //{{another_templ({{name.value}})}} {{/values}} {{/data}}" Hope you guys got the question. I have not added the escape character for js validity since code is split across different lines. 回答1: You could use a lambda to nest the template: function nested_template(template_string, translate) { return function() { return function(text, render) { return Mustache.to_html

RazorGenerator, Templates, and @Html

陌路散爱 提交于 2019-11-29 10:38:09
I'm trying to use RazorGenerator as an email template engine. I want to take a model with the data, assemble the correct set of partial views, and return HTML that I can email out. Edit: In addition to this workflow, any solution would need to be editable as a .cshtml file and be able to be compiled into a dll . For various reasons, it is not practical to deploy the cshtml files themselves - if we can't embed all our razor views into a single file, then we can't use that suggestion. Hence RazorGenerator. So far, I've worked out every part of it, except for the partials. When I try to use @Html