Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser Class Reference

Generates ParserOutput from text or removes all tags from a text. More...

Public Member Functions

 __construct (ParsingPlaceholderFactory $placeholderFactory)
 
 containsMarkup (string $text)
 
 cleanupTags (string $text)
 Remove all opening and closing translate tags following the same whitespace rules as the regular parsing.
 
 parse (string $text)
 
 parseSection (string $text, bool $canWrap)
 Splits the content marked with <translate> tags into translation units, which are separated with two or more newlines.
 
 parseUnit (string $content)
 Checks if this unit already contains a section marker.
 
 armourNowiki (array &$holders, string $text)
 
 unarmourNowiki (array $holders, string $text)
 

Detailed Description

Generates ParserOutput from text or removes all tags from a text.

Author
Niklas Laxström @license GPL-2.0-or-later
Since
2020.08

Definition at line 15 of file TranslatablePageParser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::__construct ( ParsingPlaceholderFactory $placeholderFactory)

Definition at line 18 of file TranslatablePageParser.php.

Member Function Documentation

◆ armourNowiki()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::armourNowiki ( array & $holders,
string $text )

Definition at line 200 of file TranslatablePageParser.php.

◆ cleanupTags()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::cleanupTags ( string $text)

Remove all opening and closing translate tags following the same whitespace rules as the regular parsing.

This doesn't try to parse the page, so it can handle unbalanced tags.

Definition at line 32 of file TranslatablePageParser.php.

◆ containsMarkup()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::containsMarkup ( string $text)

Definition at line 22 of file TranslatablePageParser.php.

◆ parse()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::parse ( string $text)
Exceptions
ParsingFailure

Definition at line 50 of file TranslatablePageParser.php.

◆ parseSection()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::parseSection ( string $text,
bool $canWrap )

Splits the content marked with <translate> tags into translation units, which are separated with two or more newlines.

Extra whitespace is captured in the template and is not included in the translation units.

Definition at line 123 of file TranslatablePageParser.php.

◆ parseUnit()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::parseUnit ( string $content)

Checks if this unit already contains a section marker.

If there is not, a new one will be created. Marker will have the value of -1, which will later be replaced with a real value.

Definition at line 157 of file TranslatablePageParser.php.

◆ unarmourNowiki()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser::unarmourNowiki ( array $holders,
string $text )

Definition at line 213 of file TranslatablePageParser.php.


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