MediaWiki
1.34.0
|
This class needs to understand HTML as well as plain text. More...
Public Member Functions | |
__construct (TidyDriverBase $tidy=null) | |
getFirstChars ( $text, $requestedLength) | |
Returns no more than a requested number of characters, preserving words. More... | |
getFirstSentences ( $text, $requestedSentenceCount) | |
Returns no more than the given number of sentences. More... | |
Private Member Functions | |
tidy ( $text) | |
Private Attributes | |
TidyDriverBase null | $tidyDriver |
This class needs to understand HTML as well as plain text.
It tries to not break HTML tags, but might break pairs of tags, leaving unclosed tags behind. A Tidy instance must be provided to fix this.
Definition at line 14 of file TextTruncator.php.
TextExtracts\TextTruncator::__construct | ( | TidyDriverBase | $tidy = null | ) |
TidyDriverBase | null | $tidy |
Definition at line 24 of file TextTruncator.php.
TextExtracts\TextTruncator::getFirstChars | ( | $text, | |
$requestedLength | |||
) |
Returns no more than a requested number of characters, preserving words.
string | $text | Source text to extract from |
int | $requestedLength | Maximum number of characters to return |
Definition at line 79 of file TextTruncator.php.
TextExtracts\TextTruncator::getFirstSentences | ( | $text, | |
$requestedSentenceCount | |||
) |
Returns no more than the given number of sentences.
string | $text | Source text to extract from |
int | $requestedSentenceCount | Maximum number of sentences to extract |
Definition at line 35 of file TextTruncator.php.
|
private |
|
private |
Definition at line 19 of file TextTruncator.php.