Affects Version/s: None
Fix Version/s: None
Need to have standard class to do macro preprocessing of various files, source code..etc.
Hi! I raised this issue before but I think I did not express myself correctly. I was misunderstood. So I am attempting a second time. I am rephrasing my thoughts here.
As you know, there are many files that use Velocity type, macro preprocessing. To name a few: HTML, XML, programming language source-code...etc. With the use of XML as configuration file, I find that having a standard macro preprocessor like Velocity would be most useful.
When a user does preprocessing, he/she often has a library of macros (Velocity *.vm files). These macros can be located in different file directories. This is a very useful and powerful feature for the user. It avoids time-wasting, repetitive typing.
My suggestion is that Velocity provides a single and standard class for doing macro preprocessing. The class will be callable from the command-line. It should be easy to implement. The class will take a list of directory locations where it can find macros that are being called. Furthermore, it will have two parameters for source and destination directory locations. The source directory is the location of source files. The destination directory will be the destination of the result file. The source and destination directories can be the same.
I suggest using the following convention: The standard class will transform any file that end with given suffix(es). For instance; every file that ends with suffix *.velocity or *.vm will be processed and transformed to a file with its suffix only.
MyFile.html.velocity >>> MyFile.html
MyFile.xml.vm >>> MyFile.xml
MyFile.python.velocity >>> MyFile.python
The important thing here is that the suffixes that are searched for should also be a parameter as to allow full freedom for the user. In other words, the user can specify suffixes *.macro or *.textmacro instead of *.velocity or/and *.vm.
This simple standard class will go a long way to make Velocity more standard and generally usable. Velocity will not only be a powerful Java library, it will also be a powerful text processor. Many programmers and users will be encouraged to use it because it is standard and for general purpose. This standard class should be readily available in the Velocity jar file without any Java programming.
As an extension to this standard Velocity class, you can have an ANT task that will do the exact same thing for those who like to use ANT.