Class IncludeProcessor
java.lang.Object
dev.jcputney.mjml.parser.IncludeProcessor
Processes mj-include elements in the parsed MJML tree.
Supports four include types:
- mjml (default): Includes an MJML fragment. The included content's children replace the mj-include element.
- html: Includes raw HTML as an mj-raw element.
- css: Includes CSS as an mj-style element (optionally inline when
css-inline="inline"attribute is present). - css-inline: Shorthand for
type="css" css-inline="inline". Includes CSS as an mj-style element withinline="inline".
Cycle detection prevents infinite recursion from circular includes.
-
Constructor Summary
ConstructorsConstructorDescriptionIncludeProcessor(IncludeResolver resolver) Creates a processor with default limits for include depth and nesting depth.IncludeProcessor(IncludeResolver resolver, int maxInputSize) Creates a processor with a size limit for included content.IncludeProcessor(IncludeResolver resolver, int maxInputSize, int maxIncludeDepth) Creates a processor with limits for included content and include depth.IncludeProcessor(IncludeResolver resolver, int maxInputSize, int maxIncludeDepth, int maxNestingDepth) Creates a processor with all limits specified. -
Method Summary
Modifier and TypeMethodDescriptionvoidprocess(MjmlDocument document) Processes all mj-include elements in the document tree, recursively resolving included content and replacing mj-include nodes with the resolved content.
-
Constructor Details
-
IncludeProcessor
Creates a processor with default limits for include depth and nesting depth.- Parameters:
resolver- the resolver to use for loading include content
-
IncludeProcessor
Creates a processor with a size limit for included content.- Parameters:
resolver- the resolver to use for loading include contentmaxInputSize- maximum allowed size in characters for resolved content (0 = no limit)
-
IncludeProcessor
Creates a processor with limits for included content and include depth.- Parameters:
resolver- the resolver to use for loading include contentmaxInputSize- maximum allowed size in characters for resolved content (0 = no limit)maxIncludeDepth- maximum nested include depth before rejecting
-
IncludeProcessor
public IncludeProcessor(IncludeResolver resolver, int maxInputSize, int maxIncludeDepth, int maxNestingDepth) Creates a processor with all limits specified.- Parameters:
resolver- the resolver to use for loading include contentmaxInputSize- maximum allowed size in characters for resolved content (0 = no limit)maxIncludeDepth- maximum nested include depth before rejectingmaxNestingDepth- maximum element nesting depth for parsing included content
-
-
Method Details
-
process
Processes all mj-include elements in the document tree, recursively resolving included content and replacing mj-include nodes with the resolved content.- Parameters:
document- the parsed MJML document to process
-