[PR #23] [MERGED] Added country code as id to all flags #642

Closed
opened 2026-03-03 14:40:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lipis/flag-icons/pull/23
Author: @mdxs
Created: 6/12/2014
Status: Merged
Merged: 6/12/2014
Merged by: @lipis

Base: masterHead: add_flag_ids


📝 Commits (1)

  • d640f41 Added country code as id to all flags

📊 Changes

1 file changed (+249 additions, -249 deletions)

View changed files

📝 index.html (+249 -249)

📄 Description

The index.html already listed the country codes (that is: the ISO 3166-1-alpha-2 code of a country) as their title such that hoovering over them showed the code. Now this PR adds the same code as their id, allowing users to try and jump to a particular flag using for example http://lipis.github.io/flag-icon-css/#np to jump to the area in which the national flag of Nepal is shown.

The following rough Python code has been used to generate the patched index.html output:

import re

_flag_re = re.compile(r'(?P<prefix>.+) title="(?P<code>.+)"></div></div></div>$')

with open('index.html', 'r') as f:
  lines = f.readlines()

codes = []
for line in lines:
  m = _flag_re.match(line)
  if m:
    print r'%(prefix)s title="%(code)s" id="%(code)s"></div></div></div>' % m.groupdict()
    codes.append(m.groupdict()['code'])
  else:
    print line.rstrip()

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lipis/flag-icons/pull/23 **Author:** [@mdxs](https://github.com/mdxs) **Created:** 6/12/2014 **Status:** ✅ Merged **Merged:** 6/12/2014 **Merged by:** [@lipis](https://github.com/lipis) **Base:** `master` ← **Head:** `add_flag_ids` --- ### 📝 Commits (1) - [`d640f41`](https://github.com/lipis/flag-icons/commit/d640f41ad366155acb7b7240ff396d89ac414eab) Added country code as id to all flags ### 📊 Changes **1 file changed** (+249 additions, -249 deletions) <details> <summary>View changed files</summary> 📝 `index.html` (+249 -249) </details> ### 📄 Description The `index.html` already listed the country codes (that is: the ISO 3166-1-alpha-2 code of a country) as their `title` such that hoovering over them showed the code. Now this PR adds the same code as their `id`, allowing users to try and jump to a particular flag using for example http://lipis.github.io/flag-icon-css/#np to jump to the area in which the national flag of Nepal is shown. The following rough Python code has been used to generate the patched `index.html` output: ``` import re _flag_re = re.compile(r'(?P<prefix>.+) title="(?P<code>.+)"></div></div></div>$') with open('index.html', 'r') as f: lines = f.readlines() codes = [] for line in lines: m = _flag_re.match(line) if m: print r'%(prefix)s title="%(code)s" id="%(code)s"></div></div></div>' % m.groupdict() codes.append(m.groupdict()['code']) else: print line.rstrip() ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 14:40:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flag-icons#642
No description provided.