MediaWiki master
WikiTextStructure Class Reference

Class allowing to explore the structure of parsed wikitext. More...

Public Member Functions

 __construct (ParserOutput $parserOutput)
 
 getAuxiliaryText ()
 
 getDefaultSort ()
 Get the "defaultsort" property.
 
 getMainText ()
 
 getOpeningText ()
 
 headings ()
 Gets headings from the page.
 

Static Public Member Functions

static parseSettingsInMessage ( $message)
 Parse a message content into an array.
 

Detailed Description

Class allowing to explore the structure of parsed wikitext.

Definition at line 10 of file WikiTextStructure.php.

Constructor & Destructor Documentation

◆ __construct()

WikiTextStructure::__construct ( ParserOutput  $parserOutput)
Parameters
ParserOutput$parserOutput

Definition at line 61 of file WikiTextStructure.php.

Member Function Documentation

◆ getAuxiliaryText()

WikiTextStructure::getAuxiliaryText ( )
Returns
string[]

Definition at line 239 of file WikiTextStructure.php.

◆ getDefaultSort()

WikiTextStructure::getDefaultSort ( )

Get the "defaultsort" property.

Returns
string|null

Definition at line 248 of file WikiTextStructure.php.

◆ getMainText()

WikiTextStructure::getMainText ( )
Returns
string

Definition at line 231 of file WikiTextStructure.php.

◆ getOpeningText()

WikiTextStructure::getOpeningText ( )
Returns
string|null

Definition at line 223 of file WikiTextStructure.php.

◆ headings()

WikiTextStructure::headings ( )

Gets headings from the page.

Returns
string[] First strip out things that look like references. We can't use HTML filtering because the references come back as tags without a class. To keep from breaking stuff like ==Applicability of the strict mass–energy equivalence formula, ''E'' = ''mc''2== we don't remove the whole tag.

We also don't want to strip the tag and remove everything that looks like [2] because, I don't know, maybe there is a band named Word [2] Foo r something. Whatever.

So we only strip things that look like tags wrapping a reference. And since the data looks like: Reference in heading [1][2] we can not really use HtmlFormatter as we have no suitable selector.

Definition at line 81 of file WikiTextStructure.php.

◆ parseSettingsInMessage()

static WikiTextStructure::parseSettingsInMessage (   $message)
static

Parse a message content into an array.

This function is generally used to parse settings stored as i18n messages (see search-ignored-headings).

Parameters
string$message
Returns
string[]

Definition at line 117 of file WikiTextStructure.php.

References $lines.


The documentation for this class was generated from the following file: