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]

Reply via email to