public final class CombinedMarkupOutputFormat extends CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
| Constructor and Description |
|---|
CombinedMarkupOutputFormat(MarkupOutputFormat outer,
MarkupOutputFormat inner)
Same as
CombinedMarkupOutputFormat(String, MarkupOutputFormat, MarkupOutputFormat) with null as
the name parameter. |
CombinedMarkupOutputFormat(java.lang.String name,
MarkupOutputFormat outer,
MarkupOutputFormat inner) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
escapePlainText(java.lang.String plainTextContent)
Should give the same result as
MarkupOutputFormat.fromPlainTextByEscaping(String) and then
MarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel), but the implementation may use a more efficient solution. |
MarkupOutputFormat |
getInnerOutputFormat() |
java.lang.String |
getMimeType()
Returns the MIME type of the output format.
|
java.lang.String |
getName()
The short name used to refer to this format (like in the
#ftl header). |
MarkupOutputFormat |
getOuterOutputFormat() |
boolean |
isAutoEscapedByDefault()
Tells if by default auto-escaping should be on for this format.
|
boolean |
isLegacyBuiltInBypassed(java.lang.String builtInName)
Tells if a string built-in that can't handle a
TemplateMarkupOutputModel left hand operand can bypass
this object as is. |
boolean |
isOutputFormatMixingAllowed()
Tells if this output format allows inserting
TemplateMarkupOutputModel-s of another output formats into
it. |
protected TemplateCombinedMarkupOutputModel |
newTemplateMarkupOutputModel(java.lang.String plainTextContent,
java.lang.String markupContent)
Creates a new
CommonTemplateMarkupOutputModel that's bound to this OutputFormat instance. |
void |
output(java.lang.String textToEsc,
java.io.Writer out)
Equivalent to calling
MarkupOutputFormat.fromPlainTextByEscaping(String) and then
MarkupOutputFormat.output(TemplateMarkupOutputModel, Writer), but the implementation may use a more efficient solution. |
<MO2 extends TemplateMarkupOutputModel<MO2>> |
outputForeign(MO2 mo,
java.io.Writer out)
Outputs a value from a foreign output format; only used if
OutputFormat.isOutputFormatMixingAllowed() return
true. |
concat, fromMarkup, fromPlainTextByEscaping, getMarkupString, getSourcePlainText, isEmpty, outputtoString, toStringExtraPropertiespublic CombinedMarkupOutputFormat(MarkupOutputFormat outer, MarkupOutputFormat inner)
CombinedMarkupOutputFormat(String, MarkupOutputFormat, MarkupOutputFormat) with null as
the name parameter.public CombinedMarkupOutputFormat(java.lang.String name,
MarkupOutputFormat outer,
MarkupOutputFormat inner)
name - Maybe null, in which case it defaults to
outer.getName() + "{" + inner.getName() + "}".public java.lang.String getName()
OutputFormat#ftl header).getName in class OutputFormatpublic java.lang.String getMimeType()
OutputFormatnull
null if this output format doesn't clearly corresponds to a specific MIME type.getMimeType in class OutputFormatpublic void output(java.lang.String textToEsc,
java.io.Writer out)
throws java.io.IOException,
TemplateModelException
MarkupOutputFormatMarkupOutputFormat.fromPlainTextByEscaping(String) and then
MarkupOutputFormat.output(TemplateMarkupOutputModel, Writer), but the implementation may use a more efficient solution.output in class CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>java.io.IOExceptionTemplateModelExceptionpublic <MO2 extends TemplateMarkupOutputModel<MO2>> void outputForeign(MO2 mo, java.io.Writer out) throws java.io.IOException, TemplateModelException
MarkupOutputFormatOutputFormat.isOutputFormatMixingAllowed() return
true. The default implementation in MarkupOutputFormat will just let the other
OutputFormat to output value, but it can be overridden to support more nuanced conversions, or to check if outputting without
conversion should be allowed.outputForeign in class MarkupOutputFormat<TemplateCombinedMarkupOutputModel>java.io.IOExceptionTemplateModelExceptionpublic java.lang.String escapePlainText(java.lang.String plainTextContent)
throws TemplateModelException
MarkupOutputFormatMarkupOutputFormat.fromPlainTextByEscaping(String) and then
MarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel), but the implementation may use a more efficient solution.escapePlainText in class MarkupOutputFormat<TemplateCombinedMarkupOutputModel>TemplateModelExceptionpublic boolean isLegacyBuiltInBypassed(java.lang.String builtInName)
throws TemplateModelException
MarkupOutputFormatTemplateMarkupOutputModel left hand operand can bypass
this object as is. A typical such case would be when a TemplateHTMLOutputModel of "HTML" format bypasses
?html.isLegacyBuiltInBypassed in class MarkupOutputFormat<TemplateCombinedMarkupOutputModel>TemplateModelExceptionpublic boolean isAutoEscapedByDefault()
MarkupOutputFormattrue if you need to escape
on most of the places where you insert values.isAutoEscapedByDefault in class CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>Configuration.setAutoEscapingPolicy(int)public boolean isOutputFormatMixingAllowed()
OutputFormatTemplateMarkupOutputModel-s of another output formats into
it.
If true, the foreign TemplateMarkupOutputModel will be inserted into the output. If the current
output format is a MarkupOutputFormat this is done using the
MarkupOutputFormat.outputForeign(TemplateMarkupOutputModel, Writer) method, which can implement smart
conversions. The default behavior (and the only behavior for non-markup outputs) is to behave as 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 returns false (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 by UndefinedOutputFormat.
isOutputFormatMixingAllowed in class CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>public MarkupOutputFormat getOuterOutputFormat()
public MarkupOutputFormat getInnerOutputFormat()
protected TemplateCombinedMarkupOutputModel newTemplateMarkupOutputModel(java.lang.String plainTextContent, java.lang.String markupContent)
CommonMarkupOutputFormatCommonTemplateMarkupOutputModel that's bound to this OutputFormat instance.
When this is called from CommonMarkupOutputFormat, exactly one of the parameters will be
non-null.newTemplateMarkupOutputModel in class CommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>plainTextContent - null if the content is markup that possibly can be described as plain text without loss.markupContent - Typically will be null if plainTextContent is not null. While the plain text always
can be converted to markup via MarkupOutputFormat.escapePlainText(String), it's up to the implementation if it wants
to do that now and store the markup, or later on demand (like each time when
CommonMarkupOutputFormat.getMarkupString(CommonTemplateMarkupOutputModel) is called).