Template talk:Tag/Archive 1

From OpenStreetMap Wiki
Jump to navigation Jump to search

spurious space before subkeys

Does anybody else notice a spurious space in addr:street=*? Ipofanes 05:55, 14 November 2009 (UTC)

I have corrected it.--Nazotoko 19:49, 3 December 2009 (UTC)

values verses variables

I'm trying to use this template (because it's nice to be consistent) I'd like to distinguish between two cases - when you want to state a possible value for the tag, and when you want to indicate the value is variable. Maybe an example:

  • ncn = yes
  • ncn_ref = number

i.e. I expect the letters y, e and s to go into the database, but not the letters n, u, m, b, e, r.

Can we accomodate this in this template? I'll keep using italics and similar bodges if not, but it might be worth someone investigating. Gravitystorm 20:47, 30 December 2007 (UTC)

As per discussion below, you can now control the linking as follows:
ncn=yes ...with both key and value linkified is achieved with this syntax: {{Tag|ncn|yes}}
ncn=number ...with only the key linkified is achieved with this syntax: {{Tag|ncn||number}} (with an extra pipe '|' char)
-- Harry Wood 10:02, 4 March 2009 (UTC)

Link to value page too?

At the moment, this template links to the tag's page. e.g., if you do {{Tag|highway|motorway}}, the highway part of the highway=motorway links to Key:highway. Would it not make sense to link the motorway part to the relevant page (Tag:highway=motorway) too? Something like [[Key:{{{1}}}|{{{1}}}]]={{#if:{{{2|}}}|[[Tag:{{{1}}}={{{2}}}|{{{2}}}]]|<nowiki>*}}</nowiki> would do it (see Template:Tag_test). If the second argument (the tag value) is given, it will link to it, otherwise it will just provide a link to the key page and show =*. See my user page User:Milliams for examples. Any complaints or should I make the change? --Milliams 18:55, 6 January 2008 (UTC)

I think this is a good idea.--Etric Celine 18:57, 6 January 2008 (UTC)
I'm glad you think so. It wouldn't be possible without the huge amount of effort you've recently put in into moving all the pages to sensible places. Thankyou :) --Milliams 19:04, 6 January 2008 (UTC)

Having though about it, I realised I wasn't catering for the case where you want to have something like bridge=yes. That would try to link to Tag:bridge=yes which of course is never going to exist. To get around this, I've added (to Template:Tag_test) the ability to do {{Tag_test|bridge||yes}} or {{Tag_test|ref||''ref number''}}. If you skip the second argument, you can pass a third argument which will display in plain text. Does this seem like a good way to do it? --Milliams 19:54, 6 January 2008 (UTC)

You are right, this might be a problem.
It is possible to catch yes/no/true/false and numbers for example with some parser functions. I've done it for the KeyValue and TagValue templates.
But this won't work for name=Bremen or ref=B23 and so on.
I think your solution should work a lot better, but could lead to misinterpretation for wiki newbies. Nonetheless lets try it your way, we can still tidy up if someone use it in a wrong way or just live with a few wrong and non existing links. :)
--Etric Celine 23:33, 6 January 2008 (UTC)
I've made the change and am about to go cleaning up any mess it caused :P I've put usage information on the template's page to try to reduce any confusion. --Milliams 12:30, 7 January 2008 (UTC)

Changing link destination

Would it make more sense to link to a section of the Key: page, so that e.g. highway=motorway links to Key:highway#motorway? --Hawke 17:08, 29 January 2008 (UTC)

Related is the idea to change the link of the Value part. Like bicycle=* should really link to Key:access#Transport_mode_restrictions:. Elrond 19:48, 4 March 2008 (UTC)

I'd say that both ideas should be done via #REDIRECT [[page#anchor]] (e.g. #REDIRECT [[Key:highway#motorway]], Key:bicycle containing #REDIRECT [[Key:access#Transport_mode_restrictions]]). I did this on bicycle=* as a test. Feel free to apply it to other Tag pages as well. -- MapFlea 16:08, 6 November 2008 (UTC)

Supporting Language Namespaces

Hi all, I noticed a discussion on the German Tag template whether or not it may be possible to check the presence of a DE article and automatically point to the English one if the German one doesn't extist (with #ifexist). What I'm wondering now is whether or not it may be possible to use this #ifexist function together with the page's namespace. Like (pseudo code) {{#ifexist {{NAMESPACE}}:Key:{{{1}}}|=[[{{NAMESPACE}}:Key:{{{1}}}|{{{1}}}]]|=[[Key:{{{1}}}|{{{1}}}]]}} … (I don't know if this code would work at all, so please really treat it as pseudo code). If it works, it could replace all language-specific Templates and still leave the user in the same language he's currently reading. -- MapFlea 10:06, 7 November 2008 (UTC)

It's done! I used Template:Key as a play ground (can someone delete it, please?) to keep the history clean and added language namespace support now. It will default to both the English (i.e. non-language-namespaced) version of Key and of Tag articles. Please spread the word! -- MapFlea 08:20, 12 November 2008 (UTC)
ok I've deleted Template:Key -- Harry Wood 10:55, 13 November 2008 (UTC)
Do you think that it should be emphasized when we link to the default (English) version of an article because there's no one in the current namespace, e.g. by using (en) (only touching namespaces other than the main one)? -- MapFlea 07:26, 13 November 2008 (UTC)

So, this doesn't work anymore? --Driver2 23:18, 23 January 2009 (UTC)

