MediaWiki  1.33.0
BlockLevelPass Class Reference

Static Public Member Functions

static doBlockLevels ( $text, $lineStart)
 Make lists from lines starting with ':', '*', '#', etc. More...
 

Public Attributes

const COLON_STATE_CLOSETAG = 3
 
const COLON_STATE_COMMENT = 5
 
const COLON_STATE_COMMENTDASH = 6
 
const COLON_STATE_COMMENTDASHDASH = 7
 
const COLON_STATE_LC = 8
 
const COLON_STATE_TAG = 1
 
const COLON_STATE_TAGSLASH = 4
 
const COLON_STATE_TAGSTART = 2
 
const COLON_STATE_TEXT = 0
 

Private Member Functions

 __construct ( $text, $lineStart)
 
 closeList ( $char)
 Close the current list item identified by the prefix character. More...
 
 closeParagraph ( $atTheEnd=false)
 If a pre or p is open, return the corresponding close tag and update the state. More...
 
 execute ()
 Execute the pass. More...
 
 findColonNoLinks ( $str, &$before, &$after)
 Split up a string on ':', ignoring any occurrences inside tags to prevent illegal overlapping. More...
 
 getCommon ( $st1, $st2)
 getCommon() returns the length of the longest common substring of both arguments, starting at the beginning of both. More...
 
 hasOpenParagraph ()
 
 nextItem ( $char)
 Close the current list item and open the next one. More...
 
 openList ( $char)
 Open the list item element identified by the prefix character. More...
 

Private Attributes

 $DTopen = false
 
 $inPre = false
 
 $lastParagraph = ''
 
 $lineStart
 
 $text
 

Detailed Description

Definition at line 25 of file BlockLevelPass.php.

Constructor & Destructor Documentation

◆ __construct()

BlockLevelPass::__construct (   $text,
  $lineStart 
)
private
Parameters
string$text
bool$lineStart

Definition at line 59 of file BlockLevelPass.php.

References $lineStart, $text, and text.

Member Function Documentation

◆ closeList()

BlockLevelPass::closeList (   $char)
private

Close the current list item identified by the prefix character.

Parameters
string$char
Returns
string

Definition at line 167 of file BlockLevelPass.php.

References $text.

Referenced by execute().

◆ closeParagraph()

BlockLevelPass::closeParagraph (   $atTheEnd = false)
private

If a pre or p is open, return the corresponding close tag and update the state.

If no tag is open, return an empty string.

Parameters
bool$atTheEndOmit trailing newline if we've reached the end.
Returns
string

Definition at line 77 of file BlockLevelPass.php.

References hasOpenParagraph().

Referenced by execute(), and openList().

◆ doBlockLevels()

static BlockLevelPass::doBlockLevels (   $text,
  $lineStart 
)
static

Make lists from lines starting with ':', '*', '#', etc.

Parameters
string$text
bool$lineStartWhether or not this is at the start of a line.
Returns
string The lists rendered as HTML

Definition at line 50 of file BlockLevelPass.php.

References $lineStart, and $text.

◆ execute()

BlockLevelPass::execute ( )
private

◆ findColonNoLinks()

BlockLevelPass::findColonNoLinks (   $str,
$before,
$after 
)
private

Split up a string on ':', ignoring any occurrences inside tags to prevent illegal overlapping.

Parameters
string$strThe string to split
string&$beforeSet to everything before the ':'
string&$afterSet to everything after the ':'
Exceptions
MWException
Returns
string The position of the ':', or false if none found

Definition at line 441 of file BlockLevelPass.php.

References COLON_STATE_CLOSETAG, COLON_STATE_COMMENT, COLON_STATE_COMMENTDASH, COLON_STATE_COMMENTDASHDASH, COLON_STATE_LC, COLON_STATE_TAG, COLON_STATE_TAGSLASH, COLON_STATE_TAGSTART, COLON_STATE_TEXT, and wfDebug().

Referenced by execute().

◆ getCommon()

BlockLevelPass::getCommon (   $st1,
  $st2 
)
private

getCommon() returns the length of the longest common substring of both arguments, starting at the beginning of both.

Parameters
string$st1
string$st2
Returns
int

Definition at line 99 of file BlockLevelPass.php.

Referenced by execute().

◆ hasOpenParagraph()

BlockLevelPass::hasOpenParagraph ( )
private
Returns
bool

Definition at line 67 of file BlockLevelPass.php.

Referenced by closeParagraph(), and execute().

◆ nextItem()

BlockLevelPass::nextItem (   $char)
private

Close the current list item and open the next one.

Parameters
string$char
Returns
string

Definition at line 142 of file BlockLevelPass.php.

Referenced by execute().

◆ openList()

BlockLevelPass::openList (   $char)
private

Open the list item element identified by the prefix character.

Parameters
string$char
Returns
string

Definition at line 117 of file BlockLevelPass.php.

References closeParagraph().

Referenced by execute().

Member Data Documentation

◆ $DTopen

BlockLevelPass::$DTopen = false
private

Definition at line 26 of file BlockLevelPass.php.

◆ $inPre

BlockLevelPass::$inPre = false
private

Definition at line 27 of file BlockLevelPass.php.

◆ $lastParagraph

BlockLevelPass::$lastParagraph = ''
private

Definition at line 28 of file BlockLevelPass.php.

◆ $lineStart

BlockLevelPass::$lineStart
private

Definition at line 29 of file BlockLevelPass.php.

Referenced by __construct(), and doBlockLevels().

◆ $text

BlockLevelPass::$text
private

Definition at line 30 of file BlockLevelPass.php.

Referenced by __construct(), closeList(), doBlockLevels(), and execute().

◆ COLON_STATE_CLOSETAG

const BlockLevelPass::COLON_STATE_CLOSETAG = 3

Definition at line 36 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_COMMENT

const BlockLevelPass::COLON_STATE_COMMENT = 5

Definition at line 38 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_COMMENTDASH

const BlockLevelPass::COLON_STATE_COMMENTDASH = 6

Definition at line 39 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_COMMENTDASHDASH

const BlockLevelPass::COLON_STATE_COMMENTDASHDASH = 7

Definition at line 40 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_LC

const BlockLevelPass::COLON_STATE_LC = 8

Definition at line 41 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_TAG

const BlockLevelPass::COLON_STATE_TAG = 1

Definition at line 34 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_TAGSLASH

const BlockLevelPass::COLON_STATE_TAGSLASH = 4

Definition at line 37 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_TAGSTART

const BlockLevelPass::COLON_STATE_TAGSTART = 2

Definition at line 35 of file BlockLevelPass.php.

Referenced by findColonNoLinks().

◆ COLON_STATE_TEXT

const BlockLevelPass::COLON_STATE_TEXT = 0

Definition at line 33 of file BlockLevelPass.php.

Referenced by findColonNoLinks().


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