[stringtemplate-interest] Is there way to call templatesfromanother group without inheritance?

Dreyer Ulf (CR/APA3) Ulf.Dreyer at de.bosch.com
Thu Sep 13 05:22:42 PDT 2007


Hi Florin,
 
 I just re-read your first post. I think I misunderstood you.
 For clarification: 
 
 -) you define .st-files in different Folders 
    like:
 
    root\
         |---sub1\
         |    + template1
         |    - template2
         |
         |
         ----sub2\
            -template3
   correct?
 
 -) you then create 1 Templategroup or 3 groups?
 
 I have the problem that template3 may have the same name as template2.
 So I can't have only one templategroup. But as far as I know you can't
call into another templategroup
  you don't inherit.

-Ulf
 
________________________________

Von: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] Im Auftrag von Florin
T.PATRASCU
Gesendet: Donnerstag, 13. September 2007 14:13
An: StringTemplate
Betreff: Re: [stringtemplate-interest] Is there way to call
templatesfromanother group without inheritance?


Hi Ulf - I don't think I can have this issue?! In my simple
implementation, the ST files are treated as web pages, so they have to
be unique per folder, and obviously they can be nested as any other
ordinary directory/file. Or maybe I misunderstand you question? 

V/r,

-florin


On 13-Sep-07, at 08:01 , Dreyer Ulf (CR/APA3) wrote:


	Hi Florin,
	 
	 
	thanks for your answer. My goal is not web development but I
will look into your solution.
	One question though: How do you handle name collisions within
templates?
	 
	- Ulf 
	 
________________________________

	Von: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] Im Auftrag von Florin
T.PATRASCU
	Gesendet: Mittwoch, 12. September 2007 14:57
	An: StringTemplate
	Betreff: Re: [stringtemplate-interest] Is there way to call
templates fromanother group without inheritance?
	
	
	Hi Ulf, 

	If your goal is to use ST for web development, I can recommend
you to have a look at our project JPublish (http://www.jpublish.org) and
the recently added String Template support.

	So, to your example, with JP you can define many Repositories
(folders on disk, tables in a db, etc) where you can store individual ST
files. JP then will create for you a ST Group for every defined
Repository, pointing to the repository path.

	After that, your colleagues can reuse each other's templates by
specifying the repository name and the name of the ST file they want to
use and combine them to obtain simple/complex web pages. Example:

	   $my_repository.( page.Path)$

	For the line above, JP will use the ST rendering engine to
render the ST files but it will also execute the JP Actions associated
with the ST files (Java classes, Beanshell, Jython, JRuby or Groovy) to
glue in the logic before rendering a template or after rendering it:) 

	The entire JP development philosophy relies on templates and
modularity. This is why we believe ST is very appropriate for JP.

	There is a ready to go JP simple project demonstrating the
StringTemplate integration. You can find it archived here:
http://jpublish.googlecode.com/files/stdemo.war.zip, in case you want to
give it a try.

	I hope it helps.

	V/r
	
	
	-florin


	On 11-Sep-07, at 08:22 , Dreyer Ulf (CR/APA3) wrote:


		Hi, 

		 I'm working on a system where the user (not necessarily
an accomplished developer) 
		 can write own templates / templategroups. 
		 I'd like them to be able to call other templates in
different groups without using 
		 inheritance. 

		 Example:  user A writes a template group that generates
Component A ( or Webpage A or whatever) 
		                 user B writes a template group that
generates  Component B ( or Webpage A or whatever) 

		 now User C would like to write a template with the
output   A; B. 
		 Preferably by writing something like
combinedTemplates :== << <A.main()>; <B.main()> >> 
		 (Assuming "main" is the generating template in groups A
and B) 

		 If I'm correct this is 

		 a) not possible if neither group A nor group B inherit
from one another. 

		 b) possible if B inherits from A but ONLY if C inherits
B and none of them uses 
		     the same names for templates. 

		 Is there an way to handle this nicely? 

		 My idea would be to mangle the names of the templates
with their 
		 group and create a temporary group containing all
templates. This solution will very likly turn out to be messy. 


		Ulf 

		_______________________________________________
		stringtemplate-interest mailing list
		stringtemplate-interest at antlr.org
	
http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest


	_______________________________________________
	stringtemplate-interest mailing list
	stringtemplate-interest at antlr.org
	
http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070913/7821add4/attachment-0001.html 


More information about the stringtemplate-interest mailing list