Template:Page upload: Difference between revisions

From Wikisphere
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
'''Attention'''! for the issue mentioned here
This is the "Page upload" template. (see [[Page_upload|here]] for a use-case)
It should be called in the following format:
 
<pre>
<gallery widths=340px mode="packed-overlay" parse-wikitext>
{{{files}}}
</gallery>
</pre>
 
'''Attention'''! due to the issue mentioned here:


* https://phabricator.wikimedia.org/T4700
* https://phabricator.wikimedia.org/T4700
Line 7: Line 16:
inner content of tag extensions won't be parsed as wikitext !
inner content of tag extensions won't be parsed as wikitext !
In order to allow it in certain circumstances (i.e. within the
In order to allow it in certain circumstances (i.e. within the
tags <code>gallery</code> and <code>ref</code>
tags <code>gallery</code> and <code>ref</code>) we propose
to use the attribute <code>parse-wikitext</code> in conjuction
with the following MW patch:


<pre>
if ( isset( $this->mTagHooks[$name] ) ) {
// @see https://phabricator.wikimedia.org/T4700
// @see https://phabricator.wikimedia.org/T3310
if ( !empty( $content )
&& array_key_exists( 'parse-wikitext', $attributes ) ) {
$content = $this->internalParse( $content, false, $frame );
}


<pre>
// Note that $content may be null here, for example if the
<gallery widths=340px mode="packed-overlay" parse-wikitext>
// tag is self-closed.
{{{files}}}
$output = call_user_func_array( $this->mTagHooks[$name],
</gallery>
[ $content, $attributes, $this, $frame ] );
} else {
</pre>
</pre>
(includes/parser/Parser.php -> extensionSubstitution )
see also
* https://www.mediawiki.org/wiki/Topic:Vnmqs9jfxz224tz1
* https://www.mediawiki.org/wiki/Extension:TemplateData
* https://www.mediawiki.org/wiki/Topic:Qhj3ybl2rnsiw6oc
* https://phabricator.wikimedia.org/T22707
</noinclude>
</noinclude>
<gallery widths=340px mode="packed-overlay" parse-wikitext>
<gallery widths=340px mode="packed-overlay" parse-wikitext>
{{{files}}}
{{{files}}}
</gallery>
</gallery>

Latest revision as of 09:38, 8 December 2023

This is the "Page upload" template. (see here for a use-case) It should be called in the following format:

<gallery widths=340px mode="packed-overlay" parse-wikitext>
{{{files}}}
</gallery>

Attention! due to the issue mentioned here:

inner content of tag extensions won't be parsed as wikitext ! In order to allow it in certain circumstances (i.e. within the tags gallery and ref) we propose to use the attribute parse-wikitext in conjuction with the following MW patch:

			if ( isset( $this->mTagHooks[$name] ) ) {
				// @see https://phabricator.wikimedia.org/T4700
				// @see https://phabricator.wikimedia.org/T3310
				if ( !empty( $content )
					&& array_key_exists( 'parse-wikitext', $attributes ) ) {
					$content = $this->internalParse( $content, false, $frame );
				}

				// Note that $content may be null here, for example if the
				// tag is self-closed.
				$output = call_user_func_array( $this->mTagHooks[$name],
					[ $content, $attributes, $this, $frame ] );
			} else {

(includes/parser/Parser.php -> extensionSubstitution )

see also