Module talk:Unsubst

Edit request on 25 November 2013
I get this error:

Lua error in Module:Unsubst at line 18: attempt to call field 'isSubsting' (a nil value).

Shouldn't that be isSubstring?

☠ MarkAHershberger ☢ (talk) ☣ 16:27, 25 November 2013 (UTC)
 * changed request from edit template-protected to edit protected because it is cascade protected. Technical 13 (talk) 16:41, 25 November 2013 (UTC)
 * Pictogram voting comment.svg Note: The module name is "Unsubst", implying a reversal of "subst"; "subst" is a verb, being Wiki shorthand for substitute; so the present participle would be "substing", and may be used in a phrase like "it is substing", hence I think that "isSubsting" is a reasonable name for an identifier, such as a function returning a Boolean result. -- Red rose64 (talk) 17:22, 25 November 2013 (UTC)
 * Red information icon with gradient background.svg Not done: As Redrose64 explained, isSubsting is the correct spelling. Where are you getting this error? Given that we haven't been inundated by people complaining that every maintenance tag (e.g. ) is giving script errors, I am skeptical that you're seeing this here on enwiki. On non-WMF wikis, do note that you will need an extremely recent version of Scribunto (or you will have to cherry-pick 93019). Anomie⚔ 18:09, 25 November 2013 (UTC)

You can avoid using $N
You can get the template name from mw.getCurrentFrame:getTitle — Keφr 08:59, 27 March 2014 (UTC)
 * I retract that. It does not seem to work. Shame, really. — Keφr 09:28, 27 March 2014 (UTC)
 * Oh wait, the proper code is mw.getCurrentFrame:getParent:getTitle, and it does work. (And above, I actually meant mw.getCurrentFrame.parent:getTitle, which does not.) — Keφr 09:50, 27 March 2014 (UTC)
 * Sandbox version, needs review and deploy. any final comments? Or should we do this thing? My only comment is that I was worried about the expensive mw.title.new until I realized that only gets called on subst so it'd only be a problem if someone adds ~500 substed maintenance tags in one edit (if even that). Anomie⚔ 10:38, 27 March 2014 (UTC)
 * This is ready to go now, as far as I can see. However, I did tweak the error messages, as they were showing the #invoke call as, when actually it's just  . As for the expensive mw.title.new, I agree that if it only gets called on subst then it shouldn't be a problem. — Mr. Stradivarius  ♪ talk ♪ 12:20, 27 March 2014 (UTC)
 * Is $N still deliberately in specialParams? (Do we need specialParams at all anymore?) Jackmcbarn (talk) 22:21, 27 March 2014 (UTC)
 * Mr. Stradivarius restored it in [//en.wikipedia.org/w/index.php?title=Module:Unsubst/sandbox&diff=598067783&oldid=598044098], and I agree with his reasoning. Anomie⚔ 20:23, 29 March 2014 (UTC)
 * Ah, I was under the impression that that was done now. Anyway, looks good then. Jackmcbarn (talk) 01:35, 30 March 2014 (UTC)
 * I've updated the module. — Mr. Stradivarius  ♪ talk ♪ 01:54, 30 March 2014 (UTC)

mw.isSubsting not working
I have a local wikipedia copy and get the 'Lua error in Module:Unsubst atline 18: attempt to call field 'isSubsting' (a nill value)' error and I have changed the Unsubst module to the new one but still get the error, is there anything else I need to do?
 * Yes, you need to upgrade Scribunto to the latest version. Wikipedia uses the cutting-edge version of Scribunto, so you will need to go to the download page and select "master (latest development version)" from the drop-down menu. Earlier versions of Scribunto don't have the mw.isSubsting function. Although it is called the "latest development version", it should be stable enough to use in production. (If it's good enough for Wikipedia, it's probably good enough for you.) Hope this helps. — Mr. Stradivarius  ♪ talk ♪ 12:19, 22 April 2014 (UTC)
 * Also, if you don't want to upgrade, then you can use the old version of the module. That will work just fine, but you will need to specify the  (template name) parameter in the #invoke text, whereas in the latest version this is not necessary. — Mr. Stradivarius  ♪ talk ♪ 12:25, 22 April 2014 (UTC)
 * Just installed the "master" version of Scribunto and it works :) Thanks very much. — Preceding unsigned comment added by 195.217.192.7 (talk) 14:01, 22 April 2014‎ (UTC)

