simpleidn 0.0.6 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/LICENCE +2 -2
- data/README.rdoc +12 -8
- data/lib/simpleidn.rb +110 -86
- data/lib/simpleidn/uts46mapping.rb +6261 -0
- data/lib/simpleidn/version.rb +3 -0
- data/simpleidn.gemspec +5 -2
- data/tables/IdnaMappingTable.txt +8350 -0
- data/tables/generate_mapping_table.rb +51 -0
- metadata +23 -5
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Input is expected to follow the form found in IdnaMappingTable.txt
|
4
|
+
# from The Unicode Consortium
|
5
|
+
|
6
|
+
puts "# encoding: UTF-8\n\n"
|
7
|
+
|
8
|
+
map = {}
|
9
|
+
ARGF.each do |line|
|
10
|
+
# Copy full comment lines to output
|
11
|
+
puts line if line[0] == '#'
|
12
|
+
|
13
|
+
s = line.strip.split('#').first
|
14
|
+
next if s.nil?
|
15
|
+
|
16
|
+
p = s.split(';').map{|s| s.strip}
|
17
|
+
|
18
|
+
if p[1] == "ignored"
|
19
|
+
p[1] = "mapped"
|
20
|
+
p[2] = ""
|
21
|
+
end
|
22
|
+
|
23
|
+
next unless p[1] == "mapped" || p[1] == "disallowed_STD3_mapped"
|
24
|
+
|
25
|
+
dst = p[2].split(/\s+/).map do |hex|
|
26
|
+
hex.to_i(16)
|
27
|
+
end
|
28
|
+
if dst.length == 1
|
29
|
+
dst = dst.first
|
30
|
+
end
|
31
|
+
|
32
|
+
if p[0].include?('..')
|
33
|
+
a, b = p[0].split('..',2).map{|n|n.to_i(16)}
|
34
|
+
(a..b).each do |n|
|
35
|
+
map[n] = dst
|
36
|
+
end
|
37
|
+
else
|
38
|
+
src = p[0].to_i(16)
|
39
|
+
map[src] = dst
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Output final mapping data
|
44
|
+
puts
|
45
|
+
puts 'module SimpleIDN'
|
46
|
+
puts ' UTS64MAPPING = {'
|
47
|
+
map.each do |k, v|
|
48
|
+
puts " #{k} => #{v},"
|
49
|
+
end
|
50
|
+
puts ' }'
|
51
|
+
puts 'end'
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simpleidn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morten Møller Riis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: unf
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.4
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,12 +75,17 @@ extensions: []
|
|
61
75
|
extra_rdoc_files: []
|
62
76
|
files:
|
63
77
|
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
64
79
|
- Gemfile
|
65
80
|
- LICENCE
|
66
81
|
- README.rdoc
|
67
82
|
- Rakefile
|
68
83
|
- lib/simpleidn.rb
|
84
|
+
- lib/simpleidn/uts46mapping.rb
|
85
|
+
- lib/simpleidn/version.rb
|
69
86
|
- simpleidn.gemspec
|
87
|
+
- tables/IdnaMappingTable.txt
|
88
|
+
- tables/generate_mapping_table.rb
|
70
89
|
homepage: https://github.com/mmriis/simpleidn
|
71
90
|
licenses:
|
72
91
|
- MIT
|
@@ -79,15 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
98
|
requirements:
|
80
99
|
- - ">="
|
81
100
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
101
|
+
version: '2.2'
|
83
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
103
|
requirements:
|
85
104
|
- - ">="
|
86
105
|
- !ruby/object:Gem::Version
|
87
106
|
version: '0'
|
88
107
|
requirements: []
|
89
|
-
|
90
|
-
rubygems_version: 2.4.5
|
108
|
+
rubygems_version: 3.1.2
|
91
109
|
signing_key:
|
92
110
|
specification_version: 4
|
93
111
|
summary: Punycode ACE to unicode UTF-8 (and vice-versa) string conversion.
|