whimsy-asf 0.0.45 → 0.0.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/asf.version +1 -1
- data/lib/whimsy/asf/icla.rb +88 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bc6997362bf3158089292cac392c1739f19518a
|
4
|
+
data.tar.gz: cb4e2622ea38148c6621d3f37cf6b9bac45d3457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8cf182dc4f990db6aec7a24612f6ad73a6062e6d985cf7689459d99a36710b4b168bc6e02ff27eb757eea17492cf4f9c0efa49fe56d5fc4fc896edbe5694e70
|
7
|
+
data.tar.gz: f6d32065c6acd7e25b02abddf5ff3650071c67a0f55852870f89935973cf843dbdaafaef1f30432f165a02deb4aae145e0aa908e774eee8d3d669364e59eac95
|
data/asf.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.46
|
data/lib/whimsy/asf/icla.rb
CHANGED
@@ -49,6 +49,94 @@ module ASF
|
|
49
49
|
iclas.scan(/^([-\w]+):(.*?):(.*?):(.*?):/).each(&block)
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
# sort support
|
54
|
+
|
55
|
+
def self.asciize(name)
|
56
|
+
if name.match /[^\x00-\x7F]/
|
57
|
+
# digraphs. May be culturally sensitive
|
58
|
+
name.gsub! /\u00df/, 'ss'
|
59
|
+
name.gsub! /\u00e4|a\u0308/, 'ae'
|
60
|
+
name.gsub! /\u00e5|a\u030a/, 'aa'
|
61
|
+
name.gsub! /\u00e6/, 'ae'
|
62
|
+
name.gsub! /\u00f1|n\u0303/, 'ny'
|
63
|
+
name.gsub! /\u00f6|o\u0308/, 'oe'
|
64
|
+
name.gsub! /\u00fc|u\u0308/, 'ue'
|
65
|
+
|
66
|
+
# latin 1
|
67
|
+
name.gsub! /[\u00e0-\u00e5]/, 'a'
|
68
|
+
name.gsub! /\u00e7/, 'c'
|
69
|
+
name.gsub! /[\u00e8-\u00eb]/, 'e'
|
70
|
+
name.gsub! /[\u00ec-\u00ef]/, 'i'
|
71
|
+
name.gsub! /[\u00f2-\u00f6]|\u00f8/, 'o'
|
72
|
+
name.gsub! /[\u00f9-\u00fc]/, 'u'
|
73
|
+
name.gsub! /[\u00fd\u00ff]/, 'y'
|
74
|
+
|
75
|
+
# Latin Extended-A
|
76
|
+
name.gsub! /[\u0100-\u0105]/, 'a'
|
77
|
+
name.gsub! /[\u0106-\u010d]/, 'c'
|
78
|
+
name.gsub! /[\u010e-\u0111]/, 'd'
|
79
|
+
name.gsub! /[\u0112-\u011b]/, 'e'
|
80
|
+
name.gsub! /[\u011c-\u0123]/, 'g'
|
81
|
+
name.gsub! /[\u0124-\u0127]/, 'h'
|
82
|
+
name.gsub! /[\u0128-\u0131]/, 'i'
|
83
|
+
name.gsub! /[\u0132-\u0133]/, 'ij'
|
84
|
+
name.gsub! /[\u0134-\u0135]/, 'j'
|
85
|
+
name.gsub! /[\u0136-\u0138]/, 'k'
|
86
|
+
name.gsub! /[\u0139-\u0142]/, 'l'
|
87
|
+
name.gsub! /[\u0143-\u014b]/, 'n'
|
88
|
+
name.gsub! /[\u014C-\u0151]/, 'o'
|
89
|
+
name.gsub! /[\u0152-\u0153]/, 'oe'
|
90
|
+
name.gsub! /[\u0154-\u0159]/, 'r'
|
91
|
+
name.gsub! /[\u015a-\u0162]/, 's'
|
92
|
+
name.gsub! /[\u0162-\u0167]/, 't'
|
93
|
+
name.gsub! /[\u0168-\u0173]/, 'u'
|
94
|
+
name.gsub! /[\u0174-\u0175]/, 'w'
|
95
|
+
name.gsub! /[\u0176-\u0178]/, 'y'
|
96
|
+
name.gsub! /[\u0179-\u017e]/, 'z'
|
97
|
+
|
98
|
+
# denormalized diacritics
|
99
|
+
name.gsub! /[\u0300-\u036f]/, ''
|
100
|
+
end
|
101
|
+
|
102
|
+
name.gsub /[^\w]+/, '-'
|
103
|
+
end
|
104
|
+
|
105
|
+
SUFFIXES = /^([Jj][Rr]\.?|I{2,3}|I?V|VI{1,3}|[A-Z]\.)$/
|
106
|
+
|
107
|
+
# rearrange line in an order suitable for sorting
|
108
|
+
def self.lname(line)
|
109
|
+
return '' unless line =~ /^\w.*?:(.*?)(:(.*?):(.*?)(:(.*))?)\n?/
|
110
|
+
name, rest = $1, $2
|
111
|
+
|
112
|
+
# Drop trailing (comment string) or /* comment */
|
113
|
+
name.sub! /\(.+\)$/,''
|
114
|
+
name.sub! /\/\*.+\*\/$/,''
|
115
|
+
|
116
|
+
name = name.split.reverse
|
117
|
+
suffix = (name.shift if name.first =~ SUFFIXES)
|
118
|
+
suffix += ' ' + name.shift if name.first =~ SUFFIXES
|
119
|
+
name << name.shift
|
120
|
+
name << name.shift if name.first=='Lewis' and name.last=='Ship'
|
121
|
+
name << name.shift if name.first=='Gallardo' and name.last=='Rivera'
|
122
|
+
name << name.shift if name.first=="S\u00e1nchez" and name.last=='Vega'
|
123
|
+
# name << name.shift if name.first=='van'
|
124
|
+
name.last.sub! /^IJ/, 'Ij'
|
125
|
+
name.unshift(suffix) if suffix
|
126
|
+
name.map! {|word| asciize(word)}
|
127
|
+
name = name.reverse.join(' ')
|
128
|
+
|
129
|
+
name + rest
|
130
|
+
end
|
131
|
+
|
132
|
+
# sort an entire iclas.txt file
|
133
|
+
def self.sort(source)
|
134
|
+
headers = source.scan(/^#.*/)
|
135
|
+
lines = source.scan(/^\w.*/)
|
136
|
+
|
137
|
+
headers.join("\n") + "\n" +
|
138
|
+
lines.sort_by {|line| lname(line + "\n")}.join("\n") + "\n"
|
139
|
+
end
|
52
140
|
end
|
53
141
|
|
54
142
|
class Person
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whimsy-asf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|