On Tue, Apr 23, 2013 at 10:55 AM, Jon Robson jdlrobson@gmail.com wrote:
In terms of your question regarding https://en.m.wikipedia.org/wiki/Coastline_%28sculpture%29 - currently the API doesn't provide a way to insert images into infoboxes. Uploading images by prepending them to the lead section is currently what we are doing as that is easy and we feared if we inserted them above an infobox this would require someone to move it into the infobox which might annoy existing editors. As a result the lead image upload button does not show on any articles which have infoboxes. It would be great to review this - maybe it wouldn't be such a bad thing? Does anyone fancy exploring whether such a thing could be made possibly with the api?
Roughly speaking here's what I'd recommend:
* create some unofficial standard for labeling image placeholders in infobox templates (maybe a special template itself) * request the page over API *with* preprocessor XML tree (this separates out template invocations and parameters and a few other items) * navigate the XML node tree to find the infobox parameter with the placeholder * replace the placeholder with the image reference * collapse the XML tree to plain text (this reconstructs the original wikitext) * save over editing API
Alternately, the processing can be done on the server side through a dedicated POST action, which would make it faster by avoiding sending the entire article back and forth over the wire.
-- brion