Package io.karatelabs.markup
Class FragmentTraceHandler
java.lang.Object
org.thymeleaf.engine.AbstractTemplateHandler
io.karatelabs.markup.FragmentTraceHandler
- All Implemented Interfaces:
org.thymeleaf.engine.ITemplateHandler
public class FragmentTraceHandler
extends org.thymeleaf.engine.AbstractTemplateHandler
Devmode post-processor that emits paired
<!-- ka:fragment-begin -->
/ <!-- ka:fragment-end --> comments around every fragment resolution
and suppresses the synthetic <ka-trace> wrapper element that
TraceWrappingHandler injected at processor time.
For each open <ka-trace> tag:
- Emit a begin comment with kind, fragment expression, depth, and the
raw
th:withpayload from the call site. - SUPPRESS the open tag (don't forward it).
- Push a frame onto a depth stack.
<ka-trace> tag: pop the frame, suppress the close
tag, emit the end comment.
All other tags (host elements, fragment content) pass through unchanged. Untraced templates pay only an O(1) tag-name comparison per element.
The handler is registered ONLY when devTrace + devMode is
enabled (see IPostProcessorDialect.getPostProcessors()); zero
production overhead.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleCloseElement(org.thymeleaf.model.ICloseElementTag tag) voidhandleOpenElement(org.thymeleaf.model.IOpenElementTag tag) voidhandleStandaloneElement(org.thymeleaf.model.IStandaloneElementTag tag) Methods inherited from class org.thymeleaf.engine.AbstractTemplateHandler
getContext, getNext, handleCDATASection, handleComment, handleDocType, handleProcessingInstruction, handleTemplateEnd, handleTemplateStart, handleText, handleXMLDeclaration, setContext, setNext
-
Constructor Details
-
FragmentTraceHandler
public FragmentTraceHandler()
-
-
Method Details
-
handleOpenElement
public void handleOpenElement(org.thymeleaf.model.IOpenElementTag tag) - Specified by:
handleOpenElementin interfaceorg.thymeleaf.engine.ITemplateHandler- Overrides:
handleOpenElementin classorg.thymeleaf.engine.AbstractTemplateHandler
-
handleCloseElement
public void handleCloseElement(org.thymeleaf.model.ICloseElementTag tag) - Specified by:
handleCloseElementin interfaceorg.thymeleaf.engine.ITemplateHandler- Overrides:
handleCloseElementin classorg.thymeleaf.engine.AbstractTemplateHandler
-
handleStandaloneElement
public void handleStandaloneElement(org.thymeleaf.model.IStandaloneElementTag tag) - Specified by:
handleStandaloneElementin interfaceorg.thymeleaf.engine.ITemplateHandler- Overrides:
handleStandaloneElementin classorg.thymeleaf.engine.AbstractTemplateHandler
-