public abstract class AbstractMarkupLanguage extends MarkupLanguage
Modifier and Type | Class and Description |
---|---|
static class |
AbstractMarkupLanguage.PatternBasedSyntax |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Block> |
blocks |
protected MarkupLanguageConfiguration |
configuration |
protected java.lang.String |
internalLinkPattern |
protected java.util.List<Block> |
paragraphBreakingBlocks |
protected AbstractMarkupLanguage.PatternBasedSyntax |
phraseModifierSyntax |
protected AbstractMarkupLanguage.PatternBasedSyntax |
tokenSyntax |
Constructor and Description |
---|
AbstractMarkupLanguage() |
Modifier and Type | Method and Description |
---|---|
protected void |
addBlockExtensions(java.util.List<Block> blocks,
java.util.List<Block> paragraphBreakingBlocks)
subclasses may override this method to add blocks to the language.
|
protected void |
addPhraseModifierExtensions(AbstractMarkupLanguage.PatternBasedSyntax phraseModifierSyntax)
subclasses may override this method to add phrases to the language.
|
protected abstract void |
addStandardBlocks(java.util.List<Block> blocks,
java.util.List<Block> paragraphBreakingBlocks) |
protected abstract void |
addStandardPhraseModifiers(AbstractMarkupLanguage.PatternBasedSyntax phraseModifierSyntax) |
protected abstract void |
addStandardTokens(AbstractMarkupLanguage.PatternBasedSyntax tokenSyntax) |
protected void |
addTokenExtensions(AbstractMarkupLanguage.PatternBasedSyntax tokenSyntax)
subclasses may override this method to add tokens to the language.
|
protected void |
clearLanguageSyntax() |
MarkupLanguage |
clone() |
void |
configure(MarkupLanguageConfiguration configuration)
configure the markup language with a configuration that may alter the language syntax and capabilities.
|
protected abstract Block |
createParagraphBlock() |
protected ContentState |
createState()
Create new state for tracking a document and its contents during a parse session.
|
void |
emitMarkupLine(MarkupParser parser,
ContentState state,
int textLineOffset,
java.lang.String line,
int offset)
Emit a markup line that may contain phrase modifiers and replacement tokens, but no block modifiers.
|
void |
emitMarkupLine(MarkupParser parser,
ContentState state,
java.lang.String line,
int offset)
Emit a markup line that may contain phrase modifiers and replacement tokens, but no block modifiers.
|
void |
emitMarkupText(MarkupParser parser,
ContentState state,
java.lang.String text)
Emit markup that may contain replacement tokens but no phrase or block modifiers.
|
java.util.List<Block> |
getBlocks() |
java.lang.String |
getInternalLinkPattern()
The pattern to use when creating hyperlink targets for internal links.
|
java.util.List<Block> |
getParagraphBreakingBlocks() |
protected AbstractMarkupLanguage.PatternBasedSyntax |
getPhraseModifierSyntax() |
protected AbstractMarkupLanguage.PatternBasedSyntax |
getReplacementTokenSyntax() |
protected void |
initializeBlocks() |
protected void |
initializePhraseModifiers() |
protected void |
initializeTokens() |
boolean |
isBlocksOnly()
indicate if the parser should detect blocks only.
|
boolean |
isDetectingRawHyperlinks()
Indicate if this markup language detects 'raw' hyperlinks; that is hyperlinks without any special markup.
|
boolean |
isEmptyLine(java.lang.String line)
indicate if the given line is considered 'empty'.
|
boolean |
isEnableMacros()
Indicate if macro processing is enabled.
|
boolean |
isFilterGenerativeContents()
Indicate if generative contents should be filtered.
|
void |
processContent(MarkupParser parser,
java.lang.String markupContent,
boolean asDocument) |
void |
setBlocksOnly(boolean blocksOnly)
indicate if the parser should detect blocks only.
|
void |
setEnableMacros(boolean enableMacros)
Indicate if macro processing is enabled.
|
void |
setFilterGenerativeContents(boolean filterGenerativeBlocks)
Indicate if table of contents should be filtered.
|
void |
setInternalLinkPattern(java.lang.String internalLinkPattern)
The pattern to use when creating hyperlink targets for internal links.
|
Block |
startBlock(java.lang.String line,
int lineOffset) |
createDocumentBuilder, createDocumentBuilder, getExtendsLanguage, getFileExtensions, getIdGenerationStrategy, getName, setExtendsLanguage, setFileExtensions, setName
protected java.util.List<Block> blocks
protected java.util.List<Block> paragraphBreakingBlocks
protected AbstractMarkupLanguage.PatternBasedSyntax tokenSyntax
protected AbstractMarkupLanguage.PatternBasedSyntax phraseModifierSyntax
protected MarkupLanguageConfiguration configuration
protected java.lang.String internalLinkPattern
public void configure(MarkupLanguageConfiguration configuration) throws java.lang.UnsupportedOperationException
MarkupLanguage
configure
in class MarkupLanguage
configuration
- the configuration to usejava.lang.UnsupportedOperationException
- markup languages that do not support configuration must throw this exception.protected ContentState createState()
public void processContent(MarkupParser parser, java.lang.String markupContent, boolean asDocument)
processContent
in class MarkupLanguage
public Block startBlock(java.lang.String line, int lineOffset)
public boolean isEmptyLine(java.lang.String line)
line
- the line contentpublic void emitMarkupLine(MarkupParser parser, ContentState state, int textLineOffset, java.lang.String line, int offset)
parser
- state
- textLineOffset
- the offset of the provided text in the current lineline
- the text to processoffset
- the offset in the text
at which processing should beginpublic void emitMarkupLine(MarkupParser parser, ContentState state, java.lang.String line, int offset)
parser
- state
- line
- offset
- public void emitMarkupText(MarkupParser parser, ContentState state, java.lang.String text)
parser
- state
- text
- public java.util.List<Block> getBlocks()
public final java.util.List<Block> getParagraphBreakingBlocks()
protected void clearLanguageSyntax()
protected final void initializeTokens()
protected final void initializePhraseModifiers()
protected final void initializeBlocks()
protected abstract void addStandardTokens(AbstractMarkupLanguage.PatternBasedSyntax tokenSyntax)
protected abstract void addStandardPhraseModifiers(AbstractMarkupLanguage.PatternBasedSyntax phraseModifierSyntax)
protected abstract void addStandardBlocks(java.util.List<Block> blocks, java.util.List<Block> paragraphBreakingBlocks)
protected abstract Block createParagraphBlock()
protected void addBlockExtensions(java.util.List<Block> blocks, java.util.List<Block> paragraphBreakingBlocks)
super.addBlockExtensions(blocks,paragraphBreakingBlocks)
if the default language extensions are
desired.blocks
- the list of blocks to which extensions may be addedparagraphBreakingBlocks
- the list of blocks that end a paragraphprotected void addTokenExtensions(AbstractMarkupLanguage.PatternBasedSyntax tokenSyntax)
super.addTokenExtensions(tokenSyntax)
if the default language extensions are desired.tokenSyntax
- the token syntaxprotected void addPhraseModifierExtensions(AbstractMarkupLanguage.PatternBasedSyntax phraseModifierSyntax)
super.addPhraseModifierExtensions(phraseModifierSyntax)
if the default language extensions are
desired.phraseModifierSyntax
- the phrase modifier syntaxpublic boolean isDetectingRawHyperlinks()
ImpliedHyperlinkReplacementToken
and returns
true if it is in the syntax.protected AbstractMarkupLanguage.PatternBasedSyntax getPhraseModifierSyntax()
protected AbstractMarkupLanguage.PatternBasedSyntax getReplacementTokenSyntax()
public boolean isFilterGenerativeContents()
OutlineParser
.public void setFilterGenerativeContents(boolean filterGenerativeBlocks)
OutlineParser
.public boolean isBlocksOnly()
public void setBlocksOnly(boolean blocksOnly)
public java.lang.String getInternalLinkPattern()
MessageFormat
, where the 0th parameter is the internal
link.MessageFormat
public void setInternalLinkPattern(java.lang.String internalLinkPattern)
MessageFormat
, where the 0th parameter is the internal
link.MessageFormat
public boolean isEnableMacros()
Macros are defined as text substitution prior to normal processing. Such preprocessing changes the markup before it is processed, and as such has the side-effect of changing computed offsets when parsing markup.
The default value is true.
public void setEnableMacros(boolean enableMacros)
Macros are defined as text substitution prior to normal processing. Such preprocessing changes the markup before it is processed, and as such has the side-effect of changing computed offsets when parsing markup.
enableMacros
- true if macros are enabled, otherwise falsepublic MarkupLanguage clone()
clone
in class MarkupLanguage
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