Class odf.WordBoundaryFilter
Defined in: WordBoundaryFilter.js.
Constructor Attributes | Constructor Name and Description |
---|---|
odf.WordBoundaryFilter(odtDocument, includeWhitespace)
A filter that allows a position if it is in front of a word, picture etc.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
odf.WordBoundaryFilter.IncludeWhitespace
Type of whitespace to include within the word boundary
|
Method Attributes | Method Name and Description |
---|---|
acceptPosition(iterator)
|
|
<inner> |
findHigherNeighborNode(node, direction, nodeFilter)
Returns the first filtered sibling ecountered while travelling up the dom from node until
before the documentRoot - or null if none is found.
|
<inner> |
typeOfNeighbor(node, getOffset)
|
Class Detail
odf.WordBoundaryFilter(odtDocument, includeWhitespace)
A filter that allows a position if it is in front of a word, picture etc.
Word boundaries are detected by the presence of punctuation as defined in the unicode standard.
The included UTF categories are:
- Pc (connector punctuation)
- Pd (dash punctuation)
- Pe (close punctuation)
- Pf (final punctuation)
- Pi (initial punctuation)
- Po (other punctuation)
- Ps (Open punctuation)
In addition, the following ranges are also included as boundaries:
- 2000-206F (general punctuation)
- 2E00-2E7F (supplemental punctuation)
- 3000-303F (CJK symbols and punctuation)
- 12400-1247F (cuneiform numbers and punctuation)
Some libraries and sites exist for assisting in creation of the regex. The one
used for this particular expression was http://apps.timwhitlock.info/js/regex
which is based on the cset javascript library
(http://inimino.org/~inimino/blog/javascript_cset).
- Parameters:
- {!ops.OdtDocument} odtDocument
- {!odf.WordBoundaryFilter.IncludeWhitespace} includeWhitespace
- Specify the type of whitespace to include within the word boundary. TRAILING causes the accepted position to be after the whitespace trailing a word, while LEADING causes the accepted position to be just after the word boundary (but before the trailing whitespace).
Field Detail
<static>
odf.WordBoundaryFilter.IncludeWhitespace
Type of whitespace to include within the word boundary
Method Detail
{!core.PositionFilter.FilterResult}
acceptPosition(iterator)
- Parameters:
- {!core.PositionIterator} iterator
- Returns:
- {!core.PositionFilter.FilterResult}
<inner>
{?Node}
findHigherNeighborNode(node, direction, nodeFilter)
Returns the first filtered sibling ecountered while travelling up the dom from node until
before the documentRoot - or null if none is found.
- Parameters:
- {?Node} node
- {!number} direction
- look for a left sibling when negative - for a right sibling otherwise
- {!function(?Node):!number} nodeFilter
- Returns:
- {?Node}
<inner>
{!NeighborType}
typeOfNeighbor(node, getOffset)
- Parameters:
- {?Node} node
- {!function():!number} getOffset
- returns the offset inside the node
- Returns:
- {!NeighborType}