Page MenuHomePhabricator

Add an option to format the returned string from property parser function
Closed, DeclinedPublic

Description

Add an option for a format string to use in the property parser function. It seems like a sprintf would be sufficient, but note that each snak datatype would probably need a specialized call. (A decorator pattern driven by the datatype.)

A format string should probably be named.

Example: Assume P123 is a number statement holding Pi, then the following will print "Number is 3"

{{#property:P123|Q456|format=Number is %3d"}}

Event Timeline

jeblad created this task.Jul 7 2015, 10:50 AM
jeblad raised the priority of this task from to Needs Triage.
jeblad updated the task description. (Show Details)
jeblad added a subscriber: jeblad.
Restricted Application added a project: Wikidata. · View Herald TranscriptJul 7 2015, 10:50 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This feature request is in part motivated by the fact that the present parser function breaks the requirement at nowiki that all dates should be written in full. It now reports "1. jan. 1970" while it should use "1. january 1070". This isn't so in every case, so we need a way to override the provided format.

An alternative is to make a Lua script, but to me the functionality seems to belong in the parser function.

jeblad renamed this task from Add option to format returned string from property parser function to Add an option to format the returned string from property parser function.Jul 7 2015, 10:59 AM
jeblad set Security to None.
jeblad updated the task description. (Show Details)Jul 7 2015, 11:02 AM
Lydia_Pintscher closed this task as Declined.Aug 11 2016, 6:11 PM
Lydia_Pintscher added a subscriber: Lydia_Pintscher.

This is a case that needs to be handled in Lua and/or with better default formatting.