Template talk:Show data
Contemplated additions/changes to Template:Data helper templates
[edit]I'm bringing this up here because I don't know where else might be better, and because the changes discussed below would need to be documented in this template page if they are taken to prime time.
By way of background, I recently made changes to some infobox parameters on the Philippines page using {{Data Philippines}}. The changes look messy and hard to understand. One example:
|population_density_km2 = {{#expr: {{#expr: {{data Philippines|poptoday}} round0}} div {{data Philippines|pst2|total area}} round2}}
.
Perhaps there is a less messy way to do this, but I didn't see one.
A less messy solution not immediately available would be to use a helper template like {{Poptoday}}. This doesn't appeal to me because it seems messy to sprinkle helper templates specific to the Data template family all around the template namespace. A solution which appeals to me more is to use subpages for the helper templates; e.g., {{Data/popdens_km2}}. To try this out, I created {{Data/popdens_km2/sandbox}}. With that, in the Philippines article I can say:
|population_density_km2 = {{data/popdens_km2/sandbox|Philippines|round=2}}
This looks a lot less messy than what I currently have in the Philippines article, and avoids congesting the template namespace with helper templates specific to the Data template family.
I'm hoping for feedback. If I have done or am doing something dumb, please let me know. In the absence of feedback, I'll probably move forward along the lines indicated above.
I'll be traveling for the next day or two, and it may be a couple of days before I get a chance to look here for feedback.
Cheers, Wtmitchell (talk) (earlier Boracay Bill) 07:00, 3 February 2014 (UTC)
I've created the {{Data/popdens}} template and associated documentation. I'll wait a few days for comments before editing the {{Show data}} doc subpage to describe it. Wtmitchell (talk) (earlier Boracay Bill) 07:20, 9 February 2014 (UTC)