How does it work?? (the link to highway=bus_stop doesn't link to DE:Tag:highway=bus stop on DE:Tag:amenity=bus station ...) -- Schusch 21:32, 3 March 2009 (UTC)

please explain it at least in short words - does the language support normally work with this template (but works for the moment not because of technical reasons?) -- Schusch 13:24, 4 March 2009 (UTC)

The usable number of #ifexist are limited to be less than one hundred in a page. We need to avoid to use it if we can. How's it? [[{{{kl|}}}:Key:{{{1}}}|{{{1}}}]]{{#if:{{{2|}}}|=[[{{{vl|}}}:Tag:{{{1}}}={{{2}}}{{!}}{{{2}}}]]|={{{3|*}}}}} with additional parameters, kl (key's language) and vl (value's language). For example, {{Tag|kl=DE|highway|motorway}} will make links to DE:KEY:highway and Tag:highway=motorway. --Nazotoko 20:36, 30 August 2009 (UTC)

I have tested it at Template:Tag test. It looks working well. I am going to apply it to this template. --Nazotoko 02:49, 2 September 2009 (UTC)

Always render left-to-right

I think it makes sense to always render this in left-to-right order (key on the left, value on the right) even when used on right-to-left pages. To do this a dir="ltr" attribute would have to be added to the tt tag. --Lyx 11:29, 3 October 2009 (UTC)

As there are apparently no objections, I have now added the dir attribute
-- Lyx 20:34, 9 October 2009 (UTC)

State of language support

Will the language support be restored at all? When it was introduced, we replaced all uses of Template:De:Tag with this template and deleted the language-specific template, which means that all tag links currently send the user to the English page. Should Template:De:Tag be undeleted and put back into use? The kl/vl parameters aren't really a useable solution. --Tordanik 15:59, 19 October 2009 (UTC)

I am the person who made the kl/vl parameters. I know that there was Template:De:Tag and it linked DE: pages for both key and value. My suggesting solution is rebuilding Template:De:Tag as an alias of Template:Tag. Write it as {{Tag|subkey={{{subkey|}}}|kl=DE|vl=DE|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}. But before to do so, it is better to discuss the parson suggesting to delete the template. Otherwise, the rebuilded alias template will be deleted again. --Nazotoko 19:16, 3 December 2009 (UTC)

Bug in the subkey syntax

The syntaxes {{Tag|key|value|subkey=subkey}} {{Tag|key|:=subkey|value}} aren't working properly. The ":" in the #if makes an indentation, I have tried to debug it using the nowiki command, but the wikilink still doesn't work. --Gwilbor 18:15, 19 February 2010 (UTC)

Wikipedia/Wikidata links for empty values

The recently added feature for creating links if the value is a Wikipedia or Wikidata link breaks when there is only one parameter, like this:

In my opinion it should just display the usual =* without any link. --Tordanik 19:00, 10 May 2014 (UTC)

Appearance (grey background)

Today, I've noticed that tags formatted with this template have light grey boxes around them. I may be crazy, but it seems to me that they used to look different. So is this actually something new? And if so, why has it been changed? --Tordanik 13:50, 5 May 2016 (UTC)

It's been bluish grey since its creation in 2007. May be grey was still doo dark. — Verdy_p (talk) 15:14, 5 May 2016 (UTC)

Speaking of background, Template:TagKey and Template:TagValue have different background than Template:Tag.
Example: highway=primary highway primary.--Jojo4u (talk) 15:47, 27 May 2016 (UTC)

Fixed (initially I just changed Template:Tag to use a slightly lighter background #EEF instead of #DDE, due to the above comment. This was a test and in fact nobody disagreed on this change. So now I've applied it to the two other templates.
However this background color is still not (and has never been) plain grey, but always a bit bluish; in fact it is not really necessary to have a very distinctive background, as it just obscures the text inside (which already uses a distinctive monospace font, and also is normally bluish by effect of the link displayed; with a lighter background we also more easily see the red color of links to missing pages). I've also added the missing dir="ltr" attribute in one of them (needed for correct display of tag values on pages translated in RTL languages). — Verdy_p (talk) 05:06, 29 May 2016 (UTC)

Can we clarify template for what?

Could it be made explicit that this is a template for the syntax of tags? Oh, but maybe it's actually about a template for wiki markup? Or people familiar with Wikipedia may think it's a page template. After a few minutes puzzling, I'm still not sure which of those three it is! We need to make the wiki as accessible as possible to people new to the map: can anyone add any clarification? eteb3 (talk) 09:29, 19 October 2019 (UTC)

This is the standard template for typing tags in this wiki. It produces a common formatting and links to the "Key:..." and "Tag:...=..." pages. Additionally, it supports namespaces and linking to the correct translation. I can not help you with Wikipedia's categories, but I started sorting out template categorisation with Category:Templates by function. --Tigerfell This user is member of the wiki team of OSM (Let's talk) 13:46, 19 October 2019 (UTC)
Thanks. I think even more basically I need to know what a 'template' is. I think I'm inferring that a template tells you what to put in the 'Edit' box if you want a page to do X Y or Z. Is that right? eteb3 (talk) 15:05, 19 October 2019 (UTC)
A template is a piece of wiki markup you can insert by "transcluding" (meaning "adding") the template to a page. Doing so will help the editors to create a common appearance on many wiki pages. Additionally, one can change the template after transcluding it and thereby changing all pages which transclude it. The MediaWiki manual might help you: mw:Help:Templates. --Tigerfell This user is member of the wiki team of OSM (Let's talk) 09:30, 20 October 2019 (UTC)
Thanks, i've put more or less your definition into the Glossary eteb3 (talk) 17:01, 20 October 2019 (UTC)