lipis/flag-icon-css — pull request #23 by mdxs (2014-06-12 21:51:01+00:00)
Title: Added country code as id to all flags

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.+) title="(?P.+)">

$')

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">

' % m.groupdict()
codes.append(m.groupdict()['code'])
else:
print line.rstrip()
```