Template talk:Flagof

Latest comment: 1 year ago by Theurgist in topic Redundant linking

Nepal in tables edit

Getting a weird sizing error with Nepal when used in a table. Observe:

{|class="sortable wikitable"
|-
|{{#if:<!--
-->|{{{{#if:{{#if:India||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|flag alias={{{image}}}<!--
  -->|alias={{#ifexist:Template:Country data India|{{getalias|India}}|India}}<!--
  -->|name=India<!--
  -->|border=border<!--
  -->|size=30x20px<!--
  -->}}<!--
-->|{{country data India|{{#if:{{#if:India||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|name=India<!--
  -->|variant=<!--
  -->|size=30x20px<!--
  -->}}<!--
-->}}{{#if:| [[Flag of {{#ifexist:Template:Country data India|{{getalias|India}}|India}}{{#if:|#{{{section}}}}}|India]]}}
|-
|{{#if:<!--
-->|{{{{#if:{{#if:Nepal||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|flag alias={{{image}}}<!--
  -->|alias={{#ifexist:Template:Country data Nepal|{{getalias|Nepal}}|Nepal}}<!--
  -->|name=Nepal<!--
  -->|border=border<!--
  -->|size=30x20px<!--
  -->}}<!--
-->|{{country data Nepal|{{#if:{{#if:Nepal||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|name=Nepal<!--
  -->|variant=<!--
  -->|size=30x20px<!--
  -->}}<!--
-->}}{{#if:| [[Flag of {{#ifexist:Template:Country data Nepal|{{getalias|Nepal}}|Nepal}}{{#if:|#{{{section}}}}}|Nepal]]}}
|-
|}

But outside of the table:

*{{#if:<!--
-->|{{{{#if:{{#if:India||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|flag alias={{{image}}}<!--
  -->|alias={{#ifexist:Template:Country data India|{{getalias|India}}|India}}<!--
  -->|name=India<!--
  -->|border=border<!--
  -->|size=30x20px<!--
  -->}}<!--
-->|{{country data India|{{#if:{{#if:India||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|name=India<!--
  -->|variant=<!--
  -->|size=30x20px<!--
  -->}}<!--
-->}}{{#if:| [[Flag of {{#ifexist:Template:Country data India|{{getalias|India}}|India}}{{#if:|#{{{section}}}}}|India]]}}
*{{#if:<!--
-->|{{{{#if:{{#if:Nepal||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|flag alias={{{image}}}<!--
  -->|alias={{#ifexist:Template:Country data Nepal|{{getalias|Nepal}}|Nepal}}<!--
  -->|name=Nepal<!--
  -->|border=border<!--
  -->|size=30x20px<!--
  -->}}<!--
-->|{{country data Nepal|{{#if:{{#if:Nepal||1}}{{#if:{{{link}}}||1}}|flagdeco/core|flagof/core}}<!--
  -->|name=Nepal<!--
  -->|variant=<!--
  -->|size=30x20px<!--
  -->}}<!--
-->}}{{#if:| [[Flag of {{#ifexist:Template:Country data Nepal|{{getalias|Nepal}}|Nepal}}{{#if:|#{{{section}}}}}|Nepal]]}}

Any ideas what could be causing this? Ibadibam (talk) 23:10, 25 November 2014 (UTC)Reply

The template {{flagof|Nepal}} expands to
<span class="flagicon">[[File:Flag of Nepal.svg|30x20px||alt=|link=]]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>[[Flag of Nepal|Nepal]]
whether in a table or not. For some reason the empty parameter (the double pipe between the size and alt text) causes the flag image to display in its default size if inside a table. I added a space between the pipes, which is how {{flag}} avoids this issue. SiBr4 (talk) 08:56, 26 November 2014 (UTC)Reply

Template not working with US or German flags edit

Hello! I'd just like to report that this template currently isn't working for either the US or German flags. As of the time of this post, both the US and Germany flags do not show up. Most everything else I've tried seems to work. Here's an example:

I discovered this while browsing List of flag names and noticed that the US flag wasn't showing up. If someone would be so kind as to take a look at this, I'd appreciate it! Thanks a bunch! Phuzion (talk) 14:36, 5 May 2020 (UTC)Reply

Module:CountryData was failing to parse these countries' data templates after recent edits by Ahecht to make them substitutable. It is fixed now, although the module should probably be changed to not require such specific string patterns to consider a data template valid. SiBr4 (talk) 18:41, 5 May 2020 (UTC)Reply
@SiBr4: Thanks. That use case didn't show up in the testcases on those templates. Ideally, we'd import all the country data into a Lua module, and then there's a whole slew of templates that could be simplified (I can't count how many pages excees the post-expand include size limit because they use {{flagicon|{{{1}}}}} which calls {{country data {{{1}}}|flagicon/core}} which calls {{flagicon/core|{{{flag alias-{{{variant}}}}} which finally displays the flag, quadrupling the post-expand include size. --Ahecht (TALK
PAGE
) 21:23, 5 May 2020 (UTC)Reply

Redundant linking edit

The flag and the display name both link to the same article, e.g. Flag of Spain. I think the link from the flag should be removed, or retargeted to the actual file page – File:Flag of Spain.svg or whatever other variant is used – because the flag in question can be different from the default one mentioned first in the article. However, I can't figure out how to do either. --Theurgist (talk) 02:31, 2 February 2023 (UTC)Reply