Template talk:BS-alt

Latest comment: 11 years ago by Wikid77 in topic Streamlining BS-alt to run 6x faster

some ideas resp. questions

edit

If this was a php or c task, my solution would be simple:

  1. cut the name into three parts: lower case chars – UPPER CASE CHARS – lower case chars
  2. have an array for all IDs with corresponding alt tags
  3. if desired give an additional work for each prefix/sufix char

Now this isn't neither php nor c, but is there any chance to implement something alike with the wikimedia software for template coding? Or is there at least some "wildcard" for switches as

{{#switch: {{{1|}}}
| *KBHF* = any type of terminal station
| ...
}}

If there's no way to break the names apart, we need to have at least 2000 lines in this switch ... just my uploaded icons are more than 1500 ... and still growing. Any ideas? axpdeHello! 15:50, 2 December 2009 (UTC)Reply

The patterns would have to be pretty tricky, I'm afraid, given that prefixes and suffixes share the same letters. I have no idea whether the MediaWiki implementers would add this. For now let's assume they won't. The simplest approach is to have a 2000-line switch statement: will that have adequate performance? If so, then it's good enough. If not, then there are templates that can take simple strings apart, e.g., {{str left}}; will those do? And if all else fails, we can have a separate template for each icon, as is done with the flag templates. See, for example, how {{flagicon}} works: there are separate templates {{country data US}}, {{country data UK}}, etc., for each country. Eubulides (talk) 17:29, 2 December 2009 (UTC)Reply

Problem with alt text defaults

edit

Because canal route diagrams use the metro/light rail icons, the default alt text in this template for some icons is inappropriate for rail route diagrams as it has been set with the assumption being that it is being used for water-based diagrams. Alt text seems to be applied arbitrarily without consistency, for example:

 

has alt text set as "Urban track turning from right"

 

has alt text set as "Waterway turning to right"

 

has alt text set as "Urban straight track"

 

has alt text set as "Unused straight waterway"

Even if the alt text is appropriate for a railway diagram at one time, there is currently nothing preventing another user changing it to a canal specific version later on, or vice versa. This will cause considerable confusion to an unsighted reader trying to screen-read a diagram. Shouldn't, therefore, all of the icons which are used for both purposes be set to use either a rail type description or a waterway type description for consistency? Personally, as the creator of many of the icons in the set, I think the default should be to rail type descriptions - the purpose for which they were originally created.--DavidCane (talk) 22:56, 6 April 2010 (UTC)Reply

I think the only way to prevent the confusion is that we remove all "railroad" terms from the "track-only" icon's alt text. -- Sameboat - 同舟 (talk) 23:52, 6 April 2010 (UTC)Reply
This is a very old thread, but I'm having a problem with
 

, which has the alt text "Waterway turning from left". This appears three times in the map on the Metropolitan Railway article. This is very confusing, and I would suggest that these these icons be consistently rail type, with perhaps redirects for the waterway ones? Edgepedia (talk) 19:09, 8 March 2012 (UTC)Reply

You may discuss this with commons:user:Axpde because he's not quite tolerant of alternative file name redirect for BSicons on Commons. As things stand now, I would rather remove the whole BS-alt from {{BS-overlap}} because it's a disaster for other users to follow or transwiki. -- Sameboat - 同舟 (talk) 01:00, 9 March 2012 (UTC)Reply

Streamlining BS-alt to run 6x faster

edit

Because some of the route-map diagrams have been running over 10 seconds to reformat, or edit-preview, I have rewritten Template:BS-alt to use smaller, nested #switch functions, which can run 6x times faster, and reduce diagram runtimes by 2x-3x times faster. Also, I have generalized some alt-text for using icons as either tracks or waterways. Further improvements could reduce the runtime of {BS-alt} as being 10x times faster, where most route-map diagrams would then reformat over 3x times faster. -Wikid77 (talk) 00:29, 28 April 2013 (UTC)Reply