public abstract class AbstractMarkupDocumentBuilder extends DocumentBuilder
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractMarkupDocumentBuilder.Block
Represents a block or section of the document.
|
protected class |
AbstractMarkupDocumentBuilder.ImplicitParagraphBlock
a block that provides default paragraph functionality, for emitting content when no explicit block has been
opened.
|
protected class |
AbstractMarkupDocumentBuilder.NewlineDelimitedBlock
A block that is delimited by newlines.
|
protected class |
AbstractMarkupDocumentBuilder.SuffixBlock
a block that outputs a suffix when it's closed
|
DocumentBuilder.BlockType, DocumentBuilder.SpanType
Modifier and Type | Field and Description |
---|---|
protected AbstractMarkupDocumentBuilder.Block |
currentBlock |
locator
Modifier | Constructor and Description |
---|---|
protected |
AbstractMarkupDocumentBuilder(java.io.Writer out) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertOpenBlock() |
void |
beginBlock(DocumentBuilder.BlockType type,
Attributes attributes)
Begin a block of the specified type.
|
void |
beginDocument()
Begin a document.
|
void |
beginHeading(int level,
Attributes attributes)
Begin a heading of the specified level (usually 1-6).
|
void |
beginSpan(DocumentBuilder.SpanType type,
Attributes attributes)
Begin a span of the specified type.
|
void |
charactersUnescaped(java.lang.String literal)
Create unescaped characters, usually with some embedded HTML markup.
|
protected void |
clearRequireAdjacentSeparator() |
protected abstract AbstractMarkupDocumentBuilder.Block |
computeBlock(DocumentBuilder.BlockType type,
Attributes attributes) |
protected DocumentBuilder.BlockType |
computeCurrentListType() |
protected abstract AbstractMarkupDocumentBuilder.Block |
computeHeading(int level,
Attributes attributes) |
protected int |
computeListLevel() |
protected java.lang.String |
computePrefix(char c,
int count) |
protected abstract AbstractMarkupDocumentBuilder.Block |
computeSpan(DocumentBuilder.SpanType type,
Attributes attributes) |
protected AbstractMarkupDocumentBuilder.Block |
createImplicitParagraphBlock()
Creates paragraph blocks in cases where content is emitted but no block is currently open.
|
protected void |
emitContent(int c) |
protected void |
emitContent(java.lang.String str)
Emits the given string
|
void |
endBlock()
End a block that was
started . |
void |
endDocument()
End a document.
|
void |
endHeading()
End a span that was
started . |
void |
endSpan()
End a span that was
started . |
void |
flush()
Flushes the content of the builder.
|
protected char |
getLastChar()
get the last character that was emitted, or 0 if no character has been written.
|
protected int |
getTrailingNewlineCount()
Provides the number of trailing newlines that were emitted, or 0 if no trailing newlines were written.
|
protected boolean |
isSeparator(int i) |
protected int |
normalizeWhitespace(int c) |
protected java.lang.String |
normalizeWhitespace(java.lang.String s) |
protected java.io.Writer |
popWriter() |
protected void |
pushWriter(java.io.Writer writer)
Subclasses may push a writer in order to intercept emitted content.
|
protected void |
requireAdjacentSeparator()
Indicate that the next content to be emitted requires adjacent
separator . |
acronym, characters, entityReference, getLocator, horizontalRule, image, imageLink, imageLink, imageLink, lineBreak, link, link, setLocator
protected AbstractMarkupDocumentBuilder.Block currentBlock
protected AbstractMarkupDocumentBuilder(java.io.Writer out)
protected void emitContent(int c) throws java.io.IOException
java.io.IOException
protected void emitContent(java.lang.String str) throws java.io.IOException
str
- the string to emit, or nulljava.io.IOException
- if the writer throws an IOExceptionprotected void requireAdjacentSeparator()
separator
. When
invoked, the next call to emitContent(int)
or emitContent(String)
will test to see if the
last character
is a separator character, or if the content to be emitted starts with a
separator. If neither are true, then a single space character is inserted into the content stream. Subsequent
calls to emitContent
are not affected.clearRequireAdjacentSeparator()
protected void clearRequireAdjacentSeparator()
requireAdjacentSeparator()
protected boolean isSeparator(int i)
public void beginDocument()
DocumentBuilder
DocumentBuilder.endDocument()
.beginDocument
in class DocumentBuilder
DocumentBuilder.endDocument()
public void endDocument()
DocumentBuilder
endDocument
in class DocumentBuilder
DocumentBuilder.beginDocument()
,
DocumentBuilder.flush()
public void flush()
DocumentBuilder
DocumentBuilder.flush()
should be called when done with a builder in cases where
DocumentBuilder.endDocument()
is not called. Calling DocumentBuilder.flush()
after DocumentBuilder.endDocument()
has no effect.
Subclasses should override to provide behaviour; the default implementation does nothing.
flush
in class DocumentBuilder
protected void pushWriter(java.io.Writer writer)
popWriter()
.popWriter()
protected java.io.Writer popWriter()
pushWriter(Writer)
protected char getLastChar()
protected int getTrailingNewlineCount()
public void beginBlock(DocumentBuilder.BlockType type, Attributes attributes)
DocumentBuilder
Attributes
class, in which case
the builder may attempt to apply the attributes specified. Builders may choose to ignore attributes, and should
fail silently if the given attributes are not as expected. Each call to this method must be matched by a
corresponding call to DocumentBuilder.endBlock()
.beginBlock
in class DocumentBuilder
attributes
- the attributes to apply to the block. Callers may choose to specify a more specialized set of
attributes by providing a subclass instance.DocumentBuilder.endBlock()
protected abstract AbstractMarkupDocumentBuilder.Block computeBlock(DocumentBuilder.BlockType type, Attributes attributes)
public void beginSpan(DocumentBuilder.SpanType type, Attributes attributes)
DocumentBuilder
DocumentBuilder.endSpan()
.beginSpan
in class DocumentBuilder
attributes
- the attributes to apply to the spanDocumentBuilder.endSpan()
protected abstract AbstractMarkupDocumentBuilder.Block computeSpan(DocumentBuilder.SpanType type, Attributes attributes)
public void endSpan()
DocumentBuilder
started
.endSpan
in class DocumentBuilder
#beginSpan(org.eclipse.mylyn.wikitext.parser.DocumentBuilder.SpanType, Attributes)
protected java.lang.String computePrefix(char c, int count)
protected int computeListLevel()
protected DocumentBuilder.BlockType computeCurrentListType()
public void endBlock()
DocumentBuilder
started
.endBlock
in class DocumentBuilder
public void beginHeading(int level, Attributes attributes)
DocumentBuilder
DocumentBuilder.endHeading()
.beginHeading
in class DocumentBuilder
level
- the level of the heading, usually 1-6attributes
- the attributes to apply to the headingDocumentBuilder.endHeading()
public void endHeading()
DocumentBuilder
started
.endHeading
in class DocumentBuilder
DocumentBuilder.beginHeading(int, Attributes)
protected abstract AbstractMarkupDocumentBuilder.Block computeHeading(int level, Attributes attributes)
protected void assertOpenBlock()
public void charactersUnescaped(java.lang.String literal)
DocumentBuilder
charactersUnescaped
in class DocumentBuilder
literal
- the literal characters to emitprotected int normalizeWhitespace(int c)
protected java.lang.String normalizeWhitespace(java.lang.String s)
protected AbstractMarkupDocumentBuilder.Block createImplicitParagraphBlock()
Copyright © 2007, 2013 David Green and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html