|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage
public abstract class MarkupLanguage
A markup language, which knows its formatting rules and is able to process content based on Block
,
PatternBasedElementProcessor
and PatternBasedElement
concepts. All markup languages supported by
WikiText extend this class.
The MarkupLanguage class provides basic functionality for determining which blocks process which markup content in a particular document. In general multi-line documents are split into consecutive regions called blocks, and each line in a block is processed with spanning sections called phrase modifiers, and tokens within a span are replaced with their respective replacement tokens. These rules apply to most lightweight markup languages, however subclasses may override this default functionality if required. For example, by default phrase modifiers are non-overlapping and non-nested, however if required a subclass could permit such nesting.
Generally markup language classes are not accessed directly by client code, instead client code should configure and
call MarkupParser
, accessing the markup language by name using the ServiceLocator
.
Nested Class Summary | |
---|---|
static class |
MarkupLanguage.PatternBasedSyntax
|
Field Summary | |
---|---|
protected MarkupLanguageConfiguration |
configuration
|
protected String |
internalLinkPattern
|
Constructor Summary | |
---|---|
MarkupLanguage()
|
Method Summary | |
---|---|
MarkupLanguage |
clone()
|
void |
configure(MarkupLanguageConfiguration configuration)
configure the markup language with a configuration that may alter the language syntax and capabilities. |
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,
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,
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,
String text)
Emit markup that may contain replacement tokens but no phrase or block modifiers. |
abstract List<Block> |
getBlocks()
|
String |
getExtendsLanguage()
The name of the markup language that is extended by this one |
IdGenerationStrategy |
getIdGenerationStrategy()
get the id strategy employed by this markup language. |
String |
getInternalLinkPattern()
The pattern to use when creating hyperlink targets for internal links. |
String |
getName()
The name of the markup language, typically the same as the name of the markup language supported by this markup language. |
protected abstract MarkupLanguage.PatternBasedSyntax |
getPhraseModifierSyntax()
|
protected abstract MarkupLanguage.PatternBasedSyntax |
getReplacementTokenSyntax()
|
protected abstract void |
initializeSyntax()
initialize the syntax of the markup language. |
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(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,
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 |
setExtendsLanguage(String extendsLanguage)
The name of the markup language that is extended by this one |
void |
setFilterGenerativeContents(boolean filterGenerativeBlocks)
Indicate if table of contents should be filtered. |
void |
setInternalLinkPattern(String internalLinkPattern)
The pattern to use when creating hyperlink targets for internal links. |
void |
setName(String name)
The name of the markup language, typically the same as the name of the markup language supported by this markup language. |
Block |
startBlock(String line,
int lineOffset)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String internalLinkPattern
protected MarkupLanguageConfiguration configuration
Constructor Detail |
---|
public MarkupLanguage()
Method Detail |
---|
public MarkupLanguage clone()
clone
in class Object
protected ContentState createState()
public IdGenerationStrategy getIdGenerationStrategy()
public void processContent(MarkupParser parser, String markupContent, boolean asDocument)
public Block startBlock(String line, int lineOffset)
public abstract List<Block> getBlocks()
public void configure(MarkupLanguageConfiguration configuration) throws UnsupportedOperationException
configuration
- the configuration to use
UnsupportedOperationException
- markup languages that do not support configuration must throw this exception.protected abstract void initializeSyntax()
public void emitMarkupLine(MarkupParser parser, ContentState state, int textLineOffset, 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, String line, int offset)
parser
- state
- line
- offset
- public void emitMarkupText(MarkupParser parser, ContentState state, String text)
parser
- state
- text
- protected abstract MarkupLanguage.PatternBasedSyntax getPhraseModifierSyntax()
protected abstract MarkupLanguage.PatternBasedSyntax getReplacementTokenSyntax()
public String getName()
public void setName(String name)
name
- the namepublic String getExtendsLanguage()
public void setExtendsLanguage(String extendsLanguage)
extendsLanguage
- the name, or null if this markup language does not extend another.public boolean isFilterGenerativeContents()
OutlineParser
.
public void setFilterGenerativeContents(boolean filterGenerativeBlocks)
OutlineParser
.
public boolean isBlocksOnly()
public void setBlocksOnly(boolean blocksOnly)
public boolean isEmptyLine(String line)
line
- the line content
public String getInternalLinkPattern()
MessageFormat
, where the 0th parameter is the internal
link.
MessageFormat
public void setInternalLinkPattern(String internalLinkPattern)
MessageFormat
, where the 0th parameter is the internal
link.
MessageFormat
public boolean isDetectingRawHyperlinks()
ImpliedHyperlinkReplacementToken
and returns
true if it is in the syntax.
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 false
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |