/** * @return the Template object with which this Namespace is associated. */ public Template getTemplate() { return template == null ? Environment.this.getTemplate() : template; }
: new SimpleScalar(env.getTemplate().getName());
/** Returns the same value as pre-IcI 2.3.22 getTemplate() did. */ Template getTemplate230() { Template legacyParent = (Template) this.legacyParent; return legacyParent != null ? legacyParent : getTemplate(); }
Namespace() { this.template = Environment.this.getTemplate(); }
private Object getIncludedTemplateCustomLookupCondition() { return getTemplate().getCustomLookupCondition(); }
static Template getTemplate(String systemId) throws IOException { Environment env = Environment.getCurrentEnvironment(); String encoding = env.getTemplate().getEncoding(); if (encoding == null) { encoding = env.getConfiguration().getEncoding(env.getLocale()); } String templatePath = env.getTemplate().getName(); int lastSlash = templatePath.lastIndexOf('/'); templatePath = lastSlash == -1 ? "" : templatePath.substring(0, lastSlash + 1); systemId = env.toFullTemplateName(templatePath, systemId); Template raw = env.getConfiguration().getTemplate(systemId, env.getLocale(), encoding, false); return raw; }
private String getIncludedTemplateEncoding() { String encoding; // This branch shouldn't exist, as it doesn't make much sense to inherit encoding. But we have to keep BC. encoding = getTemplate().getEncoding(); if (encoding == null) { encoding = configuration.getEncoding(this.getLocale()); } return encoding; }
/** * Processes the template to which this environment belongs to. */ public void process() throws TemplateException, IOException { Object savedEnv = threadEnv.get(); threadEnv.set(this); try { // Cached values from a previous execution are possibly outdated. clearCachedValues(); try { doAutoImportsAndIncludes(this); visit(getTemplate().getRootTreeNode()); // It's here as we must not flush if there was an exception. if (getAutoFlush()) { out.flush(); } } finally { // It's just to allow the GC to free memory... clearCachedValues(); } } finally { threadEnv.set(savedEnv); } }
@Override public TemplateModel get(String key) throws TemplateModelException { if ("currentNamespace".equals(key)) { return ((Environment) configurable).getCurrentNamespace(); } if ("dataModel".equals(key)) { return ((Environment) configurable).getDataModel(); } if ("globalNamespace".equals(key)) { return ((Environment) configurable).getGlobalNamespace(); } if ("knownVariables".equals(key)) { return knownVariables; } if ("mainNamespace".equals(key)) { return ((Environment) configurable).getMainNamespace(); } if ("template".equals(key)) { try { return (TemplateModel) getCachedWrapperFor(((Environment) configurable).getTemplate()); } catch (RemoteException e) { throw new TemplateModelException(e); } } return super.get(key); } }
/** * Processes a Template in the context of this <code>Environment</code>, including its output in the * <code>Environment</code>'s Writer. * * @param includedTemplate * the template to process. Note that it does <em>not</em> need to be a template returned by * {@link #getTemplateForInclusion(String name, String encoding, boolean parse)}. */ public void include(Template includedTemplate) throws TemplateException, IOException { final Template prevTemplate; final boolean parentReplacementOn = isBeforeIcI2322(); prevTemplate = getTemplate(); if (parentReplacementOn) { setParent(includedTemplate); } else { legacyParent = includedTemplate; } importMacros(includedTemplate); try { visit(includedTemplate.getRootTreeNode()); } finally { if (parentReplacementOn) { setParent(prevTemplate); } else { legacyParent = prevTemplate; } } }
>= _TemplateAPI.VERSION_INT_2_3_26 ? env.getCurrentTemplate() : env.getTemplate();
/** Returns the same value as pre-IcI 2.3.22 getTemplate() did. */ Template getTemplate230() { Template legacyParent = (Template) this.legacyParent; return legacyParent != null ? legacyParent : getTemplate(); }
/** * @return the Template object with which this Namespace is associated. */ public Template getTemplate() { return template == null ? Environment.this.getTemplate() : template; }
/** Returns the same value as pre-IcI 2.3.22 getTemplate() did. */ Template getTemplate230() { Template legacyParent = (Template) this.legacyParent; return legacyParent != null ? legacyParent : getTemplate(); }
/** * @return the Template object with which this Namespace is associated. */ public Template getTemplate() { return template == null ? Environment.this.getTemplate() : template; }
public TemplateDefinition(TemplateDirectiveBody body, Environment env) { this.body = body; this.env = env; this.templateName = env.getTemplate().getName(); }
private String getIncludedTemplateEncoding() { String encoding; // This branch shouldn't exist, as it doesn't make much sense to inherit encoding. But we have to keep BC. encoding = getTemplate().getEncoding(); if (encoding == null) { encoding = configuration.getEncoding(this.getLocale()); } return encoding; }
static Template getTemplate(String systemId) throws IOException { Environment env = Environment.getCurrentEnvironment(); String encoding = env.getTemplate().getEncoding(); if (encoding == null) { encoding = env.getConfiguration().getEncoding(env.getLocale()); } String templatePath = env.getTemplate().getName(); int lastSlash = templatePath.lastIndexOf('/'); templatePath = lastSlash == -1 ? "" : templatePath.substring(0, lastSlash + 1); systemId = TemplateCache.getFullTemplatePath(env, templatePath, systemId); Template raw = env.getConfiguration().getTemplate(systemId, env.getLocale(), encoding, false); return raw; }
static Template getTemplate(String systemId) throws IOException { Environment env = Environment.getCurrentEnvironment(); String encoding = env.getTemplate().getEncoding(); if (encoding == null) { encoding = env.getConfiguration().getEncoding(env.getLocale()); } String templatePath = env.getTemplate().getName(); int lastSlash = templatePath.lastIndexOf('/'); templatePath = lastSlash == -1 ? "" : templatePath.substring(0, lastSlash + 1); systemId = env.toFullTemplateName(templatePath, systemId); Template raw = env.getConfiguration().getTemplate(systemId, env.getLocale(), encoding, false); return raw; }
private String getIncludedTemplateEncoding() { String encoding; // This branch shouldn't exist, as it doesn't make much sense to inherit encoding. But we have to keep BC. encoding = getTemplate().getEncoding(); if (encoding == null) { encoding = configuration.getEncoding(this.getLocale()); } return encoding; }