template-engine

In CoffeeScript, is there an 'official' way to interpolate a string at run-time instead of when compiled?

霸气de小男生 提交于 2019-12-10 01:50:22
问题 I have an options object in my CS class, and I'd like to keep some templates in it: class MyClass options: templates: list: "<ul class='#{ foo }'></ul>" listItem: "<li>#{ foo + bar }</li>" # etc... Then I'd like to interpolate these strings later in the code... But of course these are compiled to "<ul class='" + foo +"'></ul>" , and foo is undefined. Is there an official CoffeeScript way to do this at run-time using .replace() ? Edit: I ended up writing a little utility to help: # interpolate

laravel blade, how to append to a section

妖精的绣舞 提交于 2019-12-09 00:25:38
问题 If you look to laravel official documentation http://laravel.com/docs/4.2/templates It says that giving this layout: <!-- Stored in app/views/layouts/master.blade.php --> <html> <body> @section('sidebar') This is the master sidebar. @show <div class="container"> @yield('content') </div> </body> </html> Extended by this view @extends('layouts.master') @section('sidebar') <p>This is appended to the master sidebar.</p> @stop @section('content') <p>This is my body content.</p> @stop Will append

dustjs-linkedin with express 3

人盡茶涼 提交于 2019-12-08 13:37:06
问题 I am trying to get dustjs-linkedin working with an express 3 project, however I can't seem to get past this error: Error: Template name parameter cannot be undefined when calling dust.compile at Object.compiler.compile (/home/user/project/node_modules/dustjs-linkedin/lib/compiler.js:21:16) at Object.dust.compileFn (/home/user/project/node_modules/dustjs-linkedin/lib/dust.js:109:37) at Function.exports.dust.render (/home/user/project/node_modules/consolidate/lib/consolidate.js:226:56) at /home

Thymeleaf not displaying values from spring controller

心不动则不痛 提交于 2019-12-08 10:45:13
问题 I am practising thymeleaf template engine for the first time. I have followed the tutorial and so on but I have no idea where I am going wrong. My controller: public String mainPage(Model model){ model.addAttribute("data", "Hello Thymeleaf"); return "main"; } and my html is as follows: <!DOCTYPE html > <html xmlns:th="http://www.thymeleaf.org"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h1>th:text="${data}"</h1> </body> </html>

Is it possible to chain jQuery Regexp matches?

冷暖自知 提交于 2019-12-08 07:46:55
问题 So I'm just curious if there was a way to chain regexp. Just looking to optimize my code a little. I want to find an expression, then find another one from the results. The Working Code: match = $('body').html().match(/(\[~\{ .*? \}~\])/g); console.log(match[0]); findText = match[0].match(/\w+/); console.log(findText); What I've tried: match = $('body').html().match(/(\[~\{ .*? \}~\])(\w+)/g); console.log(match[0]); produced an error match = $('body').html().match(/(\[~\{ .*? \}~\])|(\w+)/g);

Using GroovyPagesTemplateEngine without a request?

烂漫一生 提交于 2019-12-08 04:57:29
问题 I'm trying to evaluate a GSP file without a real http request. I'm trying this: String compileGsp(File input) { def text = '' try{ text = groovyPagesTemplateEngine.createTemplate(input).make().toString() } catch( Exception e ){ StackTraceUtils.sanitize(e).printStackTrace() } return text } but this throws an exception and yields this: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request

Spring template engine for rendering JSON

*爱你&永不变心* 提交于 2019-12-07 14:33:52
问题 I come from Ruby and have just started testing Spring and find it fairly nice. However i'm used to being able to customize the rendered JSON output with libraries like rabl and it feels really wrong to expose internal models straight out into the JSON as i do now with the annotation @ResponseBody and just returning the model. Does anyone have any tips on libraries similar to rabl but for java/spring or is there an existing way to do it easily with spring without manually writing templates in

Scala-IDE/IntelliJ :: Template support for Scalate, Play, etc

倾然丶 夕夏残阳落幕 提交于 2019-12-07 06:24:25
问题 EDIT2 Scala IDE now has template support with type inference, semantic highlighting, etc. for the Play framework as of v3.0 of the IDE. Same deal with routes file(s), woohoo ;-) Not sure about Play, Scalate, or other template engine support in IntelliJ. EDIT Play 2.0 is unbelievably awesome, so much so that the lack of IDE support is fairly minor -- all the heavy lifting is done via model, controller and javascript (coffeescript + datatables) layers; view layer consists of simple xhtml

Looking for a template engine which can be used in Java and JavaScript [closed]

。_饼干妹妹 提交于 2019-12-07 06:22:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . As the title says, I'm currently looking for a template engine that works with Java and Javascript. The idea is that my ajax json objects can use the same template files to render stuff client-side like Java is doing it server-side. I know there is google-closure-template but it is working with guice 2.0 and my

How to set the selected item in a radio button group in handlebars template?

你离开我真会死。 提交于 2019-12-07 06:13:01
问题 In a handlebars template, how do you set a radio button group to the right value using only the template? Can this be done directly in the template? For an example, let's say there's a radio button group like this: <label><input type="radio" name="mode" value="auto">Auto</label><br> <label><input type="radio" name="mode" value="on">On</label><br> <label><input type="radio" name="mode" value="off">Off</label><br> The data coming into the template has a value for mode: {mode: "on"} I want to