Enum MarkdownSink.ElementContext
java.lang.Object
java.lang.Enum<MarkdownSink.ElementContext>
org.apache.maven.doxia.module.markdown.MarkdownSink.ElementContext
- All Implemented Interfaces:
Serializable, Comparable<MarkdownSink.ElementContext>
- Enclosing class:
MarkdownSink
Most important contextual metadata (of elements). This contains information about necessary escaping rules, potential prefixes and newlines
-
Nested Class Summary
Nested Classes -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final booleanIf markup linebreaks (i.e.(package private) final MarkdownSink.TextEscapeFunctionThe function to call to escape the given text.(package private) final Stringprefix to be used for each line of (nested) block elements inside the current container context (only not empty fortypebeingMarkdownSink.ElementContext.Type.CONTAINER_BLOCK)(package private) final booleaniftruerequires buffering any text appearing inside this context(package private) final booleanOnly relevant for block element, if set totruethe element requires to be surrounded by blank lines.(package private) final MarkdownSink.ElementContext.Typetrueif block element, otherwisefalsefor inline elements -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction) privateElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction, boolean requiresBuffering) privateElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction, boolean requiresBuffering, String prefix) privateElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction, boolean requiresBuffering, String prefix, boolean requiresSurroundingByBlankLines) -
Method Summary
Modifier and TypeMethodDescription(package private) Stringescape(LastTwoLinesAwareWriter writer, String text) Must be called for each inline text to be emitted directly within this context (not relevant for nested context)private StringescapeForTableCell(LastTwoLinesAwareWriter writer, String text) Escapes the pipe character according to GFM Table Extension in addition to the regular markdown escaping.private StringescapeHtml(LastTwoLinesAwareWriter writer, String text) private static StringescapeMarkdown(char c) private StringescapeMarkdown(LastTwoLinesAwareWriter writer, String text) First use XML escaping (leveraging the predefined entities, for browsers) afterwards escape special characters in a text with a leading backslash (for markdown parsers)private static booleanisAfterDigit(StringBuilder buffer, LastTwoLinesAwareWriter writer) boolean(package private) booleanisBlock()(package private) boolean(package private) booleanisHtml()private static booleanisInBlankLine(StringBuilder buffer, LastTwoLinesAwareWriter writer) static MarkdownSink.ElementContextReturns the enum constant of this type with the specified name.static MarkdownSink.ElementContext[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ROOT_WITH_BUFFERING
-
ROOT_WITHOUT_BUFFERING
-
HEAD
-
BODY
-
FIGURE
-
HEADING
-
CODE_BLOCK
-
CODE_SPAN
-
TABLE
-
TABLE_CAPTION
-
TABLE_ROW
-
TABLE_CELL
-
LIST_ITEM
-
BLOCKQUOTE
-
HTML_BLOCK
-
-
Field Details
-
type
trueif block element, otherwisefalsefor inline elements -
escapeFunction
The function to call to escape the given text. The function is supposed to return the escaped text or return just the given text if no escaping is necessary in this context -
requiresBuffering
final boolean requiresBufferingiftruerequires buffering any text appearing inside this context -
prefix
prefix to be used for each line of (nested) block elements inside the current container context (only not empty fortypebeingMarkdownSink.ElementContext.Type.CONTAINER_BLOCK) -
requiresSurroundingByBlankLines
final boolean requiresSurroundingByBlankLinesOnly relevant for block element, if set totruethe element requires to be surrounded by blank lines. -
allowsMarkupLinebreaks
final boolean allowsMarkupLinebreaksIf markup linebreaks (i.e. insignificant linebreaks in the source) are allowed in this context. This is relevant for markdown as in some contexts (e.g. list items) linebreaks are always significant (while for HTML they wouldn't be)
-
-
Constructor Details
-
ElementContext
private ElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction) -
ElementContext
private ElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction, boolean requiresBuffering) -
ElementContext
private ElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction, boolean requiresBuffering, String prefix) -
ElementContext
private ElementContext(MarkdownSink.ElementContext.Type type, boolean allowsMarkupLinebreaks, MarkdownSink.TextEscapeFunction escapeFunction, boolean requiresBuffering, String prefix, boolean requiresSurroundingByBlankLines)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
escape
Must be called for each inline text to be emitted directly within this context (not relevant for nested context)- Parameters:
text-- Returns:
- the escaped text (may be same as
textwhen no escaping is necessary)
-
isBlock
boolean isBlock()- Returns:
truefor all block types,falseotherwise
-
isHtml
boolean isHtml()- Returns:
trueif only HTML is allowed in this context
-
isContainer
boolean isContainer()- Returns:
truefor all containers (allowing block elements as children),falseotherwise
-
isAllowsMarkupLinebreaks
public boolean isAllowsMarkupLinebreaks() -
escapeMarkdown
First use XML escaping (leveraging the predefined entities, for browsers) afterwards escape special characters in a text with a leading backslash (for markdown parsers)\, `, *, _, {, }, [, ], (, ), #, +, -, ., !- Parameters:
text- the string to escape, may be null- Returns:
- the text escaped, "" if null String input
- See Also:
-
isAfterDigit
-
isInBlankLine
-
escapeMarkdown
-
escapeHtml
-
escapeForTableCell
Escapes the pipe character according to GFM Table Extension in addition to the regular markdown escaping.- Parameters:
text-- Returns:
- the escaped text
-