protected function TruncateHTML::removeTrailingPunctuation in Smart Trim 8
Removes certain punctuation from the end of the node value.
Parameters
\DOMNode $domnode: Node to be altered.
2 calls to TruncateHTML::removeTrailingPunctuation()
- TruncateHTML::domNodeTruncateChars in src/
Truncate/ TruncateHTML.php - Truncates a DOMNode by character count.
- TruncateHTML::domNodeTruncateWords in src/
Truncate/ TruncateHTML.php - Truncates a DOMNode by words.
File
- src/
Truncate/ TruncateHTML.php, line 248 - Contains trim functionality.
Class
- TruncateHTML
- Class TruncateHTML.
Namespace
Drupal\smart_trim\TruncateCode
protected function removeTrailingPunctuation(\DOMNode $domnode) {
while (preg_match('/[\\.,:;\\?!…]$/', $domnode->nodeValue)) {
$domnode->nodeValue = substr($domnode->nodeValue, 0, -1);
}
}