Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5951967
InPre.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
InPre.php
View Options
<?php
namespace
Wikimedia\RemexHtml\TreeBuilder
;
use
Wikimedia\RemexHtml\Tokenizer\Attributes
;
/**
* This is not a tree builder state in the spec. I added it to handle the
* "next token" references in pre/listing. The specified mode for parsing the
* pre/listing is saved before entering this mode. This mode checks if the
* first token is a newline, and then switches to the correct mode regardless.
*/
class
InPre
extends
InsertionMode
{
public
function
characters
(
$text
,
$start
,
$length
,
$sourceStart
,
$sourceLength
)
{
if
(
$length
>
0
&&
$text
[
$start
]
===
"
\n
"
)
{
$start
++;
$length
--;
$sourceStart
++;
$sourceLength
--;
}
$mode
=
$this
->
dispatcher
->
restoreMode
();
if
(
$length
)
{
$mode
->
characters
(
$text
,
$start
,
$length
,
$sourceStart
,
$sourceLength
);
}
}
public
function
endDocument
(
$pos
)
{
$this
->
dispatcher
->
restoreMode
()
->
endDocument
(
$pos
);
}
public
function
startTag
(
$name
,
Attributes
$attrs
,
$selfClose
,
$sourceStart
,
$sourceLength
)
{
$this
->
dispatcher
->
restoreMode
()
->
startTag
(
$name
,
$attrs
,
$selfClose
,
$sourceStart
,
$sourceLength
);
}
public
function
endTag
(
$name
,
$sourceStart
,
$sourceLength
)
{
$this
->
dispatcher
->
restoreMode
()
->
endTag
(
$name
,
$sourceStart
,
$sourceLength
);
}
public
function
doctype
(
$name
,
$public
,
$system
,
$quirks
,
$sourceStart
,
$sourceLength
)
{
$this
->
dispatcher
->
restoreMode
()
->
doctype
(
$name
,
$public
,
$system
,
$quirks
,
$sourceStart
,
$sourceLength
);
}
public
function
comment
(
$text
,
$sourceStart
,
$sourceLength
)
{
$this
->
dispatcher
->
restoreMode
()
->
comment
(
$text
,
$sourceStart
,
$sourceLength
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 3 2026, 01:09 (4 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e7/a0/15ecd8c21cb75c5f0ed0ff9ded8b
Default Alt Text
InPre.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment