Class TextParser
java.lang.Object
org.apache.maven.doxia.module.twiki.parser.TextParser
Parse almost plain text in search of WikiWords, links, ...
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Patternanchor nameprivate static final Patternpattern to detect ForcedLinks links [[reference asd]]private static final PatternHTML tag patternprivate static final Patternimage pattern specificationprivate static final Patternimage tag pattern specification (used for images at relative URLs)private booleanresolves noautolink tagprivate static final Patternpattern to detect SpecificLinks links [[reference][text]]private static final Patternurl wordprivate static final Patternpattern to detect WikiWordsprivate final WikiWordLinkResolverresolves wikiWordLinks -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BlockcreateLink(String link, String showText) Decides between a WikiWordBlock or a a LinkBlockprivate booleanendLikeWord(Matcher m, String line) private booleanprivate booleanisSpace(char c) parse.private voidparseAnchor(String line, List<Block> ret, Matcher anchorMatcher) Parses the anchorprivate voidparseForcedLink(String line, List<Block> ret, Matcher forcedLinkMatcher) Parses the linkprivate voidparseImage(String line, List<Block> ret, Matcher imageTagMatcher) Parses the image tagprivate voidParses a linkprivate voidParses the urlprivate voidParses a wiki wordprivate voidparseXHTML(String line, List<Block> ret, Matcher xhtmlMatcher) Parses xhtml.private booleanstartLikeWord(Matcher m, String line)
-
Field Details
-
WIKIWORD_PATTERN
pattern to detect WikiWords -
SPECIFICLINK_PATTERN
pattern to detect SpecificLinks links [[reference][text]] -
FORCEDLINK_PATTERN
pattern to detect ForcedLinks links [[reference asd]] -
ANCHOR_PATTERN
anchor name -
URL_PATTERN
url word -
IMAGE_PATTERN
image pattern specification -
IMAGE_TAG_PATTERN
image tag pattern specification (used for images at relative URLs) -
HTML_TAG_PATTERN
HTML tag pattern -
wikiWordLinkResolver
resolves wikiWordLinks -
noautolink
private boolean noautolinkresolves noautolink tag
-
-
Constructor Details
-
TextParser
Creates the TextParser.- Parameters:
resolver- resolver for wikiWord links
-
-
Method Details
-
parse
parse.
- Parameters:
line- line to parse- Returns:
- a list of block that represents the input
-
parseImage
Parses the image tag- Parameters:
line- the line to parseret- where the results liveimageTagMatcher- image tag matcher
-
parseUrl
Parses the url- Parameters:
line- the line to parseret- where the results liveurlMatcher- url matcher
-
parseAnchor
Parses the anchor- Parameters:
line- the line to parseret- where the results liveanchorMatcher- anchor matcher
-
parseForcedLink
Parses the link- Parameters:
line- line to parseret- where the results liveforcedLinkMatcher- forced link matcher
-
createLink
Decides between a WikiWordBlock or a a LinkBlock- Parameters:
link- the link textshowText- the show text.- Returns:
- either a WikiWordBlock or a LinkBlock
-
parseWiki
Parses a wiki word- Parameters:
line- the line to parseret- where the results livewikiMatcher- wiki matcher
-
parseLink
Parses a link- Parameters:
line- the line to parseret- where the results livelinkMatcher- link matcher
-
parseXHTML
Parses xhtml.- Parameters:
line- the line to parseret- where the results livexhtmlMatcher- xhtml matcher
-
isAWord
- Parameters:
m- matcher to testline- line to test- Returns:
trueif the match on m represent a word (must be a space before the word or must be the beginning of the line)
-
startLikeWord
- Parameters:
m- matcher to testline- line to test- Returns:
- true if it is the beginning of a word
-
endLikeWord
- Parameters:
m- matcher to testline- line to test- Returns:
- true if it is the end of a word
-
isSpace
private boolean isSpace(char c) - Parameters:
c- char to test- Returns:
trueif c is a space char
-