MobileFrontend
Mobile optimised frontend for MediaWiki
|
Implements IMobileTransform, that splits the body of the document into sections demarcated by the $headings elements. More...
Public Member Functions | |
__construct (array $topHeadingTags, bool $scriptsEnabled) | |
getFirstHeading (DOMElement $doc) | |
Retrieves the tag name of the first heading element (e.g., h1 , h2 , etc.) inside the .mw-parser-output container. | |
apply (DOMElement $doc) | |
Performs html transformation that splits the body of the document into sections demarcated by the $headings elements. | |
Static Public Member Functions | |
static | interimTogglingSupport () |
Make it possible to open sections while JavaScript is still loading. | |
Public Attributes | |
const | STYLE_COLLAPSIBLE_SECTION_CLASS = 'collapsible-block' |
Class name for collapsible section wrappers. | |
Implements IMobileTransform, that splits the body of the document into sections demarcated by the $headings elements.
Also moves the first paragraph in the lead section above the infobox.
All member elements of the sections are added to a
MobileFrontend\Transforms\MakeSectionsTransform::__construct | ( | array | $topHeadingTags, |
bool | $scriptsEnabled ) |
array | $topHeadingTags | list of tags could ne cosidered as sections |
bool | $scriptsEnabled | wheather scripts are enabled |
MobileFrontend\Transforms\MakeSectionsTransform::apply | ( | DOMElement | $doc | ) |
Performs html transformation that splits the body of the document into sections demarcated by the $headings elements.
Also moves the first paragraph in the lead section above the infobox.
DOMElement | $doc | html document |
Implements MobileFrontend\Transforms\IMobileTransform.
MobileFrontend\Transforms\MakeSectionsTransform::getFirstHeading | ( | DOMElement | $doc | ) |
Retrieves the tag name of the first heading element (e.g., h1
, h2
, etc.) inside the .mw-parser-output
container.
If no headings are found, returns an empty string.
Note: The function loops over all top-level sibling elements inside .mw-parser-output until it finds the first heading element. This approach is considered acceptable because:
DOMElement | $doc |
|
static |
Make it possible to open sections while JavaScript is still loading.