mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtracts
synced 2024-11-27 09:30:09 +00:00
ExtractFormatter: Update for HtmlFormatter 4.0.0
Bug: T330528 Depends-On: Id785cfd2e00762ca6c1ea80200dd4a3d197640f2 Change-Id: I496d84fab3ee8feee5891ca984f37e90837d857c
This commit is contained in:
parent
71e31619f2
commit
47172479bb
|
@ -44,7 +44,7 @@ class ExtractFormatter extends HtmlFormatter {
|
|||
* Ignored
|
||||
* @return string Processed HTML
|
||||
*/
|
||||
public function getText( $element = null ) {
|
||||
public function getText( $element = null ): string {
|
||||
$this->filterContent();
|
||||
$text = parent::getText();
|
||||
if ( $this->plainText ) {
|
||||
|
@ -63,7 +63,7 @@ class ExtractFormatter extends HtmlFormatter {
|
|||
* @param string $html HTML string to process
|
||||
* @return string Processed HTML
|
||||
*/
|
||||
public function onHtmlReady( $html ) {
|
||||
public function onHtmlReady( string $html ): string {
|
||||
if ( $this->plainText ) {
|
||||
$html = preg_replace( '/\s*(<h([1-6])\b)/i',
|
||||
"\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
|
||||
*/
|
||||
public function filterContent() {
|
||||
public function filterContent(): array {
|
||||
$removed = parent::filterContent();
|
||||
|
||||
$doc = $this->getDoc();
|
||||
|
|
Loading…
Reference in a new issue