Module talk:Wd/Archive 1: Difference between revisions

Content deleted Content added
m Archiving 1 discussion(s) from Module talk:Wd) (bot
m Archiving 1 discussion(s) from Module talk:Wd) (bot
Line 1,520:
::@[[User:Janhrach|Janhrach]], Thanks for the fix. I tested it on Telugu wikipedia and found the the test cases working. [[User:Arjunaraoc|Arjunaraoc]] ([[User talk:Arjunaraoc|talk]]) 00:38, 23 March 2024 (UTC)
::{{done|Module updated.}} [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 08:11, 1 April 2024 (UTC)
 
== Getting [[Template:Update tracker]] working with qualifiers ==
 
I've been working on developing {{t|Update tracker}} and its child {{t|Update tracker item}}, templates for articles that use {{t|Wikidata}} that create a table for the talk page that lists which information needs to be updated (convenient for subjects like colleges that have a lot of data that needs updating every year).
 
I've gotten it mostly functional, except that I can't figure out how to get it to work with qualifiers (see [[Template:Update_tracker_item/testcases|the testcases]]). To function, it needs to call extra qualifier commands only when the {{para|qualifier}} or {{para|qualifier-value}} parameters are defined. I don't know of a way to conditionally add extra parameters, though, and keeping them blank causes an error.
 
Does that make sense? Anyone able to help? <span style="border:3px outset;border-radius:8pt 0;padding:1px 5px;background:linear-gradient(6rad,#86c,#2b9)">[[User:Sdkb|<span style="color:#FFF;text-decoration:inherit;font:1em Lucida Sans">Sdkb</span>]]</span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 14:05, 10 April 2024 (UTC)
 
 
:@[[User:Sdkb|Sdkb]]: what do you mean by "there's an error" (in your testcases)? Is it an error thrown by the module or is it just the wrong data that you're getting? I suppose you tried
 
<syntaxhighlight lang="wikitext">
{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} |{{{qualifier|}}}={{{qualifier-value|}}} }}
</syntaxhighlight>
:Did you leave out the vertical bars in the last two variables? I did a quick test in your code, previewing your test cases while editing, and the previous code did return some values and no obvious errors.
 
:I see another problem here / for {{Q|Q10664609}}. This:
:* <nowiki>{{Wikidata|qualifier|single|eid=Q10664609|P1128|P585|P518=Q5428874}}</nowiki>→ {{Wikidata|qualifier|single|eid=Q10664609|P1128|P585|P518=Q5428874}} (current WD value is 2019)
 
:seems alright. However, in
:* <nowiki>{{Wikidata|qualifier|single|eid=Q10664609|P1128|P585}}</nowiki> → {{Wikidata|qualifier|single|eid=Q10664609|P1128|P585}}
:you'd expect the result to be 2020 (right?), but without any qualifiers the call returns the first of the two values of:
:* <nowiki>{{Wikidata|qualifier|eid=Q10664609|P1128|P585}}</nowiki> → {{Wikidata|qualifier|eid=Q10664609|P1128|P585}}
:This would require a change on WD, another "applies to" or "rank: preferred", I believe.
 
:Although, this does seem to work, so {{para|qualifier}} should be given with no value when there are other nonempty qualifiers for the property:
:* <nowiki>{{Wikidata|qualifier|single|eid=Q10664609|P1128|P585|P518=}}</nowiki>→ {{Wikidata|qualifier|single|eid=Q10664609|P1128|P585|P518=}}
:[[User:Ponor|Ponor]] ([[User talk:Ponor|talk]]) 12:56, 10 April 2024 (UTC)
::Thanks for the reply, {{u|Ponyo}}! The error I'm referencing came from the fact that {{para|qualifier}} and {{para|qualifier-value}} are optional, and the most simple use case (the first two test cases) leave them out. The previous code I tried removed the equal sign if they were not present, causing the template to evaluate as <syntaxhighlight lang="wikitext">{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} | }}</syntaxhighlight>, where the pipe and blank parameter at the end causes it to become blank. Curiously, using your more basic method, the template evaluates as <syntaxhighlight lang="wikitext">{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} | = }}</syntaxhighlight>, which I didn't even try because I presumed it would produce even more of an error, but it actually seems to cause it to work as intended. So that resolves my problem, although I don't trust that blank equals signs will always be okay for {{t|Wikidata}} as it evolves in the future, so if there's a more durable solution that'd be good to know about. <span style="border:3px outset;border-radius:8pt 0;padding:1px 5px;background:linear-gradient(6rad,#86c,#2b9)">[[User:Sdkb|<span style="color:#FFF;text-decoration:inherit;font:1em Lucida Sans">Sdkb</span>]]</span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 19:45, 10 April 2024 (UTC)
:::@[[User:Sdkb|Sdkb]]: glad it worked (wasnt' sure what exactly wasn't working). I don't think the ''blank equals sign'' will cause any problems; when there's nothing on its left, it should be discarded. If, however, you want to run some tests on your variables, you can try <syntaxhighlight lang="wikitext">{{#if:…{{{qualifier|}}}…| {{Wikidata|…|{{{qualifier}}}={{{qualifier-value}}}}} | {{Wikidata|…}} }}</syntaxhighlight> Someone more familiar with parsers and stuff might tell us if there's a better way; something tells me there has to be a hard-coded = sign, and not its replacements. [[User:Ponor|Ponor]] ([[User talk:Ponor|talk]]) 20:23, 10 April 2024 (UTC)
:::The same test, using the nothing-on-the-left-of-equals-sign trick: <syntaxhighlight lang="wikitext">{{Wikidata |qualifier |single |{{{property|}}} |P585 |eid={{{entity|}}} |{{#if: some function of {{{qualifier|}}} and {{{qualifier-value}}} | {{{qualifier}}} | }} = {{{qualifier-value}}} }}</syntaxhighlight> [[User:Ponor|Ponor]] ([[User talk:Ponor|talk]]) 20:30, 10 April 2024 (UTC)