User:Flying sheep/Reason for sprite template split

Hi, since it seems to be impossible to raise the loop limit, I need to rewrite BlockGrid so that it doesn’t use loops anymore.

This involves rebuilding the recurring part, i.e. one HTML table cell and one invocation of BlockSprite into 30-HTML-characters-or-less chunks, because that’s the limit for the “#replace” parser function (unless you raise that limit instead). In order to do that, I need


 * The switch statement in BlockSprite, that translates names to positions
 * , the conveniently already-extracted template, that translates these positions to CSS.

What options I had:


 * 1) Extract the swich-statement to a sub-template, like BlockSprite/positions
 * 2) ;Pro:   Clean markup, separation of data and code, elegant. Can be used to create a generic sprite template, that uses both items and blocks
 * 3) ;Contra: People need to edit that template instead of BlockSprite itself.
 * 4) Add an option to BlockSprite to output only the position instead of the whole HTML/CSS.
 * 5) ;Pro:   Slightly easier to edit, people don’t need to “find” a new template
 * 6) ;Contra: Messes up the code, single purpose

The bold part did it por me. Option 1 was it.

– Flying sheep 11:23, 15 September 2011 (UTC)