mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtracts
synced 2024-11-24 00:04:35 +00:00
Merge "ExtractFormatter: Update for HtmlFormatter 4.0.0"
This commit is contained in:
commit
84266ef050
|
@ -44,7 +44,7 @@ class ExtractFormatter extends HtmlFormatter {
|
||||||
* Ignored
|
* Ignored
|
||||||
* @return string Processed HTML
|
* @return string Processed HTML
|
||||||
*/
|
*/
|
||||||
public function getText( $element = null ) {
|
public function getText( $element = null ): string {
|
||||||
$this->filterContent();
|
$this->filterContent();
|
||||||
$text = parent::getText();
|
$text = parent::getText();
|
||||||
if ( $this->plainText ) {
|
if ( $this->plainText ) {
|
||||||
|
@ -63,7 +63,7 @@ class ExtractFormatter extends HtmlFormatter {
|
||||||
* @param string $html HTML string to process
|
* @param string $html HTML string to process
|
||||||
* @return string Processed HTML
|
* @return string Processed HTML
|
||||||
*/
|
*/
|
||||||
public function onHtmlReady( $html ) {
|
public function onHtmlReady( string $html ): string {
|
||||||
if ( $this->plainText ) {
|
if ( $this->plainText ) {
|
||||||
$html = preg_replace( '/\s*(<h([1-6])\b)/i',
|
$html = preg_replace( '/\s*(<h([1-6])\b)/i',
|
||||||
"\n\n" . self::SECTION_MARKER_START . '$2' . self::SECTION_MARKER_END . '$1',
|
"\n\n" . self::SECTION_MARKER_START . '$2' . self::SECTION_MARKER_END . '$1',
|
||||||
|
@ -79,7 +79,7 @@ class ExtractFormatter extends HtmlFormatter {
|
||||||
*
|
*
|
||||||
* @return array Array of removed DOMElements
|
* @return array Array of removed DOMElements
|
||||||
*/
|
*/
|
||||||
public function filterContent() {
|
public function filterContent(): array {
|
||||||
$removed = parent::filterContent();
|
$removed = parent::filterContent();
|
||||||
|
|
||||||
$doc = $this->getDoc();
|
$doc = $this->getDoc();
|
||||||
|
|
Loading…
Reference in a new issue