org.apache.velocity.convert

Class WebMacro

public class WebMacro extends Object

This class will convert a WebMacro template to a Velocity template. Uses the ORO Regexp package to do the rewrites. Note, it isn't 100% perfect, but will definitely get you about 99.99% of the way to a converted system. Please see the website documentation for more information on how to use this class.

Version: $Id: WebMacro.java,v 1.20.8.1 2004/03/03 23:22:54 geirm Exp $

Author: Jason van Zyl Daniel Rall

Field Summary
protected static String[]perLineREs
The regexes to use for line by line substition.
protected static StringVM_EXT
protected static StringWM_EXT
Method Summary
voidconvert(String target)
Iterate through the set of find/replace regexes that will convert a given WM template to a VM template
StringconvertName(String name)
Simple extension conversion of .wm to .vm
StringconvertTemplate(String template)
Apply find/replace regexes to our WM template
StringextractPath(String file)
Gets the path segment of the full path to a file (i.e. one which originally included the file name).
static voidmain(String[] args)
Main hook for the conversion process.
StringmakeSubstRE(int i)
Makes a Perl 5 regular expression for use by ORO.
static voidusage()
How to use this little puppy :-)
booleanwriteTemplate(String file, String basedir, String newBasedir)
Write out the converted template to the given named file and base directory.

Field Detail

perLineREs

protected static String[] perLineREs
The regexes to use for line by line substition. The regexes come in pairs. The first is the string to match, the second is the substitution to make.

VM_EXT

protected static final String VM_EXT

WM_EXT

protected static final String WM_EXT

Method Detail

convert

public void convert(String target)
Iterate through the set of find/replace regexes that will convert a given WM template to a VM template

convertName

private String convertName(String name)
Simple extension conversion of .wm to .vm

convertTemplate

public String convertTemplate(String template)
Apply find/replace regexes to our WM template

extractPath

private final String extractPath(String file)
Gets the path segment of the full path to a file (i.e. one which originally included the file name).

main

public static void main(String[] args)
Main hook for the conversion process.

makeSubstRE

private final String makeSubstRE(int i)
Makes a Perl 5 regular expression for use by ORO.

usage

private static final void usage()
How to use this little puppy :-)

writeTemplate

private boolean writeTemplate(String file, String basedir, String newBasedir)
Write out the converted template to the given named file and base directory.
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.