Class AbstractMarkupWriter<T,E extends Throwable>
- java.lang.Object
-
- gov.nist.secauto.metaschema.core.datatype.markup.flexmark.AbstractMarkupWriter<T,E>
-
- Type Parameters:
T
- the type of stream to write toE
- the type of exception that can be thrown when a writing error occurs
- All Implemented Interfaces:
IMarkupWriter<T,E>
- Direct Known Subclasses:
MarkupXmlEventWriter
,MarkupXmlStreamWriter
public abstract class AbstractMarkupWriter<T,E extends Throwable> extends Object implements IMarkupWriter<T,E>
Used to write HTML-based Markup to various types of streams.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractMarkupWriter.NodeVisitorException
-
Nested classes/interfaces inherited from interface gov.nist.secauto.metaschema.core.datatype.markup.flexmark.IMarkupWriter
IMarkupWriter.ChildHandler<T,E extends Throwable>
-
-
Constructor Summary
Constructors Constructor Description AbstractMarkupWriter(String namespace, com.vladsch.flexmark.parser.ListOptions options, T stream)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description QName
asQName(String localName)
protected static String
collapseWhitespace(CharSequence text)
Normalize whitespace according to https://spec.commonmark.org/0.30/#code-spans.protected String
getNamespace()
protected com.vladsch.flexmark.parser.ListOptions
getOptions()
protected T
getStream()
protected void
visitChildren(com.vladsch.flexmark.util.ast.Node parentNode, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeBlockHtml(com.vladsch.flexmark.ast.HtmlBlock node)
void
writeBlockQuote(com.vladsch.flexmark.ast.BlockQuote node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeBreak(com.vladsch.flexmark.ast.HardLineBreak node)
void
writeBreak(com.vladsch.flexmark.ast.ThematicBreak node)
void
writeCode(com.vladsch.flexmark.ast.Code node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeCodeBlock(com.vladsch.flexmark.ast.CodeBlock node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeCodeBlock(com.vladsch.flexmark.ast.FencedCodeBlock node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeCodeBlock(com.vladsch.flexmark.ast.IndentedCodeBlock node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeComment(com.vladsch.flexmark.ast.HtmlCommentBlock node)
protected abstract void
writeComment(CharSequence text)
void
writeElement(QName qname, com.vladsch.flexmark.util.ast.Node node, Map<String,String> attributes, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeHeading(com.vladsch.flexmark.ast.Heading node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeHtmlEntity(com.vladsch.flexmark.ast.HtmlEntity node)
void
writeHtmlEntity(com.vladsch.flexmark.ext.typographic.TypographicSmarts node)
protected void
writeHtmlEntityInternal(String text)
void
writeImage(com.vladsch.flexmark.ast.Image node)
void
writeInlineHtml(com.vladsch.flexmark.ast.HtmlInline node)
void
writeInsertAnchor(InsertAnchorExtension.InsertAnchorNode node)
void
writeLink(com.vladsch.flexmark.ast.AutoLink node)
void
writeLink(com.vladsch.flexmark.ast.Link node, IMarkupWriter.ChildHandler<T,E> childHandler)
void
writeLink(com.vladsch.flexmark.ast.MailLink node)
void
writeList(QName qname, com.vladsch.flexmark.ast.ListBlock node, IMarkupWriter.ChildHandler<T,E> listItemHandler)
void
writeListItem(com.vladsch.flexmark.ast.ListItem node, IMarkupWriter.ChildHandler<T,E> listItemHandler)
void
writeParagraph(com.vladsch.flexmark.ast.Paragraph node, IMarkupWriter.ChildHandler<T,E> childHandler)
protected void
writePrecedingNewline(com.vladsch.flexmark.util.ast.Block node)
void
writeTable(com.vladsch.flexmark.ext.tables.TableBlock node, IMarkupWriter.ChildHandler<T,E> cellChildHandler)
void
writeText(com.vladsch.flexmark.ast.Text node)
void
writeText(com.vladsch.flexmark.ast.TextBase node)
Handle a combination ofText
andEscapedCharacter
node children.protected void
writeTrailingNewline(com.vladsch.flexmark.util.ast.Block node)
void
writeTypographicQuotes(com.vladsch.flexmark.ext.typographic.TypographicQuotes node, IMarkupWriter.ChildHandler<T,E> childHandler)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nist.secauto.metaschema.core.datatype.markup.flexmark.IMarkupWriter
writeElement, writeElement, writeElementEnd, writeElementStart, writeElementStart, writeEmptyElement, writeEmptyElement, writeList, writeText
-
-
-
-
Constructor Detail
-
AbstractMarkupWriter
public AbstractMarkupWriter(@NonNull String namespace, @NonNull com.vladsch.flexmark.parser.ListOptions options, T stream)
-
-
Method Detail
-
getNamespace
@NonNull protected String getNamespace()
-
getOptions
protected com.vladsch.flexmark.parser.ListOptions getOptions()
-
asQName
@NonNull public QName asQName(@NonNull String localName)
- Specified by:
asQName
in interfaceIMarkupWriter<T,E extends Throwable>
-
visitChildren
protected void visitChildren(@NonNull com.vladsch.flexmark.util.ast.Node parentNode, @NonNull IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
-
writePrecedingNewline
protected void writePrecedingNewline(@NonNull com.vladsch.flexmark.util.ast.Block node) throws E extends Throwable
-
writeTrailingNewline
protected void writeTrailingNewline(@NonNull com.vladsch.flexmark.util.ast.Block node) throws E extends Throwable
-
writeElement
public final void writeElement(QName qname, com.vladsch.flexmark.util.ast.Node node, Map<String,String> attributes, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeElement
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeText
public final void writeText(com.vladsch.flexmark.ast.Text node) throws E extends Throwable
-
writeText
public void writeText(@NonNull com.vladsch.flexmark.ast.TextBase node) throws E extends Throwable
Description copied from interface:IMarkupWriter
Handle a combination ofText
andEscapedCharacter
node children.
-
writeHtmlEntity
public void writeHtmlEntity(@NonNull com.vladsch.flexmark.ast.HtmlEntity node) throws E extends Throwable
- Specified by:
writeHtmlEntity
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeHtmlEntity
public void writeHtmlEntity(@NonNull com.vladsch.flexmark.ext.typographic.TypographicSmarts node) throws E extends Throwable
- Specified by:
writeHtmlEntity
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeHtmlEntityInternal
protected void writeHtmlEntityInternal(@NonNull String text) throws E extends Throwable
-
writeParagraph
public void writeParagraph(@NonNull com.vladsch.flexmark.ast.Paragraph node, @NonNull IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeParagraph
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeLink
public void writeLink(@NonNull com.vladsch.flexmark.ast.Link node, @NonNull IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
-
writeLink
public void writeLink(@NonNull com.vladsch.flexmark.ast.MailLink node) throws E extends Throwable
-
writeLink
public void writeLink(@NonNull com.vladsch.flexmark.ast.AutoLink node) throws E extends Throwable
-
writeTypographicQuotes
public final void writeTypographicQuotes(com.vladsch.flexmark.ext.typographic.TypographicQuotes node, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeTypographicQuotes
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeInlineHtml
public final void writeInlineHtml(com.vladsch.flexmark.ast.HtmlInline node) throws E extends Throwable
- Specified by:
writeInlineHtml
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeBlockHtml
public final void writeBlockHtml(com.vladsch.flexmark.ast.HtmlBlock node) throws E extends Throwable
- Specified by:
writeBlockHtml
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeTable
public final void writeTable(com.vladsch.flexmark.ext.tables.TableBlock node, IMarkupWriter.ChildHandler<T,E> cellChildHandler) throws E extends Throwable
- Specified by:
writeTable
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeImage
public void writeImage(@NonNull com.vladsch.flexmark.ast.Image node) throws E extends Throwable
- Specified by:
writeImage
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeInsertAnchor
public void writeInsertAnchor(@NonNull InsertAnchorExtension.InsertAnchorNode node) throws E extends Throwable
- Specified by:
writeInsertAnchor
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeHeading
public void writeHeading(@NonNull com.vladsch.flexmark.ast.Heading node, @NonNull IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeHeading
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
collapseWhitespace
@NonNull protected static String collapseWhitespace(@NonNull CharSequence text)
Normalize whitespace according to https://spec.commonmark.org/0.30/#code-spans. Based on code from Flexmark.- Parameters:
text
- text to process- Returns:
- the normalized text
-
writeCode
public void writeCode(com.vladsch.flexmark.ast.Code node, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
-
writeCodeBlock
public final void writeCodeBlock(com.vladsch.flexmark.ast.IndentedCodeBlock node, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeCodeBlock
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeCodeBlock
public final void writeCodeBlock(com.vladsch.flexmark.ast.FencedCodeBlock node, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeCodeBlock
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeCodeBlock
public void writeCodeBlock(com.vladsch.flexmark.ast.CodeBlock node, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeCodeBlock
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeBlockQuote
public void writeBlockQuote(com.vladsch.flexmark.ast.BlockQuote node, IMarkupWriter.ChildHandler<T,E> childHandler) throws E extends Throwable
- Specified by:
writeBlockQuote
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeList
public void writeList(QName qname, com.vladsch.flexmark.ast.ListBlock node, IMarkupWriter.ChildHandler<T,E> listItemHandler) throws E extends Throwable
-
writeListItem
public void writeListItem(com.vladsch.flexmark.ast.ListItem node, IMarkupWriter.ChildHandler<T,E> listItemHandler) throws E extends Throwable
- Specified by:
writeListItem
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeBreak
public void writeBreak(com.vladsch.flexmark.ast.HardLineBreak node) throws E extends Throwable
- Specified by:
writeBreak
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeBreak
public void writeBreak(com.vladsch.flexmark.ast.ThematicBreak node) throws E extends Throwable
- Specified by:
writeBreak
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeComment
public void writeComment(com.vladsch.flexmark.ast.HtmlCommentBlock node) throws E extends Throwable
- Specified by:
writeComment
in interfaceIMarkupWriter<T,E extends Throwable>
- Throws:
E extends Throwable
-
writeComment
protected abstract void writeComment(@NonNull CharSequence text) throws E extends Throwable
-
-