@Override public TemplateModel get(String key) throws TemplateModelException { if ("configuration".equals(key)) { try { return (TemplateModel) getCachedWrapperFor(((Template) configurable).getConfiguration()); } catch (RemoteException e) { throw new TemplateModelException(e); } } if ("name".equals(key)) { return name; } return super.get(key); } }
private OutputFormat getFormatFromStdFileExt() { String sourceName = template.getSourceName(); if (sourceName == null) { return null; // Not possible anyway... } int ln = sourceName.length(); if (ln < 5) return null; char c = sourceName.charAt(ln - 5); if (c != '.') return null; c = sourceName.charAt(ln - 4); if (c != 'f' && c != 'F') return null; c = sourceName.charAt(ln - 3); if (c != 't' && c != 'T') return null; c = sourceName.charAt(ln - 2); if (c != 'l' && c != 'L') return null; c = sourceName.charAt(ln - 1); try { // Note: We get the output formats by name, so that custom overrides take effect. if (c == 'h' || c == 'H') { return template.getConfiguration().getOutputFormat(HTMLOutputFormat.INSTANCE.getName()); } if (c == 'x' || c == 'X') { return template.getConfiguration().getOutputFormat(XMLOutputFormat.INSTANCE.getName()); } } catch (UnregisteredOutputFormatException e) { throw new BugException("Unregistered std format", e); } return null; }
/** * A prime constructor to which all other constructors should * delegate directly or indirectly. */ private Template(String name, String sourceName, Configuration cfg, ParserConfiguration customParserConfiguration) { super(toNonNull(cfg)); this.name = name; this.sourceName = sourceName; this.templateLanguageVersion = normalizeTemplateLanguageVersion(toNonNull(cfg).getIncompatibleImprovements()); this.parserConfiguration = customParserConfiguration != null ? customParserConfiguration : getConfiguration(); }
public Environment(Template template, final TemplateHashModel rootDataModel, Writer out) { super(template); configuration = template.getConfiguration(); incompatibleImprovementsGE2328 = configuration.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_28; this.globalNamespace = new Namespace(null); this.currentNamespace = mainNamespace = new Namespace(template); this.out = out; this.rootDataModel = rootDataModel; importMacros(template); }
final public PropertySetting Setting() throws ParseException {Token start, end, key; Expression value; start = jj_consume_token(SETTING); key = jj_consume_token(ID); jj_consume_token(EQUALS); value = Expression(); end = LooseDirectiveEnd(); token_source.checkNamingConvention(key); PropertySetting result = new PropertySetting(key, token_source, value, template.getConfiguration()); result.setLocation(template, start, end); {if ("" != null) return result;} throw new Error("Missing return statement in function"); }
} else { try { parse = Boolean.valueOf(parseExp.evalToBoolean(template.getConfiguration())); } catch (NonBooleanException e) { throw new ParseException("Expected a boolean or string as the value of the parse attribute", try { ignoreMissingExpPrecalcedValue = Boolean.valueOf( ignoreMissingExp.evalToBoolean(template.getConfiguration())); } catch (NonBooleanException e) { throw new ParseException("Expected a boolean as the value of the \"ignore_missing\" attribute",
outputFormat = template.getConfiguration().getOutputFormat(vs); } catch (IllegalArgumentException e) { {if (true) throw new ParseException("Invalid format name: " + e.getMessage(), exp, e.getCause());}
template, start);} OutputFormat innerOutputFormat = template.getConfiguration().getOutputFormat( paramStr.substring(1, paramStr.length() - 1)); if (!(innerOutputFormat instanceof MarkupOutputFormat)) { (MarkupOutputFormat) outputFormat, (MarkupOutputFormat) innerOutputFormat); } else { outputFormat = template.getConfiguration().getOutputFormat(paramStr);
null, new StringReader(templateSource), parentTemplate.getConfiguration(), pCfg, null); } catch (IOException e) {
LegacyConstructorParserConfiguration lpCfg = (LegacyConstructorParserConfiguration) pCfg; lpCfg.setArithmeticEngineIfNotSet(template.getArithmeticEngine()); lpCfg.setAutoEscapingPolicyIfNotSet(template.getConfiguration().getAutoEscapingPolicy()); lpCfg.setOutputFormatIfNotSet(template.getOutputFormat()); lpCfg.setRecognizeStandardFileExtensionsIfNotSet(
@Override public Configuration getConfiguration() { return conf == null ? super.getConfiguration() : conf; }
if (template.getConfiguration() != cfg) {
public Configuration getConfiguration() { return getTemplate().getConfiguration(); }
@Override public TemplateModel get(String key) throws TemplateModelException { if ("configuration".equals(key)) { try { return (TemplateModel) getCachedWrapperFor(((Template) configurable).getConfiguration()); } catch (RemoteException e) { throw new TemplateModelException(e); } } if ("name".equals(key)) { return name; } return super.get(key); } }
/** * A prime constructor to which all other constructors should * delegate directly or indirectly. */ private Template(String name, String sourceName, Configuration cfg, ParserConfiguration customParserConfiguration) { super(toNonNull(cfg)); this.name = name; this.sourceName = sourceName; this.templateLanguageVersion = normalizeTemplateLanguageVersion(toNonNull(cfg).getIncompatibleImprovements()); this.parserConfiguration = customParserConfiguration != null ? customParserConfiguration : getConfiguration(); }
/** * A prime constructor to which all other constructors should * delegate directly or indirectly. */ private Template(String name, String sourceName, Configuration cfg, ParserConfiguration customParserConfiguration) { super(toNonNull(cfg)); this.name = name; this.sourceName = sourceName; this.templateLanguageVersion = normalizeTemplateLanguageVersion(toNonNull(cfg).getIncompatibleImprovements()); this.parserConfiguration = customParserConfiguration != null ? customParserConfiguration : getConfiguration(); }
public Environment(Template template, final TemplateHashModel rootDataModel, Writer out) { super(template); configuration = template.getConfiguration(); incompatibleImprovementsGE2328 = configuration.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_28; this.globalNamespace = new Namespace(null); this.currentNamespace = mainNamespace = new Namespace(template); this.out = out; this.rootDataModel = rootDataModel; importMacros(template); }
public Environment(Template template, final TemplateHashModel rootDataModel, Writer out) { super(template); configuration = template.getConfiguration(); incompatibleImprovementsGE2328 = configuration.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_28; this.globalNamespace = new Namespace(null); this.currentNamespace = mainNamespace = new Namespace(template); this.out = out; this.rootDataModel = rootDataModel; importMacros(template); }
final public PropertySetting Setting() throws ParseException {Token start, end, key; Expression value; start = jj_consume_token(SETTING); key = jj_consume_token(ID); jj_consume_token(EQUALS); value = Expression(); end = LooseDirectiveEnd(); token_source.checkNamingConvention(key); PropertySetting result = new PropertySetting(key, token_source, value, template.getConfiguration()); result.setLocation(template, start, end); {if ("" != null) return result;} throw new Error("Missing return statement in function"); }
final public PropertySetting Setting() throws ParseException {Token start, end, key; Expression value; start = jj_consume_token(SETTING); key = jj_consume_token(ID); jj_consume_token(EQUALS); value = Expression(); end = LooseDirectiveEnd(); token_source.checkNamingConvention(key); PropertySetting result = new PropertySetting(key, token_source, value, template.getConfiguration()); result.setLocation(template, start, end); {if ("" != null) return result;} throw new Error("Missing return statement in function"); }