Hi Diago,

Thanks for offering to contribute. No flames on your English -- if we have trouble understanding we'll just ask questions! The best place to contribute this might be on our Wiki. There's a section for contributed code. But we'd be glad to discuss on the list.

I'm not quite sure I understand how this will be used. Can you give a specific example? Is "foo.xml" a source file or an output file?

Also, have you looked at Anakia? I'm wondering if that serves some of the same purpose. It parses an XML file and lets you generate a Velocity document based on that.

Best, WILL

----- Original Message ----- From: "Daigo Kobayashi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, November 05, 2005 1:14 AM
Subject: merge directive


I create merge directive. It's mainly use code generation.
I want to contribute this directive. So please teach me how
contribute this code.

I explain how merge directive work as follows,
#merge("foo.xml" "bar")
   //default template
#end

foo.xml structure is like this
<?xml version="1.0" encoding="UTF-8"?>
<velocity-merge>
<content name="bar"><![CDATA[some contents]]></content>
<content name="bar2"><![CDATA[ some contents]]></content>
</velocity-merge>

First merge directive parse foo.xml file and search name="bar"
element. If it found, merge directive write content of that element
and jump to end. (i.e. This case merge directive write "some contents")
If it not found, merge directive write default template.

I assume this directive use code generation. Velocity doesn't consider
overwrite problem. If we generate code over and over, then velocity
overwrite it every time. So I consider merge directive. We add special
comment to template.

created code:
public void foo () {
//velocity-merge %foo% start
   //Developer
   //write
   //implementation.
//velocity-merge %foo% end
}

template:
public void foo() {
//velocity-merge %foo% start
#merge("foo.xml" "foo")
   //TODO You should implement this method.
#end
//velocity-merge %foo% end
}

Before we generate code, we parse source code and create foo.xml file.
(I also create this tool, and also contribute this tool.) Then velocity
create code and merge developer's implementation.

Please, no flames about my bad English.

Sincerely,
Daigo Kobayashi


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to