template-engine

using Liquid variables inside of a liquid tag call

一个人想着一个人 提交于 2019-11-27 15:00:46
I made a custom link tag in Liquid and I am trying to be able to pass liquid variables into the call for that tag like so {{ assign id = 'something' }} // this value is actual dynamic while looping through data {% link_to article: id, text: 'Click Me!' %} // my custom tag However this results in the article parameter being passed in as 'id' instead of 'something' as per the assign statement above it. Does anyone know how to pass variables into tag calls? I've recently solved this very simply with Jekyll 0.11.2 and Liquid 2.3.0 by passing the name of the variable as the tag parameter. {% assign

What templating engines are available for ASP.NET MVC Framework?

旧巷老猫 提交于 2019-11-27 14:33:07
I was reading some posts on Coding Horror blog about working with the horrors of tag soup . It seems like the only way to simplify html generation is to use a templating engine. Do you know any templating engine for ASP.NET MVC framework? there are many view engines for asp.net mvc framework: The Razor view engine is built in to ASP.NET MVC Web forms view engine(default) Spark view engine Nhamle view engine … all community contributions on the asp.net mvc framework including view engines can be found on http://www.codeplex.com/MVCContrib StringTemplate is a decent alternative. Here's the

is it possible to issue dynamic include in asp-classic?

痴心易碎 提交于 2019-11-27 14:09:52
问题 I mean, like php'h include... something like my_file_to_be_included = "include_me.asp" -- > for what I've seen so far, there are a couple of alternatives, but every one of them has some sort of shortcoming... what I'm trying to figure out is how to make a flexible template system... without having to statically include the whole thing in a single file with a loooooong case statement... here there are a couple of links a solution using FileSysmemObject, just lets you include static pages idem

Get loop index of outer loop

Deadly 提交于 2019-11-27 13:23:42
问题 In jinja, the variable loop.index holds the iteration number of the current running loop. When I have nested loops, how can I get in the inner loop the current iteration of an outer loop? 回答1: Store it in a variable, for example: {% for i in a %} {% set outer_loop = loop %} {% for j in a %} {{ outer_loop.index }} {% endfor %} {% endfor %} 回答2: You can use loop.parent inside a nested loop to get the context of the outer loop {% for i in a %} {% for j in i %} {{loop.parent.index}} {% endfor %}

Using Jade Templates (jade-lang.com) client-side

荒凉一梦 提交于 2019-11-27 10:21:20
问题 I'd like to use Jade templates client-side. Preferably generated using the Rails 3.1 asset pipeline. I can't really figure out how to do this. Anyone who've stumbled upon the same problem and found a great solution? Any thoughts are much appreciated. http://jade-lang.com/ http://ryanbigg.com/guides/asset_pipeline.html 回答1: P.S: Probably right now Substack's answer is better. browserify Maybe you can use https://github.com/substack/node-browserify Browser-side require() for your node modules

Why choose an XSL-transformation?

删除回忆录丶 提交于 2019-11-27 09:53:33
问题 For a current project the decision has to be made whether to use XML and an XSL-transformation to produce HTML or to directly use HTML-templates. I'd be interested in arguments for or against the XSL-approach. I understand that in cases where you have to support many different layouts, an XSL-solution has a lot of advantages, but why would you choose it in those cases where you only have to support one target layout? Edit: We're talking about Java here. 回答1: XSLT is a functional programming

Handlebars Template rendering template as text

佐手、 提交于 2019-11-27 07:44:35
I created a helper in Handlebars to help with logic, but my template parses the returned html as text rather than html. I have a quiz results page that is rendered after the quiz is completed: <script id="quiz-result" type="text/x-handlebars-template"> {{#each rounds}} {{round_end_result}} {{/each}} <div class="clear"></div> </script> For each of the rounds, I use a helper to determine which template to render a round's result: Handlebars.registerHelper("round_end_result", function() { if (this.correct) { var source = ''; if (this.guess == this.correct) { console.log("correct guess"); var

Send asp.net mvc action result inside email

不想你离开。 提交于 2019-11-27 06:50:05
I'd like to use my Action in asp.net mvc, as template engine, that results in form of string, that I could send in email. Pseudo-Code: public ActionResult Register() { SendEmail(View().ToString()); return new EmptyResult(); } First, you'll still probably want to return a view from your action, so returning an EmptyResult isn't the best; but you'll figure that out when you're dealing with the page flow in your registration process. I'm assuming that you wish to create an HTML email using a View you have already created. That means you wish to take the result of something that looks like the

How to retrieve all Variables from a Twig Template?

做~自己de王妃 提交于 2019-11-27 05:24:32
问题 Is it possible to retrieve all variables inside a Twig template with PHP? Example someTemplate.twig.php: Hello {{ name }}, your new email is {{ email }} Now I want to do something like this: $template = $twig->loadTemplate('someTemplate'); $variables = $template->getVariables(); $variables should now contain "name" and "email". The reason I want to do this is that I am working on a CMS system where my twig templates and variables are dynamically set by my users and they also fill the

Truncate string in Laravel blade templates

谁说我不能喝 提交于 2019-11-27 05:13:20
问题 Is there a truncate modifier for the blade templates in Laravel, pretty much like Smarty? I know I could just write out the actual php in the template but i'm looking for something a little nicer to write (let's not get into the whole PHP is a templating engine debate). So for example i'm looking for something like: {{ $myVariable|truncate:"10":"..." }} I know I could use something like Twig via composer but I'm hoping for built in functionality in Laravel itself. If not is it possible to