English 中文(简体)
Template engines [closed]
原标题:
最佳回答
问题回答

In Visual Studio there is a templating engine primarily for code generation, called T4.

Here is an entry point for documentation on MSDN.

So, to answer your question, yes they to exist for other purposes than the web.

Yes there are many out there. One that I know of that allows you to generate more templates if you need them is MyGeneration. Another, is you could always build your own xslt template engine then you could build whatever you need. However there are several opensource and commercial code generators.

E.g. StringTemplates is a Java-based template engine for generating all sorts of text artifacts, and model generator frameworks like openArchitectureWare (or GeneSEZ) use the Expand template engine.

Imatix GSL is the most impressive (and simplest) of the tools that I have encountered. Plus it has been used to generate large amounts of complex code.

Also, lua is a programming language whose initial purpose was data definition, and I have found it to be very capable in this area. So, you define your data in lua and you execute the data definition files (valid lua programs) and you can generate any code from it.

Consider the following model for a C-function in Lua.

> func {    
>     name { "xyz" }
>     parameters { 
>         { name= "x" , type="uint32_t" }  , 
>         { name = "y" , type = "uint32_t"} 
>     }
>
>     ret { type="uint32_t" }
>   
>     psuedocode {      
>        "getLock(lockName)"   ,
>        "getSessionMemory"    ,
>        "addSession"      ,        
>        "releaseLock"              
>     } 
> }

They can generate configuration files.

Puppet and Chef rely on erb templates a lot, for example.





相关问题
Template engines [closed]

Are there any for purposes other than web? e.g. for use in script generators, c++ code generators or other related, generic operations.

Is it there a Ruby equivalent of Java s Wicket?

The idea would be to replace ERB with templates that are pure XHTML and that the view would be pure code manipulating the template content. Have this been done already ?

non-servlet JSP

I realise there are EL and near EL frameworks like StringTemplate, JUEL, Velocity, etc. However, I am not asking for list of alternatives to JSTL/EL. I came across a package more than a year ago, ...

More descriptive Language String placeholder?

<?LANG(no_download, you are not allowed to download ) instead of $lang[no_download] I have what I think is a better approach for embedding language strings in templates. In almost all the PHP ...

Python for web scripting

I m just starting out with Python and have practiced so far in the IDLE interface. Now I d like to configure Python with MAMP so I can start creating really basic webapps — using Python inside HTML, ...

How to use the John Resig JavaScript Micro-Templating engine?

I have searched for a bit on a basic example on using the John Resig JavaScript Micro-Templating engine on Google but came out dry. I decided to bring it to base guys. Can anyone help with a simple ...

热门标签