Page MenuHomePhabricator

Consider adding negation in template data maps for boolean values
Open, Needs TriagePublic

Description

There are some types of templates that have de facto boolean parameters. These are treated as strings. I.e. "nopp: Set to y, yes, or true" in https://en.wikipedia.org/wiki/Template:Citation

My own use case is: dead-url in https://en.wikipedia.org/wiki/Template:Citation; treated as string; takes "yes" or "no."

My problem is that as an API writer, this requires me to exactly copy what's in the template for this parameter, in order to have it work in TemplateData, which is not a choice I would normally make for the API. I would like template data to have a "boolean" type, and then also have the ability in 'maps' to negate it; i.e.

	"maps": {
		"citoid": {
			"urlAlive": "!dead-url", // This seems a bit hacky to me though

This still doesn't solve my immediate problem (because the template requires 'yes' or 'no' and not 'true' or 'false' so it's still an issue because !yes isn't valid either!) but it might a) encourage template writers to use booleans in a more standard fashion b) might be usable in some other scenarios c) we might even consider interpreting 'yes' and 'no' as bools, although there is no guarantee the templates would adapt to that, and there's also the language issue ("oui" et "non")?

Even if we don't both with allowing negation at all at first, it still might be a nice thing to have the extra type, just for standards reasons.

Event Timeline

Mvolz created this task.Sep 7 2017, 10:02 AM
Restricted Application added a project: VisualEditor. · View Herald TranscriptSep 7 2017, 10:02 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Mvolz added a comment.Sep 7 2017, 10:11 AM

Hmm maybe T144155 is similar, apparently there *is* a "boolean" type? I guess it's only in the SC?

Mvolz renamed this task from Consider adding "boolean" as a type for template data (and possibly add negation?) to Consider adding negation in template data maps for boolean values.Sep 7 2017, 10:12 AM
Mvolz updated the task description. (Show Details)Sep 7 2017, 10:14 AM
Mvolz moved this task from Backlog to Extension on the Citoid board.Oct 8 2017, 2:05 PM