Scary tranclusion

Version vom 19. Mai 2021, 09:23 Uhr von Lily (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Scary transclusion not working?

It would be a good thing to use templates from a remote wiki. Miraheze provides actually a special wiki for this purpuse. The prefix for this wiki is templatewiki.

You have to enable scary transclusion (tab ⧼settings-edit⧽) if you want to use interwiki templates. When you check out this feature you will get some surprises.

Pure transclusion

A glance into the manual helps.

{{wiki:template name}} or {{wiki:main namespace page name}} will transclude the remote wiki page content, not the wikicode of templates, etc. Actually you will get exactly the content that you see on your screen when you visit the template in the remote wiki. The template will not function because the pure HTML-Code is included in your wiki page. All links will point to the remote wiki.

{{templatewiki:Userlist}} transcludes as (anything inside the dotted borders)
[Vorlagenabruf fehlgeschlagen für HTTP 404]
This behaviour is probally not what you expect and need.

Raw transclusion

This is the solution for your problem. Use {{raw:templatewiki:Userlist}} to get the wanted result.}}

[Vorlagenabruf fehlgeschlagen für HTTP 404]

{{InfoBox|1=The drawback of this method is that all included templates must be defined locally. Therefore I recommond following approach:

  • if you want to transclude template template sample define a template with the same name in the local wiki
  • insert following text into your template: <includeonly><onlyinclude>{{raw:templatewiki:template sample}}</onlyinclude></includeonly>
  • define all used subtemplates in the same way

Transclusion of a page outside the template namespace

Die Informationen auf der Dokumentationsseite, wie eine Seite zu transkludieren ist, die sich nicht im Vorlagennamensraum des remote Wiki befindet, sind mindestens verwirrend, wenn nicht gar falsch.

Die Syntax lautet: {{interwiki-prefix::{{FULLPAGENAME}}}}

Ein konkretes Beispiel: {{raw:templatewiki::User:Lily/sandbox}}


This is a test.

Transclusion from main namespace: {{raw:yazz::Transclusion}} results in

linear-gradient(to right, red, #f80, #ff0, #8f0, #0f0, #0f8, #0ff, #08f, #00f, #80f, #f0f, #f08)


If the template in the remote wiki contains template documentation, you can include this documentaton with {{templatewiki:template sample}} The content of your template would look like this

<includeonly><onlyinclude>{{raw:templatewiki:template sample}}</onlyinclude></includeonly>
{{templatewiki:template sample}}

If you want to make this even better define a template eg {{Transdoc}} in your local wiki that looks like this

|1=Diese Dokumentation wird eingebunden von der Vorlage {{Tl|1=Transdoc}}}}
<!-- {{VListe|VLily|Transclution|Aus dem Lilypond Wiki eingebundene Vorlagen}} -->
== Local description ==
[[Special:WhatLinksHere/Template:{{PAGENAME}}|Lokale Verwendungen der Vorlage {{PAGENAME}}]]
=== Local code ===
<div style="background-color: #aaa; width: 90%; border-radius: 1em; box-shadow: 0.1em 0.1em 0.5em rgba(0,0,0,0.75); padding: 0.5em;"><div style="background-color: #fff; padding: 1em; border-radius: 0.5em; font-family: monospace; white-space: pre-wrap;">
=== Local Subpages ===
== Remote Description ==
|1=Diese Vorlage sowie die [[#Remote Description|dazugehörige Dokumentation]] wird aus dem [[{{{pre|lily}}}:{{FULLPAGENAME}}|{{{wiki|Lilypond Wiki}}}]] eingebunden.<br>
Sämtliche Links verweisen auf das [[{{{pre|lily}}}:|{{{wiki|Lilypond-Wiki}}}]]}}</div>
}}{{Cats|Transcluded from {{{wiki|Lilypond Wiki}}}}}<!-- end of switch --></onlyinclude></includeonly>
This template displays the raw content of the local template and a list of local subpages.