/** * <p> * Returns the template mode ({@link TemplateMode}) (of the leaf template). * </p> * <p> * Note that the {@link TemplateMode} returned here corresponds with origin of the elements or nodes being * currently processed. This is, if a processor is being executed for an element inserted from an external * template (via a {@code th:insert}, for example), then this method will return the template mode * for the template in which the inserted fragment lives, not the one it was inserted into. * </p> * * @return the template mode */ public TemplateMode getTemplateMode() { return this.context.getTemplateData().getTemplateMode(); }
/** * <p> * Returns the template name (of the leaf template). * </p> * <p> * Note that the template name returned here corresponds with origin of the elements or nodes being * currently processed. This is, if a processor is being executed for an element inserted from an external * template (via a {@code th:insert}, for example), then this method will return the template mode * for the template in which the inserted fragment lives, not the one it was inserted into. * </p> * * @return the template name */ public String getTemplateName() { return this.context.getTemplateData().getTemplate(); }
@Override protected void doProcess( final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final IElementTagStructureHandler structureHandler) { if (LOGGER.isWarnEnabled()) { LOGGER.warn( "[THYMELEAF][{}][{}] Deprecated attribute {} found in template {}, line {}, col {}. " + "Please use {} instead, this deprecated attribute will be removed in future versions of Thymeleaf.", new Object[]{ TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(context.getTemplateData().getTemplate()), attributeName, tag.getTemplateName(), Integer.valueOf(tag.getAttribute(attributeName).getLine()), Integer.valueOf(tag.getAttribute(attributeName).getCol()), AttributeNames.forHTMLName(attributeName.getPrefix(), StandardReplaceTagProcessor.ATTR_NAME)}); } super.doProcess(context, tag, attributeName, attributeValue, structureHandler); }
new Object[] {TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(context.getTemplateData().getTemplate()), attributeValue, attributeName, attributeValue, Boolean.TRUE}); new Object[] {TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(context.getTemplateData().getTemplate()), attributeValue, attributeName, attributeValue, Boolean.valueOf(visible)});
private CharSequence inlineSwitchTemplateMode(final ITemplateContext context, final IText text) { final TemplateManager templateManager = context.getConfiguration().getTemplateManager(); final TemplateModel templateModel = templateManager.parseString( context.getTemplateData(), text.getText(), text.getLine(), text.getCol(), this.templateMode, true); if (!this.writeTextsToOutput) { final Writer stringWriter = new FastStringWriter(50); templateManager.process(templateModel, context, stringWriter); return stringWriter.toString(); } // If we can directly write to output (and text is an IText), we will use a LazyProcessingCharSequence return new LazyProcessingCharSequence(context, templateModel); }
private CharSequence inlineSwitchTemplateMode(final ITemplateContext context, final ICDATASection cdataSection) { final TemplateManager templateManager = context.getConfiguration().getTemplateManager(); /* * Notice we are ONLY processing the contents of the CDATA, because we know the target inlining * mode will not understand the CDATA (it will be textual) and we don't want it to mess around with * the CDATA's prefix and suffix. * * Note this will only be executed in markup modes (textual modes never fire "handleCDATASection" events), * so we are safe assuming the sizes of CDATA prefixes and suffixes in HTML/XML. */ final TemplateModel templateModel = templateManager.parseString( context.getTemplateData(), cdataSection.getContent(), cdataSection.getLine(), cdataSection.getCol() + 9, // +9 because of the prefix this.templateMode, true); final Writer stringWriter = new FastStringWriter(50); templateManager.process(templateModel, context, stringWriter); return stringWriter.toString(); }
private CharSequence inlineSwitchTemplateMode(final ITemplateContext context, final IComment comment) { final TemplateManager templateManager = context.getConfiguration().getTemplateManager(); /* * Notice we are ONLY processing the contents of the Comment, because we know the target inlining * mode will not understand the Comment (it will be textual) and we don't want it to mess around with * the Comment's prefix and suffix. * * Note this will only be executed in markup modes (textual modes never fire "handleComment" events), * so we are safe assuming the sizes of Comment prefixes and suffixes in HTML/XML. */ final TemplateModel templateModel = templateManager.parseString( context.getTemplateData(), comment.getContent(), comment.getLine(), comment.getCol() + 4, // +4 because of the prefix this.templateMode, true); final Writer stringWriter = new FastStringWriter(50); templateManager.process(templateModel, context, stringWriter); return stringWriter.toString(); }
final String ownerTemplate = context.getTemplateData().getTemplate(); final Map<String,Object> templateResolutionAttributes = context.getTemplateResolutionAttributes();
context.getTemplateData(), attributeValue, attribute.getLine(), attribute.getCol(), TemplateMode.JAVASCRIPT, true);
context.getTemplateData(), unescapedTextStr, 0, 0, // we won't apply offset here because the inserted text does not really come from the template itself
context.getTemplateData(), parsableContent, comment.getLine(), comment.getCol(),
"[THYMELEAF][{}] Resolving message with key \"{}\" for template \"{}\" and locale \"{}\". " + "Messages will be retrieved from Spring's MessageSource infrastructure.", new Object[]{TemplateEngine.threadIndex(), key, context.getTemplateData().getTemplate(), context.getLocale()});
"[THYMELEAF][{}] Resolving message with key \"{}\" for template \"{}\" and locale \"{}\". " + "Messages will be retrieved from Spring's MessageSource infrastructure.", new Object[]{TemplateEngine.threadIndex(), key, context.getTemplateData().getTemplate(), context.getLocale()});
"[THYMELEAF][{}] Resolving message with key \"{}\" for template \"{}\" and locale \"{}\". " + "Messages will be retrieved from Spring's MessageSource infrastructure.", new Object[]{TemplateEngine.threadIndex(), key, context.getTemplateData().getTemplate(), context.getLocale()});
"[THYMELEAF][{}] Resolving message with key \"{}\" for template \"{}\" and locale \"{}\". " + "Messages will be retrieved from Spring's MessageSource infrastructure.", new Object[]{TemplateEngine.threadIndex(), key, context.getTemplateData().getTemplate(), context.getLocale()});
"[THYMELEAF][{}] Resolving message with key \"{}\" for template \"{}\" and locale \"{}\". " + "Messages will be retrieved from Spring's MessageSource infrastructure.", new Object[]{TemplateEngine.threadIndex(), key, context.getTemplateData().getTemplate(), context.getLocale()});