Template:Da smw for tables

From Tardis Wiki, the free Doctor Who reference
Revision as of 15:06, 8 May 2017 by CzechOut (talk | contribs) (Protected "Template:Da smw for tables": this is a utility template that should not be directly edited. doing so would change thousands of pages. (‎[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Instructions for {{Da smw for tables}}
{{da smw for tables}} originated as {{da smw}}, which was changed in 2017 for use largely in infoboxes. This template is specifically for use in {{job table core}} or other templates that purely display -- but don't collect -- SMW-rich data. It is a specialised version of {{da}} which makes it possible to strip the dab term from SMW tables. In these tables, the normal procedure of using {{da}} fails spectacularly, because SMW itself is creating an unusual kind of link. The standard linked output looks like this:
[[The Eleventh Hour (TV story)|The Eleventh Hour (TV story)]]

For whatever reason, the SMW coders create links in this very redundant way, which means the only solution is to get rid of the second dab term only.

The only recourse is the use of the #sub parser function, with which you can take off a negative number of letters at the end of the string, resulting in
[[The Eleventh Hour (TV story)|The Eleventh Hour

Add a closing pair of brackets — ]] — and your golden!

As of May 2017, it works to whisk away the (TV story) dab term, as its anticipated use is with templates that leverage mainly the data derived from {{Wales crew}}.