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 Pattern
anchor nameprivate static final Pattern
pattern to detect ForcedLinks links [[reference asd]]private static final Pattern
HTML tag patternprivate static final Pattern
image pattern specificationprivate static final Pattern
image tag pattern specification (used for images at relative URLs)private boolean
resolves noautolink tagprivate static final Pattern
pattern to detect SpecificLinks links [[reference][text]]private static final Pattern
url wordprivate static final Pattern
pattern to detect WikiWordsprivate final WikiWordLinkResolver
resolves wikiWordLinks -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Block
createLink
(String link, String showText) Decides between a WikiWordBlock or a a LinkBlockprivate boolean
endLikeWord
(Matcher m, String line) private boolean
private boolean
isSpace
(char c) parse.private void
parseAnchor
(String line, List<Block> ret, Matcher anchorMatcher) Parses the anchorprivate void
parseForcedLink
(String line, List<Block> ret, Matcher forcedLinkMatcher) Parses the linkprivate void
parseImage
(String line, List<Block> ret, Matcher imageTagMatcher) Parses the image tagprivate void
Parses a linkprivate void
Parses the urlprivate void
Parses a wiki wordprivate void
parseXHTML
(String line, List<Block> ret, Matcher xhtmlMatcher) Parses xhtml.private boolean
startLikeWord
(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:
true
if 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:
true
if c is a space char
-