$titleText = 'Parser test';
}
+ if ( isset( $opts['maxincludesize'] ) ) {
+ $options->setMaxIncludeSize( $opts['maxincludesize'] );
+ }
+ if ( isset( $opts['maxtemplatedepth'] ) ) {
+ $options->setMaxTemplateDepth( $opts['maxtemplatedepth'] );
+ }
+
$local = isset( $opts['local'] );
$preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
$parser = $this->getParser( $preprocessor );
'wgFragmentMode' => [ 'legacy' ],
];
+ $nonIncludable = self::getOptionValue( 'wgNonincludableNamespaces', $opts, false );
+ if ( $nonIncludable !== false ) {
+ $setup['wgNonincludableNamespaces'] = [ $nonIncludable ];
+ }
+
if ( $config ) {
$configLines = explode( "\n", $config );
{{{1}}}
!! endarticle
+!! article
+Template:echo3
+!! text
+{{{1}}}
+{{{1}}}
+{{{1}}}
+!! endarticle
+
// For Serbian; localize Template namespace
!! article
Шаблон:Echo
<div>{{{1}}}</div>
!! endarticle
+!! article
+Template:echo with depth
+!! text
+{{echo|{{{1}}}}}
+!! endarticle
+
!! article
Template:blank_param
!! text
</p>
!! end
+!! test
+post-expand include size being exceeded
+!! options
+maxincludesize=20
+!! wikitext
+{{echo3|1234567890}}
+!! html
+<p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
+</p>
+!! end
+
+!! test
+max template depth being reached
+!! options
+maxtemplatedepth=1
+!! wikitext
+{{echo with depth|too deep!}}
+!! html
+<p><span class="error">Template recursion depth limit exceeded (1)</span>
+</p>
+!! end
+
!! test
Multiple comments should still parse as SOL-transparent
!! options
</p>
!! end
+!! test
+Template from non-includable namespace
+!! options
+wgNonincludableNamespaces=10
+!! wikitext
+{{echo|uh oh!}}
+!! html
+<p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
+</p>
+!! end
+
!! article
Template:table
!! text