/** Modify template properties to handle older template versions. */
public void modifyForOldVersion() {
PropertySet mps = getMergedPropertySet();
PropertySet tmps = iOrderedPSM.get( Service.CONF_template );
String version = mps.get( Property.main_JostracaVersion );
if( ! version.startsWith( Service.VERSION_NUMBER ) ) {
if( "0.1".equals( version ) ) {
// set markers
tmps.set( Property.parse_SectionMarker, "@" );
tmps.set( Property.parse_DirectiveMarker, "!" );
tmps.set( Property.parse_DeclarationMarker, "" ); // no declarations in v0.1
// section marker is a prefix in v0.1
tmps.set( Property.jostraca_regexp_MatchSectionName
,"$<jostraca.regexp.AnyWhiteSpaceAtStart>"
+"$<parse.SectionMarker>$<jostraca.regexp.SubmatchSectionName>"
+"$<jostraca.regexp.SubmatchAnyWhiteSpaceAnyCharsAtEnd>" );
}
// old perl and python writer formats
if( "0.1".equals( version ) || "0.2".equals( version ) || "0.3".equals( version ) ) {
String csn = iTemplateScript.getCanonicalScriptName( mps );
if( "perl".equals( csn ) && -1 != mps.get( Property.main_CodeWriterFormat ).indexOf("BasicPerlWriterFormat") ) {
tmps.set( Property.main_CodeWriterFormat, "NonObjectPerlWriterFormat" );
tmps.set( Property.lang_InsertPrefix, "_insert( " );
}
else if( "python".equals( csn ) && -1 != mps.get( Property.main_CodeWriterFormat ).indexOf("BasicPythonWriterFormat") ) {
tmps.set( Property.main_CodeWriterFormat, "NonObjectPythonWriterFormat" );
tmps.set( Property.lang_InsertPrefix, "_py_insert( " );
}
}
}
}