isbnranges 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a76034ca4aae26d14b546e558e165f8b048566a78ffc109b44459e5fbe401495
4
+ data.tar.gz: e6a18b2721d8ced186eb7736cbb9193fa43889d77a25809abaa9c76ba204011f
5
+ SHA512:
6
+ metadata.gz: 247da0eaa3f61ff0f13415cd41639e8d0eb0c348b4d342e9d22f41fdc403cf9f6fcc9d9595ddd68fa50aedf7f12aece6bd5dae600330237fba6edee9df3d378d
7
+ data.tar.gz: ea798bde2b5e4ce3d52369cb9d6dd9486e18f6dff1aeb49667ae88726ac2b6cedb7775da10e2e17f4e26c71a587cfc3503b0bca85c360f57ccba7fdf5344ddf5
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # ISBNRanges
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/isbnranges`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/isbnranges.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
9
+
10
+ namespace :range do
11
+ desc "Generate range definition files"
12
+ task :generate do
13
+ ruby "scripts/generate_range_files.rb --dir data"
14
+ end
15
+ end
@@ -0,0 +1,553 @@
1
+ # Generated from RangeMessage.xml file, downloaded from https://www.isbn-international.org/range_file_generation.
2
+ #
3
+ # International ISBN Agency
4
+ # Tue, 13 Aug 2024 06:15:38 BST
5
+ #
6
+ # English language
7
+ 978-0:00-19,200-227,2280-2289,229-368,3690-3699,370-638,6390-6397,6398000-6399999,640-644,6450000-6459999,646-647,6480000-6489999,649-654,6550-6559,656-699,7000-8499,85000-89999,900000-900370,9003710-9003719,900372-949999,9500000-9999999
8
+ # English language
9
+ 978-1:000-009,01-02,030-034,0350-0399,040-049,05-05,0670000-0699999,0700-0999,100-397,3980-5499,55000-64999,6500-6799,68000-68599,6860-7139,714-716,7170-7319,7320000-7399999,74000-76199,7620-7634,7635000-7649999,76500-77499,7750000-7753999,77540-77639,7764000-7764999,77650-77699,7770000-7782999,77830-78999,7900-7999,80000-80049,80050-80499,80500-83799,8380000-8384999,83850-86719,8672-8675,86760-86979,869800-915999,9160000-9165059,916506-916869,9168700-9169079,916908-919599,9196000-9196549,919655-972999,9730-9877,987800-991149,9911500-9911999,991200-998989,9989900-9999999
10
+ # French language
11
+ 978-2:00-19,200-349,35000-39999,400-486,487000-494999,495-495,4960-4966,49670-49699,497-527,5280-5299,530-699,7000-8399,84000-89999,900000-919799,91980-91980,919810-919942,9199430-9199689,919969-949999,9500000-9999999
12
+ # German language
13
+ 978-3:00-02,030-033,0340-0369,03700-03999,04-19,200-389,39-39,400-688,68900-69499,6950-8499,85000-89999,900000-949999,9500000-9539999,95400-96999,9700000-9849999,98500-99959,9996-9999
14
+ # Japan
15
+ 978-4:00-19,200-699,7000-8499,85000-89999,900000-949999,9500000-9999999
16
+ # former U.S.S.R
17
+ 978-5:00000-00499,0050-0099,01-19,200-361,3620-3623,36240-36299,363-420,4210-4299,430-430,4310-4399,440-440,4410-4499,450-603,6040000-6049999,605-699,7000-8499,85000-89999,900000-909999,91000-91999,9200-9299,93000-94999,9500000-9500999,9501-9799,98000-98999,9900000-9909999,9910-9999
18
+ # Iran
19
+ 978-600:00-09,100-499,5000-8999,90000-98679,9868-9929,993-995,99600-99999
20
+ # Kazakhstan
21
+ 978-601:00-19,200-699,7000-7999,80000-84999,85-99
22
+ # Indonesia
23
+ 978-602:00-06,0700-1399,14000-14999,1500-1699,17000-19999,200-499,50000-53999,5400-5999,60000-61999,6200-6999,70000-74999,7500-9499,95000-99999
24
+ # Saudi Arabia
25
+ 978-603:00-04,05-49,500-799,8000-8999,90000-99999
26
+ # Vietnam
27
+ 978-604:0-2,300-399,40-46,470-497,4980-4999,50-89,900-979,9800-9999
28
+ # Türkiye
29
+ 978-605:00-02,030-039,04-05,06000-06999,07-09,100-199,2000-2399,240-399,4000-5999,60000-74999,7500-7999,80000-89999,9000-9999
30
+ # Romania
31
+ 978-606:000-099,10-49,500-799,8000-9099,910-919,92000-95999,9600-9749,975-999
32
+ # Mexico
33
+ 978-607:00-39,400-588,5890-5929,59300-59999,600-694,69500-69999,700-749,7500-9499,95000-99999
34
+ # North Macedonia
35
+ 978-608:0-0,10-19,200-449,4500-6499,65000-69999,7-9
36
+ # Lithuania
37
+ 978-609:00-39,400-799,8000-9499,95000-99999
38
+ # Thailand
39
+ 978-611:
40
+ # Peru
41
+ 978-612:00-29,300-399,4000-4499,45000-49999,5000-5224
42
+ # Mauritius
43
+ 978-613:0-9
44
+ # Lebanon
45
+ 978-614:00-39,400-799,8000-9499,95000-99999
46
+ # Hungary
47
+ 978-615:00-09,100-499,5000-7999,80000-89999
48
+ # Thailand
49
+ 978-616:00-19,200-699,7000-8999,90000-99999
50
+ # Ukraine
51
+ 978-617:00-49,500-699,7000-8999,90000-99999
52
+ # Greece
53
+ 978-618:00-19,200-499,5000-7999,80000-99999
54
+ # Bulgaria
55
+ 978-619:00-14,150-699,7000-8999,90000-99999
56
+ # Mauritius
57
+ 978-620:0-9
58
+ # Philippines
59
+ 978-621:00-29,400-599,8000-8999,95000-99999
60
+ # Iran
61
+ 978-622:00-10,200-459,4800-8499,90000-99999
62
+ # Indonesia
63
+ 978-623:00-10,110-519,5250-8799,88000-99999
64
+ # Sri Lanka
65
+ 978-624:00-04,200-249,5000-6699,93000-99999
66
+ # Türkiye
67
+ 978-625:00-01,365-442,44300-44499,445-449,6000-7793,77940-77949,7795-8499,94000-99999
68
+ # Taiwan
69
+ 978-626:00-04,300-499,7000-7999,95000-99999
70
+ # Pakistan
71
+ 978-627:30-31,500-524,7500-7999,94500-94649
72
+ # Colombia
73
+ 978-628:00-09,500-549,7500-8499,95000-99999
74
+ # Malaysia
75
+ 978-629:00-02,470-499,7500-7999,96500-99999
76
+ # Romania
77
+ 978-630:300-399,6500-6849,95000-99999
78
+ # Argentina
79
+ 978-631:00-09,300-399,6500-7499,90000-99999
80
+ # Vietnam
81
+ 978-632:00-11,600-679
82
+ # Brazil
83
+ 978-65:00-01,250-299,300-302,5000-5129,5200-6149,80000-81824,83000-89999,900000-902449,980000-999999
84
+ # China, People's Republic
85
+ 978-7:00-09,100-499,5000-7999,80000-89999,900000-999999
86
+ # former Czechoslovakia
87
+ 978-80:00-19,200-529,53000-54999,550-689,69000-69999,7000-8499,85000-89999,900000-998999,99900-99999
88
+ # India
89
+ 978-81:00-18,19000-19999,200-699,7000-8499,85000-89999,900000-999999
90
+ # Norway
91
+ 978-82:00-19,200-689,690000-699999,7000-8999,90000-98999,990000-999999
92
+ # Poland
93
+ 978-83:00-19,200-599,60000-69999,7000-8499,85000-89999,900000-999999
94
+ # Spain
95
+ 978-84:00-09,10000-10499,1050-1199,120000-129999,1300-1399,140-149,15000-19999,200-699,7000-8499,85000-89999,9000-9199,920000-923999,92400-92999,930000-949999,95000-96999,9700-9999
96
+ # Brazil
97
+ 978-85:00-19,200-454,455000-455299,45530-45599,456-528,52900-53199,5320-5339,534-539,54000-54029,54030-54039,540400-540499,54050-54089,540900-540999,54100-54399,5440-5479,54800-54999,5500-5999,60000-69999,7000-8499,85000-89999,900000-924999,92500-94499,9450-9599,96-97,98000-99999
98
+ # former Yugoslavia
99
+ 978-86:00-29,300-599,6000-7999,80000-89999,900000-999999
100
+ # Denmark
101
+ 978-87:00-29,400-649,7000-7999,85000-94999,970000-999999
102
+ # Italy
103
+ 978-88:00-19,200-311,31200-31499,315-318,31900-32299,323-326,3270-3389,339-360,3610-3629,363-548,5490-5549,555-599,6000-8499,85000-89999,900000-909999,910-926,9270-9399,940000-947999,94800-99999
104
+ # Korea, Republic
105
+ 978-89:00-24,250-549,5500-8499,85000-94999,950000-969999,97000-98999,990-999
106
+ # Netherlands
107
+ 978-90:00-19,200-499,5000-6999,70000-79999,800000-849999,8500-8999,90-90,94-94
108
+ # Sweden
109
+ 978-91:0-1,20-49,500-649,7000-8199,85000-94999,970000-999999
110
+ # International NGO Publishers and EU Organizations
111
+ 978-92:0-5,60-79,800-899,9000-9499,95000-98999,990000-999999
112
+ # India
113
+ 978-93:00-09,100-479,48000-49999,5000-7999,80000-95999,960000-999999
114
+ # Netherlands
115
+ 978-94:000-599,6000-6387,638800-638809,63881-63881,638820-638839,63884-63885,638860-638869,63887-63889,6389-6395,639600-639609,63961-63962,639630-639639,63964-63964,639650-639659,63966-63969,6397-6399,640000-640009,64001-64004,640050-640059,64006-64006,640070-640089,64009-64009,6401-6406,640700-640739,64074-64074,640750-640759,64076-64077,640780-640799,6408-6419,64200-64201,642020-642029,64203-64203,642040-642049,64205-64206,642070-642079,64208-64208,642090-642099,6421-6432,64330-64331,643320-643329,64333-64333,643340-643359,64336-64336,643370-643379,64338-64339,6434-6435,643600-643609,64361-64363,643640-643659,64366-64366,643670-643679,64368-64369,6437-6443,644400-644409,64441-64441,644420-644429,64443-64443,644440-644449,64445-64446,644470-644489,64449-64449,6445-6450,64510-64512,645130-645139,64514-64515,645160-645199,6452-6458,645900-645909,64591-64592,645930-645949,64595-64596,645970-645989,64599-64599,6460-6465,646600-646609,64661-64662,646630-646659,64666-64666,646670-646689,64669-64669,6467-6474,64750-64751,647520-647539,64754-64754,647550-647559,64756-64757,647580-647589,64759-64759,6476-6476,647700-647708,64771-64771,647723-647729,64773-64773,647740-647769,64777-64779,647800-647809,64781-64781,647820-647829,64783-64786,647870-647879,64788-64789,6479-6493,649400-649409,64941-64942,649430-649449,64945-64946,649470-649479,64948-64948,649490-649499,6495-6497,64980-64980,649810-649829,64983-64984,649850-649869,64987-64987,649880-649883,6499-8999,90000-99999
116
+ # Argentina
117
+ 978-950:00-49,500-899,9000-9899,99000-99999
118
+ # Finland
119
+ 978-951:0-1,20-54,550-889,8900-9499,95000-99999
120
+ # Finland
121
+ 978-952:00-19,200-499,5000-5999,60-64,65000-65999,6600-6699,67000-69999,7000-7999,80-94,9500-9899,99000-99999
122
+ # Croatia
123
+ 978-953:0-0,10-14,150-459,46000-49999,500-500,50100-50999,51-54,55000-59999,6000-9499,95000-99999
124
+ # Bulgaria
125
+ 978-954:00-28,2900-2999,300-799,8000-8999,90000-92999,9300-9999
126
+ # Sri Lanka
127
+ 978-955:0000-1999,20-33,3400-3549,35500-35999,3600-3799,38000-38999,3900-4099,41000-44999,4500-4999,50000-54999,550-710,71100-71499,7150-9499,95000-99999
128
+ # Chile
129
+ 978-956:00-07,08000-08499,09000-09999,10-19,200-599,6000-6999,7000-9999
130
+ # Taiwan
131
+ 978-957:00-02,0300-0499,05-19,2000-2099,21-27,28000-30999,31-43,440-819,8200-9699,97000-99999
132
+ # Colombia
133
+ 978-958:00-49,500-509,5100-5199,52000-53999,5400-5599,56000-59999,600-799,8000-9499,95000-99999
134
+ # Cuba
135
+ 978-959:00-19,200-699,7000-8499,85000-99999
136
+ # Greece
137
+ 978-960:00-19,200-659,6600-6899,690-699,7000-8499,85000-92999,93-93,9400-9799,98000-99999
138
+ # Slovenia
139
+ 978-961:00-19,200-599,6000-8999,90000-97999
140
+ # Hong Kong, China
141
+ 978-962:00-19,200-699,7000-8499,85000-86999,8700-8999,900-999
142
+ # Hungary
143
+ 978-963:00-19,200-699,7000-8499,85000-89999,9000-9999
144
+ # Iran
145
+ 978-964:00-14,150-249,2500-2999,300-549,5500-8999,90000-96999,970-989,9900-9999
146
+ # Israel
147
+ 978-965:00-19,200-599,7000-7999,90000-99999
148
+ # Ukraine
149
+ 978-966:00-12,130-139,14-14,1500-1699,170-199,2000-2789,279-289,2900-2999,300-699,7000-8999,90000-90999,910-949,95000-97999,980-999
150
+ # Malaysia
151
+ 978-967:0000-0999,10000-19999,2000-2499,250-254,25500-26999,2700-2799,2800-2999,300-499,5000-5999,60-89,900-989,9900-9989,99900-99999
152
+ # Mexico
153
+ 978-968:01-39,400-499,5000-7999,800-899,9000-9999
154
+ # Pakistan
155
+ 978-969:0-1,20-20,210-219,2200-2299,23000-23999,24-39,400-749,7500-9999
156
+ # Mexico
157
+ 978-970:01-59,600-899,9000-9099,91000-96999,9700-9999
158
+ # Philippines
159
+ 978-971:000-015,0160-0199,02-02,0300-0599,06-49,500-849,8500-9099,91000-95999,9600-9699,97-98,9900-9999
160
+ # Portugal
161
+ 978-972:0-1,20-54,550-799,8000-9499,95000-99999
162
+ # Romania
163
+ 978-973:0-0,100-169,1700-1999,20-54,550-759,7600-8499,85000-88999,8900-9499,95000-99999
164
+ # Thailand
165
+ 978-974:00-19,200-699,7000-8499,85000-89999,90000-94999,9500-9999
166
+ # Türkiye
167
+ 978-975:00000-01999,02-23,2400-2499,250-599,6000-9199,92000-98999,990-999
168
+ # Caribbean Community
169
+ 978-976:0-3,40-59,600-799,8000-9499,95000-99999
170
+ # Egypt
171
+ 978-977:00-19,200-499,5000-6999,700-849,85000-87399,8740-8899,890-894,8950-8999,90-95,9600-9699,970-999
172
+ # Nigeria
173
+ 978-978:000-199,2000-2999,30000-69999,765-799,8000-8999,900-999
174
+ # Indonesia
175
+ 978-979:000-099,1000-1499,15000-19999,20-29,3000-3999,400-799,8000-9499,95000-99999
176
+ # Venezuela
177
+ 978-980:00-19,200-599,6000-9999
178
+ # Singapore
179
+ 978-981:00-16,17000-17999,18-19,200-299,3000-3099,310-399,4000-5999,94-94,96-99
180
+ # South Pacific
181
+ 978-982:00-09,100-699,70-89,9000-9799,98000-99999
182
+ # Malaysia
183
+ 978-983:00-01,020-199,2000-3999,40000-44999,45-49,50-79,800-899,9000-9899,99000-99999
184
+ # Bangladesh
185
+ 978-984:00-39,400-799,8000-8999,90000-99999
186
+ # Belarus
187
+ 978-985:00-39,400-599,6000-8799,880-899,90000-99999
188
+ # Taiwan
189
+ 978-986:00-05,06000-06999,0700-0799,08-11,120-539,5400-7999,80000-99999
190
+ # Argentina
191
+ 978-987:00-09,1000-1999,20000-29999,30-35,3600-4199,42-43,4400-4499,45000-48999,4900-4999,500-824,8250-8279,82800-82999,8300-8499,85-88,8900-9499,95000-99999
192
+ # Hong Kong, China
193
+ 978-988:00-11,12000-19999,200-699,70000-79999,8000-9699,97000-99999
194
+ # Portugal
195
+ 978-989:0-1,20-34,35000-36999,37-52,53000-54999,550-799,8000-9499,95000-99999
196
+ # Tunisia
197
+ 978-9909:00-19,750-849,9800-9999
198
+ # Uzbekistan
199
+ 978-9910:01-09,650-799,8800-9999
200
+ # Montenegro
201
+ 978-9911:20-24,550-749,9500-9999
202
+ # Tanzania
203
+ 978-9912:40-44,750-799,9800-9999
204
+ # Uganda
205
+ 978-9913:00-07,600-699,9550-9999
206
+ # Kenya
207
+ 978-9914:40-55,700-774,9600-9999
208
+ # Uruguay
209
+ 978-9915:40-59,650-799,9300-9999
210
+ # Estonia
211
+ 978-9916:0-0,10-39,4-5,600-799,80-91,9250-9999
212
+ # Bolivia
213
+ 978-9917:0-0,30-34,600-699,9700-9999
214
+ # Malta
215
+ 978-9918:0-0,20-29,600-799,9500-9999
216
+ # Mongolia
217
+ 978-9919:0-0,20-29,500-599,9000-9999
218
+ # Morocco
219
+ 978-9920:28-42,480-799,8750-9999
220
+ # Kuwait
221
+ 978-9921:0-0,30-39,700-899,9700-9999
222
+ # Iraq
223
+ 978-9922:20-29,600-799,8500-9999
224
+ # Jordan
225
+ 978-9923:0-0,10-69,700-899,9400-9999
226
+ # Cambodia
227
+ 978-9924:30-39,500-649,9000-9999
228
+ # Cyprus
229
+ 978-9925:0-2,30-54,550-734,7350-9999
230
+ # Bosnia and Herzegovina
231
+ 978-9926:0-1,20-39,400-799,8000-9999
232
+ # Qatar
233
+ 978-9927:00-09,100-399,4000-4999
234
+ # Albania
235
+ 978-9928:00-09,100-399,4000-4999,800-899,90-99
236
+ # Guatemala
237
+ 978-9929:0-3,40-54,550-799,8000-9999
238
+ # Costa Rica
239
+ 978-9930:00-49,500-939,9400-9999
240
+ # Algeria
241
+ 978-9931:00-23,240-899,9000-9999
242
+ # Lao People's Democratic Republic
243
+ 978-9932:00-39,400-849,8500-9999
244
+ # Syria
245
+ 978-9933:0-0,10-39,400-869,87-89,9000-9999
246
+ # Latvia
247
+ 978-9934:0-0,10-49,500-799,8000-9999
248
+ # Iceland
249
+ 978-9935:0-0,10-39,400-899,9000-9999
250
+ # Afghanistan
251
+ 978-9936:0-1,20-39,400-799,8000-9999
252
+ # Nepal
253
+ 978-9937:0-2,30-49,500-799,8000-9999
254
+ # Tunisia
255
+ 978-9938:00-79,800-949,9500-9749,975-990,9910-9999
256
+ # Armenia
257
+ 978-9939:0-3,40-79,800-899,9000-9599,960-979,98-99
258
+ # Montenegro
259
+ 978-9940:0-1,20-49,500-839,84-86,8700-9999
260
+ # Georgia
261
+ 978-9941:0-0,10-39,400-799,8-8,9000-9999
262
+ # Ecuador
263
+ 978-9942:00-59,600-699,7000-7499,750-849,8500-8999,900-984,9850-9999
264
+ # Uzbekistan
265
+ 978-9943:00-29,300-399,4000-9749,975-999
266
+ # Türkiye
267
+ 978-9944:0000-0999,100-499,5000-5999,60-69,700-799,80-89,900-999
268
+ # Dominican Republic
269
+ 978-9945:00-00,010-079,08-39,400-569,57-57,580-799,80-80,810-849,8500-9999
270
+ # Korea, P.D.R.
271
+ 978-9946:0-1,20-39,400-899,9000-9999
272
+ # Algeria
273
+ 978-9947:0-1,20-79,800-999
274
+ # United Arab Emirates
275
+ 978-9948:00-39,400-849,8500-9999
276
+ # Estonia
277
+ 978-9949:00-08,090-099,10-39,400-699,70-71,7200-7499,75-89,9000-9999
278
+ # Palestine
279
+ 978-9950:00-29,300-849,8500-9999
280
+ # Kosova
281
+ 978-9951:00-38,390-849,8500-9799,980-999
282
+ # Azerbaijan
283
+ 978-9952:0-1,20-39,400-799,8000-9999
284
+ # Lebanon
285
+ 978-9953:0-0,10-39,400-599,60-89,9000-9299,93-96,970-999
286
+ # Morocco
287
+ 978-9954:0-1,20-39,400-799,8000-9899,99-99
288
+ # Lithuania
289
+ 978-9955:00-39,400-929,9300-9999
290
+ # Cameroon
291
+ 978-9956:0-0,10-39,400-899,9000-9999
292
+ # Jordan
293
+ 978-9957:00-39,400-649,65-67,680-699,70-84,8500-8799,88-99
294
+ # Bosnia and Herzegovina
295
+ 978-9958:00-01,020-029,0300-0399,040-089,0900-0999,10-18,1900-1999,20-49,500-899,9000-9999
296
+ # Libya
297
+ 978-9959:0-1,20-79,800-949,9500-9699,970-979,98-99
298
+ # Saudi Arabia
299
+ 978-9960:00-59,600-899,9000-9999
300
+ # Algeria
301
+ 978-9961:0-2,30-69,700-949,9500-9999
302
+ # Panama
303
+ 978-9962:00-54,5500-5599,56-59,600-849,8500-9999
304
+ # Cyprus
305
+ 978-9963:0-1,2000-2499,250-279,2800-2999,30-54,550-734,7350-7499,7500-9999
306
+ # Ghana
307
+ 978-9964:0-6,70-94,950-999
308
+ # Kazakhstan
309
+ 978-9965:00-39,400-899,9000-9999
310
+ # Kenya
311
+ 978-9966:000-139,14-14,1500-1999,20-69,7000-7499,750-820,8210-8249,825-825,8260-8289,829-959,9600-9999
312
+ # Kyrgyz Republic
313
+ 978-9967:00-39,400-899,9000-9999
314
+ # Costa Rica
315
+ 978-9968:00-49,500-939,9400-9999
316
+ # Algeria
317
+ 978-9969:00-06,500-649,9700-9999
318
+ # Uganda
319
+ 978-9970:00-39,400-899,9000-9999
320
+ # Singapore
321
+ 978-9971:0-5,60-89,900-989,9900-9999
322
+ # Peru
323
+ 978-9972:00-09,1-1,200-249,2500-2999,30-59,600-899,9000-9999
324
+ # Tunisia
325
+ 978-9973:00-05,060-089,0900-0999,10-69,700-969,9700-9999
326
+ # Uruguay
327
+ 978-9974:0-2,30-54,550-749,7500-8799,880-909,91-94,95-99
328
+ # Moldova
329
+ 978-9975:0-0,100-299,3000-3999,4000-4499,45-89,900-949,9500-9999
330
+ # Tanzania
331
+ 978-9976:0-4,5000-5799,580-589,59-89,900-989,9900-9999
332
+ # Costa Rica
333
+ 978-9977:00-89,900-989,9900-9999
334
+ # Ecuador
335
+ 978-9978:00-29,300-399,40-94,950-989,9900-9999
336
+ # Iceland
337
+ 978-9979:0-4,50-64,650-659,66-75,760-899,9000-9999
338
+ # Papua New Guinea
339
+ 978-9980:0-3,40-89,900-989,9900-9999
340
+ # Morocco
341
+ 978-9981:00-09,100-159,1600-1999,20-79,800-949,9500-9999
342
+ # Zambia
343
+ 978-9982:00-79,800-989,9900-9999
344
+ # Gambia
345
+ 978-9983:80-94,950-989,9900-9999
346
+ # Latvia
347
+ 978-9984:00-49,500-899,9000-9999
348
+ # Estonia
349
+ 978-9985:0-4,50-79,800-899,9000-9999
350
+ # Lithuania
351
+ 978-9986:00-39,400-899,9000-9399,940-969,97-99
352
+ # Tanzania
353
+ 978-9987:00-39,400-879,8800-9999
354
+ # Ghana
355
+ 978-9988:0-3,40-54,550-749,7500-9999
356
+ # North Macedonia
357
+ 978-9989:0-0,100-199,2000-2999,30-59,600-949,9500-9999
358
+ # Bahrain
359
+ 978-99901:00-49,500-799,80-99
360
+ # Reserved Agency
361
+ 978-99902:
362
+ # Mauritius
363
+ 978-99903:0-1,20-89,900-999
364
+ # Curaçao
365
+ 978-99904:0-5,60-89,900-999
366
+ # Bolivia
367
+ 978-99905:0-3,40-79,800-999
368
+ # Kuwait
369
+ 978-99906:0-2,30-59,600-699,70-89,90-94,950-999
370
+ # Malawi
371
+ 978-99908:0-0,10-89,900-999
372
+ # Malta
373
+ 978-99909:0-3,40-94,950-999
374
+ # Sierra Leone
375
+ 978-99910:0-2,30-89,900-999
376
+ # Lesotho
377
+ 978-99911:00-59,600-999
378
+ # Botswana
379
+ 978-99912:0-3,400-599,60-89,900-999
380
+ # Andorra
381
+ 978-99913:0-2,30-35,600-604
382
+ # International NGO Publishers
383
+ 978-99914:0-4,50-69,7-7,80-86,870-879,88-89,900-999
384
+ # Maldives
385
+ 978-99915:0-4,50-79,800-999
386
+ # Namibia
387
+ 978-99916:0-2,30-69,700-999
388
+ # Brunei Darussalam
389
+ 978-99917:0-2,30-88,890-999
390
+ # Faroe Islands
391
+ 978-99918:0-3,40-79,800-999
392
+ # Benin
393
+ 978-99919:0-2,300-399,40-79,800-999
394
+ # Andorra
395
+ 978-99920:0-4,50-89,900-999
396
+ # Qatar
397
+ 978-99921:0-1,20-69,700-799,8-8,90-99
398
+ # Guatemala
399
+ 978-99922:0-3,40-69,700-999
400
+ # El Salvador
401
+ 978-99923:0-1,20-79,800-999
402
+ # Nicaragua
403
+ 978-99924:0-1,20-79,800-999
404
+ # Paraguay
405
+ 978-99925:0-0,10-19,200-299,3-3,40-79,800-999
406
+ # Honduras
407
+ 978-99926:0-0,10-59,600-869,87-89,90-99
408
+ # Albania
409
+ 978-99927:0-2,30-59,600-999
410
+ # Georgia
411
+ 978-99928:0-0,10-79,800-999
412
+ # Mongolia
413
+ 978-99929:0-4,50-79,800-999
414
+ # Armenia
415
+ 978-99930:0-4,50-79,800-999
416
+ # Seychelles
417
+ 978-99931:0-4,50-79,800-999
418
+ # Malta
419
+ 978-99932:0-0,10-59,600-699,7-7,80-99
420
+ # Nepal
421
+ 978-99933:0-2,30-59,600-999
422
+ # Dominican Republic
423
+ 978-99934:0-1,20-79,800-999
424
+ # Haiti
425
+ 978-99935:0-2,30-59,600-699,7-8,90-99
426
+ # Bhutan
427
+ 978-99936:0-0,10-59,600-999
428
+ # Macau
429
+ 978-99937:0-1,20-59,600-999
430
+ # Srpska, Republic of
431
+ 978-99938:0-1,20-59,600-899,90-99
432
+ # Guatemala
433
+ 978-99939:0-2,30-59,60-89,900-999
434
+ # Georgia
435
+ 978-99940:0-0,10-69,700-999
436
+ # Armenia
437
+ 978-99941:0-2,30-79,800-999
438
+ # Sudan
439
+ 978-99942:0-4,50-79,800-999
440
+ # Albania
441
+ 978-99943:0-2,30-59,600-999
442
+ # Ethiopia
443
+ 978-99944:0-4,50-79,800-999
444
+ # Namibia
445
+ 978-99945:0-4,50-89,900-979,98-99
446
+ # Nepal
447
+ 978-99946:0-2,30-59,600-999
448
+ # Tajikistan
449
+ 978-99947:0-2,30-69,700-999
450
+ # Eritrea
451
+ 978-99948:0-4,50-79,800-999
452
+ # Mauritius
453
+ 978-99949:0-1,20-79,8-8,900-989,99-99
454
+ # Cambodia
455
+ 978-99950:0-4,50-79,800-999
456
+ # Reserved Agency
457
+ 978-99951:
458
+ # Mali
459
+ 978-99952:0-4,50-79,800-999
460
+ # Paraguay
461
+ 978-99953:0-2,30-79,800-939,94-99
462
+ # Bolivia
463
+ 978-99954:0-2,30-69,700-879,88-99
464
+ # Srpska, Republic of
465
+ 978-99955:0-1,20-59,600-799,80-99
466
+ # Albania
467
+ 978-99956:00-59,600-859,86-99
468
+ # Malta
469
+ 978-99957:0-1,20-79,800-949,95-99
470
+ # Bahrain
471
+ 978-99958:0-4,50-93,940-949,950-999
472
+ # Luxembourg
473
+ 978-99959:0-2,30-59,600-999
474
+ # Malawi
475
+ 978-99960:070-099,10-94,950-999
476
+ # El Salvador
477
+ 978-99961:0-2,300-369,37-89,900-999
478
+ # Mongolia
479
+ 978-99962:0-4,50-79,800-999
480
+ # Cambodia
481
+ 978-99963:00-49,500-919,92-99
482
+ # Nicaragua
483
+ 978-99964:0-1,20-79,800-999
484
+ # Macau
485
+ 978-99965:0-2,300-359,36-62,630-999
486
+ # Kuwait
487
+ 978-99966:0-2,30-69,700-799,80-96,970-999
488
+ # Paraguay
489
+ 978-99967:0-0,10-59,600-999
490
+ # Botswana
491
+ 978-99968:0-3,400-599,60-89,900-999
492
+ # Oman
493
+ 978-99969:0-4,50-79,800-949,95-99
494
+ # Haiti
495
+ 978-99970:0-4,50-89,900-999
496
+ # Myanmar
497
+ 978-99971:0-3,40-84,850-999
498
+ # Faroe Islands
499
+ 978-99972:0-4,50-89,900-999
500
+ # Mongolia
501
+ 978-99973:0-3,40-79,800-999
502
+ # Bolivia
503
+ 978-99974:0-0,10-25,260-399,40-63,640-649,65-79,800-999
504
+ # Tajikistan
505
+ 978-99975:0-2,300-399,40-79,800-999
506
+ # Srpska, Republic of
507
+ 978-99976:00-03,050-099,10-15,160-199,20-59,600-819,82-89,900-999
508
+ # Rwanda
509
+ 978-99977:0-1,40-69,700-799,975-999
510
+ # Mongolia
511
+ 978-99978:0-4,50-69,700-999
512
+ # Honduras
513
+ 978-99979:0-3,40-79,800-999
514
+ # Bhutan
515
+ 978-99980:0-0,30-64,700-999
516
+ # Macau
517
+ 978-99981:0-0,120-149,15-19,200-219,22-74,750-999
518
+ # Benin
519
+ 978-99982:0-1,50-71,885-999
520
+ # El Salvador
521
+ 978-99983:0-0,35-69,900-999
522
+ # Brunei Darussalam
523
+ 978-99984:0-0,50-69,950-999
524
+ # Tajikistan
525
+ 978-99985:0-1,25-79,800-999
526
+ # Myanmar
527
+ 978-99986:0-0,50-69,950-999
528
+ # Luxembourg
529
+ 978-99987:700-999
530
+ # Sudan
531
+ 978-99988:0-0,50-54,800-824
532
+ # Paraguay
533
+ 978-99989:0-1,50-79,900-999
534
+ # Ethiopia
535
+ 978-99990:0-0,50-54,975-999
536
+ # Oman
537
+ 978-99992:0-1,50-64,950-999
538
+ # Mauritius
539
+ 978-99993:0-2,50-54,980-999
540
+ # Haiti
541
+ 978-99994:0-0,50-52,985-999
542
+ # Seychelles
543
+ 978-99995:50-52,975-999
544
+ # France
545
+ 979-10:00-19,200-699,7000-8999,90000-97599,976000-999999
546
+ # Korea, Republic
547
+ 979-11:00-24,250-549,5500-8499,85000-94999,950000-999999
548
+ # Italy
549
+ 979-12:200-299,5450-5999,80000-84999,985000-999999
550
+ # Spain
551
+ 979-13:00-00,600-604,7000-7349,87500-89999,990000-999999
552
+ # United States
553
+ 979-8:200-229,230-239,3000-3199,3200-3499,3500-8849,88500-89999,90000-90999,9850000-9899999,9900000-9929999,9985000-9999999
@@ -0,0 +1,9 @@
1
+ # Generated from RangeMessage.xml file, downloaded from https://www.isbn-international.org/range_file_generation.
2
+ #
3
+ # International ISBN Agency
4
+ # Tue, 13 Aug 2024 06:15:38 BST
5
+ #
6
+ # International ISBN Agency
7
+ 978:0-5,600-649,65-65,7-7,80-94,950-989,9900-9989,99900-99999
8
+ # International ISBN Agency
9
+ 979:10-15,8-8
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ISBNRanges
4
+ VERSION = "0.1.0"
5
+ end
data/lib/isbnranges.rb ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "isbnranges/version"
4
+
5
+ module ISBNRanges
6
+ # class Error < StandardError; end
7
+ # Your code goes here...
8
+
9
+ extend self
10
+
11
+ def load_ranges(range_file)
12
+ ranges = {}
13
+ File.open(range_file, "r") do |f|
14
+ f.each_line do |line|
15
+ next if line.start_with?("#")
16
+ g, r = line.chomp.split(":")
17
+ ranges[g] = r.split(",") unless r.nil?
18
+ end
19
+ end
20
+ ranges
21
+ end
22
+
23
+ data_dir = __dir__ + "/../data"
24
+ REGISTRATION_GROUP_RANGES = load_ranges("#{data_dir}/registration_group_ranges.txt")
25
+ REGISTRANT_RANGES = load_ranges("#{data_dir}/registrant_ranges.txt")
26
+
27
+ end
@@ -0,0 +1,82 @@
1
+ # encoding: utf-8
2
+
3
+ require "nokogiri"
4
+ require "optparse"
5
+
6
+
7
+ RANGE_MESSAGE_FILE = "RangeMessage.xml"
8
+ REGISTRATION_GROUP_RANGES_FILE = "registration_group_ranges.txt"
9
+ REGISTRANT_RANGES_FILE = "registrant_ranges.txt"
10
+
11
+
12
+ def main
13
+ options = {
14
+ dir: "."
15
+ }
16
+ opts = OptionParser.new
17
+ opts.on("-d", "--dir=DIR", String, "Set directory, output range fiels into."){|v|
18
+ options[:dir] = v
19
+ }
20
+ opts.parse!
21
+
22
+ doc = File.open(RANGE_MESSAGE_FILE, "r"){|f| Nokogiri::XML(f) }
23
+
24
+ metadata = {
25
+ source: doc.xpath("//MessageSource").text,
26
+ date: doc.xpath("//MessageDate").text
27
+ }
28
+
29
+ registration_groups = extract_ranges(doc.xpath("//EAN.UCC"))
30
+ registrants = extract_ranges(doc.xpath("//Group"))
31
+
32
+ output_range_file(
33
+ registration_groups,
34
+ File.join(options[:dir], REGISTRATION_GROUP_RANGES_FILE),
35
+ metadata
36
+ )
37
+ output_range_file(
38
+ registrants,
39
+ File.join(options[:dir], REGISTRANT_RANGES_FILE),
40
+ metadata
41
+ )
42
+ end
43
+
44
+ def extract_ranges(nodes)
45
+ nodes.map do |node|
46
+ prefix = node.xpath("Prefix").text
47
+ agency = node.xpath("Agency").text
48
+ ranges = node.xpath("Rules/Rule").map do |rule|
49
+ length = rule.xpath("Length").text.to_i
50
+ range = if length > 0
51
+ rule.xpath("Range").text.split("-").map{|s| s[0, length] }.join("-")
52
+ else
53
+ nil
54
+ end
55
+ range
56
+ end.compact
57
+ {
58
+ "prefix" => prefix,
59
+ "agency" => agency,
60
+ "ranges" => ranges
61
+ }
62
+ end
63
+ end
64
+
65
+ def output_range_file(ranges, range_file, metadata)
66
+ File.open(range_file, "w") do |f|
67
+ f.puts "# Generated from RangeMessage.xml file, downloaded from https://www.isbn-international.org/range_file_generation."
68
+ f.puts "#"
69
+ f.puts "# " + metadata[:source]
70
+ f.puts "# " + metadata[:date]
71
+ f.puts "#"
72
+ ranges.each do |range|
73
+ f.puts "# " + range["agency"]
74
+ f.puts range["prefix"] + ":" + range["ranges"].join(",")
75
+ end
76
+ end
77
+ $stderr.puts "Generated: #{range_file}"
78
+ end
79
+
80
+
81
+
82
+ main
@@ -0,0 +1,4 @@
1
+ module ISBNRanges
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: isbnranges
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - takatoh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - takatoh.m@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - README.md
22
+ - Rakefile
23
+ - data/registrant_ranges.txt
24
+ - data/registration_group_ranges.txt
25
+ - lib/isbnranges.rb
26
+ - lib/isbnranges/version.rb
27
+ - scripts/generate_range_files.rb
28
+ - sig/isbnranges.rbs
29
+ homepage: https://github.com/takatoh/isbnranges
30
+ licenses: []
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubygems_version: 3.5.9
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: Range definitions of ISBN registration groups and registrants.
51
+ test_files: []