Protected edit request on 22 August 2014
Please make these changes.

Jackmcbarn (talk) 15:04, 22 August 2014 (UTC)
 * Yes check.svg Done — Mr. Stradivarius  ♪ talk ♪ 15:48, 22 August 2014 (UTC)

template invocation name override
Using this module imposes a time penalty. Not surprising, that. I have been experimenting with a module to translate (a template that attempts to translate de.wiki's Vorlage:Literatur to a  template). In its current form, is always subst'd so I tweaked  (the sandbox) to use this module. At I was queried about the time penalty. My simple experiments show that there is a significant time penalty for no benefit.

In that discussion, I wondered if the translator module might call a special substable version of so I created  which uses this module and then modified the translator module to call that template. The substitution worked as it should except that the substituted template name was. In that discussion at WT:CS1, I also wondered if this module might be tweaked to support a template invocation name override parameter. I have to support $template-name. uses this parameter to set the template name to  and when a  template is subst'd, the result is an invocation of.

If there are no objections, I will update the live module from the sandbox. Comments, of course, are welcome.

—Trappist the monk (talk) 18:06, 20 August 2021 (UTC)
 * Trappist the monk, I was just about to ask the same question. it looks like there are no objections, so I would suggest you go ahead and make the change.  thank you. Frietjes (talk) 14:58, 8 October 2021 (UTC)
 * done
 * —Trappist the monk (talk) 18:22, 8 October 2021 (UTC)

Question about sigs in this template
I'm looking to add a signature option to Dashboard.wikiedu.org assignment using this template so that if someone adds the template, a bot can subst the call and return the original template call plus the user's signature (or maybe even just a timestamp). However, I am concerned that adding in something dynamic like a timestamp will cause issues if the template is substed. Basically, I'm not sure how to code it so that it gives accurate information that stays static after substing. Example: Substing the template call would ideally give something like This is primarily to allow for archiving when the course is over (because at current, sections like this won't ever be archived). Please let me know how far off the mark I am. Thanks! Primefac (talk) 08:17, 16 March 2022 (UTC)
 * 08:16, 16 March 2022 (UTC)
 * The module already has a magic value  that is replaced with the current month and year when adding the parameter while substing. This is used in maintenance templates. Anomie⚔ 11:44, 16 March 2022 (UTC)
 * Right, I guess it's just a question of how I can best use that to include a timestamp for archival purposes... Primefac (talk) 14:08, 16 March 2022 (UTC)

Square brackets
When I read the documentation I incorrectly assumed that the square brackets were a required part of the syntax, i.e. [œuf>egg,melt>cheese] but actually it should be œuf>egg,melt>cheese Perhaps the wording can be made clearer? &mdash; Martin (MSGJ · talk) 11:53, 17 July 2024 (UTC)

Substituted wrapper templates
A common way this module is used with wrapper templates which are supposed to be replaced, e.g. It seems to me there could be a simpler way to do this, rather than (a) having to pass all known parameters to the target template, and (b) specifying the target template twice effectively. Could we consider an additional flag for  which could do this? &mdash; Martin (MSGJ · talk) 12:02, 17 July 2024 (UTC)
 * That doesn't seem like a common use for this module to me. Or if it is, people have been doing some weird stuff with it. Seems like you'd do better with a different module that requires  but doesn't take a   option. Anomie⚔ 02:29, 18 July 2024 (UTC)