Package freemarker.core
Class CombinedMarkupOutputFormat
java.lang.Object
freemarker.core.OutputFormat
freemarker.core.MarkupOutputFormat<TemplateCombinedMarkupOutputModel>
freemarker.core.CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
freemarker.core.CombinedMarkupOutputFormat
public final class CombinedMarkupOutputFormat
extends CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
Represents two markup formats nested into each other. For example, markdown nested into HTML.
- Since:
- 2.3.24
-
Constructor Summary
ConstructorsConstructorDescriptionCombinedMarkupOutputFormat
(MarkupOutputFormat outer, MarkupOutputFormat inner) Same asCombinedMarkupOutputFormat(String, MarkupOutputFormat, MarkupOutputFormat)
withnull
as thename
parameter.CombinedMarkupOutputFormat
(String name, MarkupOutputFormat outer, MarkupOutputFormat inner) -
Method Summary
Modifier and TypeMethodDescriptionescapePlainText
(String plainTextContent) Should give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)
, but the implementation may uses a more efficient solution.Returns the MIME type of the output format.getName()
The short name used to refer to this format (like in the#ftl
header).boolean
Tells if by default auto-escaping should be on for this format.boolean
isLegacyBuiltInBypassed
(String builtInName) Tells if a string built-in that can't handle aTemplateMarkupOutputModel
left hand operand can bypass this object as is.boolean
Tells if this output format allows insertingTemplateMarkupOutputModel
-s of another output formats into it.protected TemplateCombinedMarkupOutputModel
newTemplateMarkupOutputModel
(String plainTextContent, String markupContent) Creates a newCommonTemplateMarkupOutputModel
that's bound to thisOutputFormat
instance.void
Equivalent to callingMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)
, but the implementation may uses a more efficient solution.Methods inherited from class freemarker.core.CommonMarkupOutputFormat
concat, fromMarkup, fromPlainTextByEscaping, getMarkupString, getSourcePlainText, isEmpty, output
Methods inherited from class freemarker.core.OutputFormat
toString, toStringExtraProperties
-
Constructor Details
-
CombinedMarkupOutputFormat
Same asCombinedMarkupOutputFormat(String, MarkupOutputFormat, MarkupOutputFormat)
withnull
as thename
parameter. -
CombinedMarkupOutputFormat
- Parameters:
name
- Maybenull
, in which case it defaults toouter.getName() + "{" + inner.getName() + "}"
.
-
-
Method Details
-
getName
Description copied from class:OutputFormat
The short name used to refer to this format (like in the#ftl
header).- Specified by:
getName
in classOutputFormat
-
getMimeType
Description copied from class:OutputFormat
Returns the MIME type of the output format. This might comes handy when generating a HTTP response.null
null
if this output format doesn't clearly corresponds to a specific MIME type.- Specified by:
getMimeType
in classOutputFormat
-
output
Description copied from class:MarkupOutputFormat
Equivalent to callingMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)
, but the implementation may uses a more efficient solution.- Specified by:
output
in classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
- Throws:
IOException
TemplateModelException
-
escapePlainText
Description copied from class:MarkupOutputFormat
Should give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)
, but the implementation may uses a more efficient solution.- Specified by:
escapePlainText
in classMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
- Throws:
TemplateModelException
-
isLegacyBuiltInBypassed
Description copied from class:MarkupOutputFormat
Tells if a string built-in that can't handle aTemplateMarkupOutputModel
left hand operand can bypass this object as is. A typical such case would be when aTemplateHTMLOutputModel
of "HTML" format bypasses?html
.- Specified by:
isLegacyBuiltInBypassed
in classMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
- Throws:
TemplateModelException
-
isAutoEscapedByDefault
public boolean isAutoEscapedByDefault()Description copied from class:MarkupOutputFormat
Tells if by default auto-escaping should be on for this format. It should betrue
if you need to escape on most of the places where you insert values.- Overrides:
isAutoEscapedByDefault
in classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
- See Also:
-
isOutputFormatMixingAllowed
public boolean isOutputFormatMixingAllowed()Description copied from class:OutputFormat
Tells if this output format allows insertingTemplateMarkupOutputModel
-s of another output formats into it. Iftrue
, the foreignTemplateMarkupOutputModel
will be inserted into the output as is (like if the surrounding output format was the same). This is usually a bad idea to allow, as such an event could indicate application bugs. If this method returnsfalse
(recommended), then FreeMarker will try to assimilate the inserted value by converting its format to this format, which will currently (2.3.24) cause exception, unless the inserted value is made by escaping plain text and the target format is non-escaping, in which case format conversion is trivially possible. (It's not impossible that conversions will be extended beyond this, if there will be demand for that.)true
value is used byUndefinedOutputFormat
.- Overrides:
isOutputFormatMixingAllowed
in classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
-
getOuterOutputFormat
-
getInnerOutputFormat
-
newTemplateMarkupOutputModel
protected TemplateCombinedMarkupOutputModel newTemplateMarkupOutputModel(String plainTextContent, String markupContent) Description copied from class:CommonMarkupOutputFormat
Creates a newCommonTemplateMarkupOutputModel
that's bound to thisOutputFormat
instance.- Specified by:
newTemplateMarkupOutputModel
in classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
-