Package freemarker.core
Class CombinedMarkupOutputFormat
- java.lang.Object
-
- freemarker.core.OutputFormat
-
- freemarker.core.MarkupOutputFormat<MO>
-
- 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
Constructors Constructor Description CombinedMarkupOutputFormat(MarkupOutputFormat outer, MarkupOutputFormat inner)Same asCombinedMarkupOutputFormat(String, MarkupOutputFormat, MarkupOutputFormat)withnullas thenameparameter.CombinedMarkupOutputFormat(java.lang.String name, MarkupOutputFormat outer, MarkupOutputFormat inner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringescapePlainText(java.lang.String plainTextContent)Should give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel), but the implementation may uses a more efficient solution.MarkupOutputFormatgetInnerOutputFormat()java.lang.StringgetMimeType()Returns the MIME type of the output format.java.lang.StringgetName()The short name used to refer to this format (like in the#ftlheader).MarkupOutputFormatgetOuterOutputFormat()booleanisAutoEscapedByDefault()Tells if by default auto-escaping should be on for this format.booleanisLegacyBuiltInBypassed(java.lang.String builtInName)Tells if a string built-in that can't handle aTemplateMarkupOutputModelleft hand operand can bypass this object as is.booleanisOutputFormatMixingAllowed()Tells if this output format allows insertingTemplateMarkupOutputModel-s of another output formats into it.protected TemplateCombinedMarkupOutputModelnewTemplateMarkupOutputModel(java.lang.String plainTextContent, java.lang.String markupContent)Creates a newCommonTemplateMarkupOutputModelthat's bound to thisOutputFormatinstance.voidoutput(java.lang.String textToEsc, java.io.Writer out)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 Detail
-
CombinedMarkupOutputFormat
public CombinedMarkupOutputFormat(MarkupOutputFormat outer, MarkupOutputFormat inner)
Same asCombinedMarkupOutputFormat(String, MarkupOutputFormat, MarkupOutputFormat)withnullas thenameparameter.
-
CombinedMarkupOutputFormat
public CombinedMarkupOutputFormat(java.lang.String name, MarkupOutputFormat outer, MarkupOutputFormat inner)- Parameters:
name- Maybenull, in which case it defaults toouter.getName() + "{" + inner.getName() + "}".
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:OutputFormatThe short name used to refer to this format (like in the#ftlheader).- Specified by:
getNamein classOutputFormat
-
getMimeType
public java.lang.String getMimeType()
Description copied from class:OutputFormatReturns the MIME type of the output format. This might comes handy when generating a HTTP response.nullnullif this output format doesn't clearly corresponds to a specific MIME type.- Specified by:
getMimeTypein classOutputFormat
-
output
public void output(java.lang.String textToEsc, java.io.Writer out) throws java.io.IOException, TemplateModelExceptionDescription copied from class:MarkupOutputFormatEquivalent to callingMarkupOutputFormat.fromPlainTextByEscaping(String)and thenMarkupOutputFormat.output(TemplateMarkupOutputModel, Writer), but the implementation may uses a more efficient solution.- Specified by:
outputin classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>- Throws:
java.io.IOExceptionTemplateModelException
-
escapePlainText
public java.lang.String escapePlainText(java.lang.String plainTextContent) throws TemplateModelExceptionDescription copied from class:MarkupOutputFormatShould give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel), but the implementation may uses a more efficient solution.- Specified by:
escapePlainTextin classMarkupOutputFormat<TemplateCombinedMarkupOutputModel>- Throws:
TemplateModelException
-
isLegacyBuiltInBypassed
public boolean isLegacyBuiltInBypassed(java.lang.String builtInName) throws TemplateModelExceptionDescription copied from class:MarkupOutputFormatTells if a string built-in that can't handle aTemplateMarkupOutputModelleft hand operand can bypass this object as is. A typical such case would be when aTemplateHTMLOutputModelof "HTML" format bypasses?html.- Specified by:
isLegacyBuiltInBypassedin classMarkupOutputFormat<TemplateCombinedMarkupOutputModel>- Throws:
TemplateModelException
-
isAutoEscapedByDefault
public boolean isAutoEscapedByDefault()
Description copied from class:MarkupOutputFormatTells if by default auto-escaping should be on for this format. It should betrueif you need to escape on most of the places where you insert values.- Overrides:
isAutoEscapedByDefaultin classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>- See Also:
Configuration.setAutoEscapingPolicy(int)
-
isOutputFormatMixingAllowed
public boolean isOutputFormatMixingAllowed()
Description copied from class:OutputFormatTells if this output format allows insertingTemplateMarkupOutputModel-s of another output formats into it. Iftrue, the foreignTemplateMarkupOutputModelwill 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.)truevalue is used byUndefinedOutputFormat.- Overrides:
isOutputFormatMixingAllowedin classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
-
getOuterOutputFormat
public MarkupOutputFormat getOuterOutputFormat()
-
getInnerOutputFormat
public MarkupOutputFormat getInnerOutputFormat()
-
newTemplateMarkupOutputModel
protected TemplateCombinedMarkupOutputModel newTemplateMarkupOutputModel(java.lang.String plainTextContent, java.lang.String markupContent)
Description copied from class:CommonMarkupOutputFormatCreates a newCommonTemplateMarkupOutputModelthat's bound to thisOutputFormatinstance.- Specified by:
newTemplateMarkupOutputModelin classCommonMarkupOutputFormat<TemplateCombinedMarkupOutputModel>
-
-