@noe-teritorio/opening_hours 3.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Makefile ADDED
@@ -0,0 +1,526 @@
1
+ # SPDX-FileCopyrightText: © opening_hours.js contributors
2
+ # SPDX-License-Identifier: LGPL-3.0-only
3
+ ## vim: foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
4
+
5
+ SHELL ?= /bin/bash -o nounset -o pipefail -o errexit
6
+ MAKEFLAGS += --no-builtin-rules
7
+ .SUFFIXES:
8
+
9
+ ## Variables {{{
10
+ NODEJS ?= node
11
+ SEARCH ?= opening_hours
12
+ VERBOSE ?= 1
13
+ RELEASE_OPENPGP_FINGERPRINT ?= C505B5C93B0DB3D338A1B6005FE92C12EE88E1F0
14
+
15
+ ## Data source variables {{{
16
+ OH_RELATED_TAGS ?= scripts/related_tags.txt
17
+ STATS_FOR_BOUNDARIES ?= scripts/stats_for_boundaries.txt
18
+
19
+ API_URL_TAGINFO ?= https://taginfo.openstreetmap.org/api
20
+ API_URL_OVERPASS ?= https://overpass-api.de/api
21
+ # GnuTLS: A TLS warning alert has been received.
22
+ # GnuTLS: received alert [112]: The server name sent was not recognized
23
+
24
+ TMP_QUERY ?= tmp_query.op
25
+ OVERPASS_QUERY_KEY_FILTER_CMD ?= cat
26
+ OVERPASS_QUERY_TIMEOUT ?= 4000
27
+ # OVERPASS_QUERY_TIMEOUT ?= 1000
28
+ OVERPASS_QUERY_STOP_AFTER_TIME_HOUR ?= 11
29
+ # OVERPASS_QUERY_STOP_AFTER_TIME_HOUR ?= -1
30
+ ## Stop the make process gracefully after 14:00. Intended for cron which start at night.
31
+ OVERPASS_QUERY_USE_REGEX ?= 0
32
+ # Using regular expressions for querying areas is still slow
33
+ # https://github.com/drolbr/Overpass-API/issues/59#issuecomment-54013988
34
+ # Benchmarks:
35
+ # 7:54.68: make WGET_OPTIONS='' export♡ISO3166-2♡DE-SL♡2015-04-09T00:00:00.json -B OVERPASS_QUERY_USE_REGEX=1
36
+ # 0:35.04: make WGET_OPTIONS='' export♡ISO3166-2♡DE-SL♡2015-04-09T00:00:00.json -B OVERPASS_QUERY_USE_REGEX=0
37
+ # The query without regular expressions also returns more results …
38
+ # Use the log feature of real_test.js for this.
39
+
40
+ REMOVE_DATA_AFTER_STATS_GEN ?= 1
41
+ # REMOVE_DATA_AFTER_STATS_GEN ?= 0
42
+ START_DATE ?= now
43
+ # START_DATE ?= now - 1 day
44
+ DAYS_INCREMENT ?= 1
45
+ HOURS_INCREMENT ?= 1
46
+ ## }}}
47
+
48
+ WGET_OPTIONS ?= --no-verbose
49
+ MAKE_OPTIONS ?= --no-print-directory
50
+
51
+ CHECK_LANG ?= 'en'
52
+ ## }}}
53
+
54
+ .PHONY: default
55
+ default: list
56
+
57
+ ## help {{{
58
+ .PHONY: list
59
+ # List all available targets in the Makefile by:
60
+ # 1. Using grep to find lines that start with non-comment, non-whitespace chars and contain ':'
61
+ # 2. Extracting the target names before the ':' using cut
62
+ # 3. Sorting the target names alphabetically
63
+ # 4. Adding 4 spaces indentation at the start of each line for pretty printing
64
+ # 5. Removing duplicate lines using uniq
65
+ list:
66
+ @echo "This Makefile has the following targets:"
67
+ @grep '^[^#[:space:]].*:' Makefile \
68
+ | cut -d: -f1 \
69
+ | sort \
70
+ | sed 's/^/ /' \
71
+ | uniq
72
+ ## }}}
73
+
74
+ ## defaults {{{
75
+ .PHONY: build
76
+ build: build/opening_hours+deps.min.js
77
+
78
+ build/opening_hours.js \
79
+ build/opening_hours.min.js \
80
+ build/opening_hours.esm.mjs \
81
+ build/opening_hours+deps.js \
82
+ build/opening_hours+deps.min.js: src/index.js src/locales/word_error_correction.yaml \
83
+ src/locale-resolver/layers.json
84
+ node_modules/.bin/rollup -c
85
+
86
+ .PHONY: check
87
+ check: qa-quick check-fast check-package.json
88
+
89
+ .PHONY: check-full
90
+ check-full: clean check-all-diff check-package.json check-yaml check-holidays check-holiday-state-codes check-translations
91
+
92
+ .PHONY: benchmark
93
+ benchmark: benchmark-opening_hours.min.js
94
+
95
+ .PHONY: clean
96
+ clean: osm-tag-data-rm
97
+ rm -rf build
98
+ rm -f README.html
99
+ rm -f taginfo_sources.json
100
+
101
+ .PHONY: osm-tag-data-rm
102
+ osm-tag-data-rm: osm-tag-data-taginfo-rm osm-tag-data-overpass-rm
103
+ ## }}}
104
+
105
+ ## dependencies {{{
106
+ .PHONY: dependencies-get
107
+ dependencies-get: package.json
108
+ git submodule update --init --recursive
109
+ npm install
110
+
111
+ .PHONY: update-dependency-versions
112
+ update-dependency-versions: package.json
113
+ npm run check-updates
114
+
115
+ .PHONY: list-dependency-versions
116
+ list-dependency-versions: package.json
117
+ npm list | egrep '^.─'
118
+ ## }}}
119
+
120
+ taginfo.json: scripts/related_tags.txt scripts/gen_taginfo_json.js taginfo_template.json
121
+ scripts/gen_taginfo_json.js --key-file "$<" --template-file ./taginfo_template.json > "$@"
122
+
123
+ ## docs {{{
124
+ README.html: README.md
125
+
126
+ .PHONY: doctoc
127
+ doctoc:
128
+ npm run readme
129
+ ## }}}
130
+
131
+ ## Build files which are needed to host the evaluation tool on a webserver.
132
+ .PHONY: ready-for-hosting
133
+ ready-for-hosting: dependencies-get build/opening_hours+deps.min.js
134
+
135
+ ## command line programs {{{
136
+ .PHONY: run-regex_search
137
+ run-regex_search: export.$(SEARCH).json ./scripts/interactive_testing.js scripts/regex_search.py
138
+ python3 ./scripts/regex_search.py "$<"
139
+
140
+ .PHONY: run-interactive_testing
141
+ run-interactive_testing: ./scripts/interactive_testing.js ./build/opening_hours.js
142
+ $(NODEJS) "$<" --locale "$(CHECK_LANG)"
143
+ ## }}}
144
+
145
+ ## source code QA {{{
146
+ .PHONY: qa-quick
147
+ qa-quick: qa-phrases-to-avoid
148
+
149
+ .PHONY: qa-phrases-to-avoid
150
+ qa-phrases-to-avoid:
151
+ ! git --no-pager grep --ignore-case 'input[ ]tolerance'
152
+
153
+ ## }}}
154
+
155
+ ## software testing {{{
156
+
157
+ .PHONY: check-all
158
+ check-all: check-package.json check-test check-all-diff osm-tag-data-update-check
159
+
160
+ .PHONY: check-test
161
+ check-test: check-opening_hours.js
162
+
163
+ .PHONY: check-translations
164
+ check-translations:
165
+ $(NODEJS) scripts/check_translations.mjs
166
+
167
+ .PHONY: check-fast
168
+ check-fast: check-diff-opening_hours.js
169
+
170
+ .PHONY: check-all-diff
171
+ check-all-diff: check-all-lang-diff check-diff-opening_hours.js
172
+
173
+ # Compare parser test results with the reference logs for each test language.
174
+ .PHONY: check-all-lang-diff
175
+ check-all-lang-diff:
176
+ @for lang in en de; do \
177
+ $(MAKE) $(MAKE_OPTIONS) "CHECK_LANG=$$lang" check-diff-opening_hours.js || exit 1; \
178
+ done
179
+
180
+ # .PHONY: check-opening_hours.js check-opening_hours.min.js
181
+ ## Does not work
182
+ check-opening_hours.js:
183
+ check-opening_hours.min.js:
184
+
185
+ check-diff-%: build/% test/test.js
186
+ @rm -rf "test/test.$(CHECK_LANG).log"
187
+ @echo "Testing to reproduce test/test.$(CHECK_LANG).log using $<."
188
+ @FORCE_COLOR=true $(NODEJS) test/test.js --library-file "$<" --locale $(CHECK_LANG) 1> test/test.$(CHECK_LANG).log 2>&1 || true; \
189
+ if git diff --quiet --exit-code HEAD -- "test/test.$(CHECK_LANG).log"; then \
190
+ echo "Test results for $< ($(CHECK_LANG)) are exactly the same as on development system. So far, so good ;)"; \
191
+ else \
192
+ echo "Test results for $< ($(CHECK_LANG)) produced a different output then the output of the current HEAD. Checkout the following diff."; \
193
+ fi
194
+ @sh -c 'git --no-pager diff --exit-code -- "test/test.$(CHECK_LANG).log"'
195
+
196
+ check-o%.js: build/o%.js test/test.js
197
+ $(NODEJS) test/test.js --library-file "$<"
198
+
199
+
200
+ .PHONY: osm-tag-data-taginfo-check
201
+ osm-tag-data-taginfo-check: scripts/real_test.js build/opening_hours.js osm-tag-data-get-taginfo
202
+ $(NODEJS) scripts/check_for_new_taginfo_data.js --exit-code-not-new 0
203
+ @grep -v '^#' $(OH_RELATED_TAGS) | while read key; do \
204
+ $(NODEJS) "$<" $(REAL_TEST_OPTIONS) --map-bad-oh-values --ignore-manual-values "export.$$key.json"; \
205
+ done
206
+
207
+ .PHONY: osm-tag-data-update-check
208
+ .SILENT : osm-tag-data-update-check
209
+ osm-tag-data-update-check: osm-tag-data-update-taginfo osm-tag-data-taginfo-check
210
+
211
+ benchmark-opening_hours.js:
212
+ benchmark-opening_hours.min.js:
213
+
214
+ # .PHONY: benchmark
215
+ benchmark-%.js: build/%.js scripts/benchmark.mjs
216
+ $(NODEJS) scripts/benchmark.mjs "../$<"
217
+
218
+ .PHONY: check-package.json
219
+ check-package.json: package.json
220
+ ./node_modules/.bin/package-json-validator-cli --warnings --recommendations --filename "$<"
221
+
222
+ .PHONY: check-holidays
223
+ check-holidays: scripts/PH_SH_exporter.js
224
+ "$<" --from 2021 --to 2021 /tmp/out --public-holidays --verbose --all-locations
225
+
226
+ .PHONY: check-holiday-state-codes
227
+ check-holiday-state-codes: scripts/check_holiday_state_codes.mjs
228
+ $(NODEJS) scripts/check_holiday_state_codes.mjs
229
+
230
+ .PHONY: check-yaml
231
+ check-yaml:
232
+ yamllint --version
233
+ yamllint --strict .
234
+
235
+ .PHONY: check-html
236
+ check-html:
237
+ html5validator --show-warnings --root . --blacklist node_modules submodules
238
+
239
+ ## }}}
240
+
241
+ ## release {{{
242
+ # See CONTRIBUTING.md "Releasing"
243
+
244
+ .PHONY: release-prepare
245
+ release-prepare: package.json taginfo.json check-holidays doctoc check
246
+
247
+ .PHONY: release-local
248
+ release-local: package.json
249
+ npx commit-and-tag-version
250
+ $(MAKE) $(MAKE_OPTIONS) release-local-resign-tag
251
+
252
+ # Recreate git tag signed with release key because commit-and-tag-version cannot use a different key for signing the tag.
253
+ .PHONY: release-local-resign-tag
254
+ release-local-resign-tag: package.json
255
+ git tag --delete "v$(shell jq --raw-output '.version' $<)"
256
+ git tag --sign --local-user="$(RELEASE_OPENPGP_FINGERPRINT)" --message="chore(release): $(shell jq --raw-output '.version' $<)" "v$(shell jq --raw-output '.version' $<)"
257
+
258
+ # "build" target currently does not guarantee correctness [1].
259
+ # GNU make is not the right tool for this so we just force make as workaround.
260
+ #
261
+ # [1]: https://bazel.build/reference/glossary#correctness
262
+ .PHONY: release-publish
263
+ release-publish:
264
+ $(MAKE) $(MAKE_OPTIONS) --always-make build
265
+ git push --follow-tags origin
266
+ npm publish
267
+ @echo "Manually create release on https://github.com/opening-hours/opening_hours.js/releases"
268
+ # $(MAKE) $(MAKE_OPTIONS) publish-website-on-all-servers
269
+
270
+ .PHONY: release
271
+ release: release-prepare release-local release-publish
272
+ ## }}}
273
+
274
+ ## OSM data from taginfo {{{
275
+
276
+ .PHONY: osm-tag-data-taginfo-rm
277
+ osm-tag-data-taginfo-rm:
278
+ rm -f export.*.json
279
+
280
+ .PHONY: osm-tag-data-update-taginfo
281
+ osm-tag-data-update-taginfo: taginfo_sources.json osm-tag-data-taginfo-rm osm-tag-data-get-taginfo
282
+
283
+ ## Always refresh
284
+ .PHONY: taginfo_sources.json
285
+ taginfo_sources.json:
286
+ $(NODEJS) scripts/check_for_new_taginfo_data.js
287
+
288
+ .PHONY: osm-tag-data-get-taginfo
289
+ osm-tag-data-get-taginfo: $(OH_RELATED_TAGS)
290
+ @grep -v '^#' "$<" | while read location; do \
291
+ $(MAKE) $(MAKE_OPTIONS) "export.$$location.json"; \
292
+ done
293
+
294
+ # Testing:
295
+ export.happy_hours.json:
296
+ export.opening_hours.json:
297
+ export.lit.json:
298
+
299
+ # Downloads taginfo data for the specified key.
300
+ # By default, all values are downloaded. To limit:
301
+ # make osm-tag-data-taginfo-check MAX_VALUES=10000
302
+ export.%.json:
303
+ @$(NODEJS) scripts/download_taginfo_data.mjs "$@" "$(shell echo "$@" | sed 's/^export\.\(.*\)\.json/\1/;s/\\//g' )" "$(MAX_VALUES)"
304
+ ## }}}
305
+
306
+ ## OSM data from the overpass API {{{
307
+ # Before running large imports check the load of the overpass API:
308
+ # * https://overpass-api.de/munin/localdomain/localhost.localdomain/load.html
309
+ # * https://overpass-api.de/munin/localdomain/localhost.localdomain/osm_db_request_count.html
310
+
311
+ ## The value separator is ♡ because it is not expected that this appears anywhere else in the tags and it works with GNU make.
312
+ ## Unfortunately, it does not work with cut, but that problem can be solved.
313
+
314
+ # Used for testing:
315
+ export♡ISO3166-2♡DE-SL.json:
316
+ export♡name♡Erlangen.json:
317
+ export♡name♡Leutershausen.json:
318
+
319
+ ## make WGET_OPTIONS='' export♡ISO3166-2♡DE-SL♡2015-04-09T00:00:00.json -B
320
+
321
+ # export♡name♡Leutershausen♡2015-04-09T00:00:00.json:
322
+ ## Can be used to import data from a specific date.
323
+
324
+ # grep --quiet "^$$timestamp"
325
+ # The grep would lead to wrong results if Z is present in the timestamp because
326
+ # the stats files contain milliseconds as well.
327
+
328
+ ## Generate OverpassQL and execute it.
329
+ .PRECIOUS: export♡%.json
330
+ export♡%.json: scripts/real_test.js $(OH_RELATED_TAGS)
331
+ @timestamp="$(shell echo "$@" | sed 's/♡/\x0/g;s/\.json$$//;' | cut -d '' -f 4)"; \
332
+ boundary_key="$(shell echo "$@" | sed 's/♡/\x0/g;s/\.json$$//;' | cut -d '' -f 2)"; \
333
+ boundary_value="$(shell echo "$@" | sed 's/♡/\x0/g;s/\.json$$//;' | cut -d '' -f 3)"; \
334
+ if [ -z "$$timestamp" ]; then \
335
+ timestamp="$(shell date '+%F')T00:00:00"; \
336
+ fi; \
337
+ if grep --quiet "^$$timestamp" export♡*♡$$boundary_key♡$$boundary_value♡stats.csv 2>/dev/null; then \
338
+ if [ "$(VERBOSE)" -eq "1" ]; then \
339
+ echo "Skipping. Timestamp ($$timestamp) already present in statistical data for $${boundary_key}=$${boundary_value}." 1>&2; \
340
+ fi; \
341
+ else \
342
+ ( \
343
+ echo -n "[date:\"$$timestamp\"]"; \
344
+ echo "[out:json][timeout:$(OVERPASS_QUERY_TIMEOUT)];"; \
345
+ echo "area[\"type\"=\"boundary\"][\"$$boundary_key\"=\"$$boundary_value\"];"; \
346
+ echo 'foreach('; \
347
+ for type in NODEJS way; do \
348
+ if [ "$(OVERPASS_QUERY_USE_REGEX)" -eq "1" ]; then \
349
+ echo -n " $$type(area)[~\"^("; \
350
+ (grep -v '^#' $(OH_RELATED_TAGS) | while read key; do \
351
+ echo -n "$$key|"; \
352
+ done) | sed 's/|$$//;'; \
353
+ echo ")$$\"~\".\"]->.t; .t out tags;"; \
354
+ else \
355
+ grep -v '^#' $(OH_RELATED_TAGS) | $(OVERPASS_QUERY_KEY_FILTER_CMD) | while read key; do \
356
+ echo " $$type(area)[\"$$key\"]->.t; .t out tags;"; \
357
+ done; \
358
+ fi; \
359
+ done; \
360
+ echo ");" ) > "$(TMP_QUERY)"; \
361
+ if [ "$(VERBOSE)" -eq "1" ]; then \
362
+ echo "Executing query:"; \
363
+ cat "$(TMP_QUERY)" | sed 's/^/ /;'; \
364
+ fi; \
365
+ time wget $(WGET_OPTIONS) --post-file="$(TMP_QUERY)" --output-document="$(shell echo "$@" | sed 's/\\//g' )" "$(API_URL_OVERPASS)/interpreter" 2>&1; \
366
+ if [ "$$?" != "0" ]; then exit 1; fi; \
367
+ $(NODEJS) "$<" $(REAL_TEST_OPTIONS) --map-bad-oh-values "$(shell echo "$@" | sed 's/\\//g' )"; \
368
+ find . -name "export♡*♡$$boundary_key♡$$boundary_value♡stats.csv" | while read file; do \
369
+ sort --numeric-sort "$$file" > "$$file.tmp" && \
370
+ mv "$$file.tmp" "$$file"; \
371
+ done; \
372
+ if [ "$(REMOVE_DATA_AFTER_STATS_GEN)" -eq "1" ]; then \
373
+ $(MAKE) $(MAKE_OPTIONS) osm-tag-data-overpass-rm; \
374
+ fi; \
375
+ fi
376
+
377
+ .PHONY: osm-tag-data-overpass-rm
378
+ osm-tag-data-overpass-rm:
379
+ rm -f export♡*.json
380
+
381
+ .PHONY: osm-tag-data-overpass-kill-queries
382
+ osm-tag-data-overpass-kill-queries:
383
+ curl "$(API_URL_OVERPASS)/kill_my_queries"
384
+
385
+ ## }}}
386
+
387
+ ## OSM data via a SQL query against PostgreSQL {{{
388
+ ## Thanks to walter nordmann
389
+ # select 'N'||osm_id id,
390
+ # cab.localname,
391
+ # poi.tags->'opening_hours' opening_hours
392
+ # from planet_osm_point poi,
393
+ # collected_admin_boundaries cab
394
+ # where poi.way && (select way from collected_admin_boundaries where id=51477)
395
+ # and st_contains((select way from collected_admin_boundaries where id=51477),poi.way)
396
+ # and poi.tags ? 'opening_hours'
397
+ # and cab.admin_level = '4'
398
+ # and cab.type='admin'
399
+ # and st_contains(cab.way,poi.way)
400
+ # union
401
+ # select case when osm_id > 0 then 'W'||osm_id else 'R'||osm_id end id,
402
+ # cab.localname,
403
+ # cab.tags->'opening_hours' opening_hours
404
+ # from planet_osm_polygon poi,
405
+ # collected_admin_boundaries cab
406
+ # where poi.pointonsurface && (select way from collected_admin_boundaries where id=51477)
407
+ # and st_contains((select way from collected_admin_boundaries where id=51477),poi.pointonsurface)
408
+ # and poi.tags ? 'opening_hours'
409
+ # and cab.admin_level = '4'
410
+ # and cab.type='admin'
411
+ # and st_contains(cab.way,poi.way)
412
+ # ;
413
+ ## }}}
414
+
415
+ ## generate statistics {{{
416
+
417
+ ## Cronjob is running on gauss: http://munin.openstreetmap.de/gauss/gauss-load.html
418
+ # m h dom mon dow command
419
+ # 12 22 * * * cd oh-stats/ && make osm-tag-data-gen-stats-cron-overpass > cron.22.log 2>&1
420
+ # 48 02 * * * cd oh-stats/ && make osm-tag-data-gen-stats-cron-taginfo > cron.02.log 2>&1
421
+ # 48 06 * * * cd oh-stats/ && make osm-tag-data-gen-stats-cron-taginfo > cron.06.log 2>&1
422
+ .PHONY: osm-tag-data-gen-stats-cron-taginfo
423
+ osm-tag-data-gen-stats-cron-taginfo: real_test.opening_hours.stats.csv
424
+ date
425
+ $(MAKE) $(MAKE_OPTIONS) 'REAL_TEST_OPTIONS=--punchcard' osm-tag-data-gen-stats > cron_taginfo.log 2>&1
426
+ git commit --all --message 'Generated stats.'
427
+ git push
428
+
429
+ .PHONY: osm-tag-data-gen-stats-cron-overpass
430
+ osm-tag-data-gen-stats-cron-overpass:
431
+ date
432
+ $(MAKE) $(MAKE_OPTIONS) osm-tag-data-gen-stats-overpass-n-days-back DAYS_BACK=120 >> cron_overpass.1.log 2>&1
433
+ git add export♡*♡stats.csv
434
+ date
435
+ -git commit --all --message 'Generated stats.'
436
+ $(MAKE) $(MAKE_OPTIONS) osm-tag-data-gen-stats-overpass-n-days-back DAYS_BACK=2400 DAYS_INCREMENT=30 START_DATE=2015-04-12 >> cron_overpass.2.log 2>&1
437
+ git add export♡*♡stats.csv
438
+ $(MAKE) $(MAKE_OPTIONS) osm-tag-data-gen-stats-overpass-merge
439
+ date
440
+ -git commit --all --message 'Generated stats.'
441
+ $(MAKE) $(MAKE_OPTIONS) osm-tag-data-rm
442
+ -git push
443
+
444
+ ## See real_test.js
445
+ .PHONY: osm-tag-data-gen-stats
446
+ osm-tag-data-gen-stats: real_test.opening_hours.stats.csv osm-tag-data-update-check
447
+
448
+ .PHONY: osm-tag-data-gen-stats-overpass-merge
449
+ osm-tag-data-gen-stats-overpass-merge: merge_all_stats_into_country.py $(OH_RELATED_TAGS)
450
+ @grep -v '^#' $(OH_RELATED_TAGS) | while read key; do \
451
+ python3 "$<" --output-file "export♡$$key♡int_name♡Deutschland♡stats.csv" export♡$$key♡ISO3166-2♡DE-*♡stats.csv; \
452
+ done
453
+
454
+ .PHONY: osm-tag-data-gen-stats-overpass-daily
455
+ osm-tag-data-gen-stats-overpass-daily: $(STATS_FOR_BOUNDARIES)
456
+ @grep -v '^#' "$<" | while read location; do \
457
+ $(MAKE) $(MAKE_OPTIONS) export♡$$location♡$(shell date '+%F')T00:00:00.json; \
458
+ if [ "$$?" != "0" ]; then exit 1; fi; \
459
+ done
460
+
461
+ .PHONY: osm-tag-data-gen-stats-overpass-hourly
462
+ osm-tag-data-gen-stats-overpass-hourly: $(STATS_FOR_BOUNDARIES)
463
+ @grep -v '^#' "$<" | while read location; do \
464
+ $(MAKE) $(MAKE_OPTIONS) export♡$$location♡$(shell date '+%FT%H'):00:00.json; \
465
+ if [ "$$?" != "0" ]; then exit 1; fi; \
466
+ done
467
+
468
+ .PHONY: osm-tag-data-gen-stats-overpass-n-days-back
469
+ osm-tag-data-gen-stats-overpass-n-days-back: $(STATS_FOR_BOUNDARIES)
470
+ @if [ -z "$(DAYS_BACK)" ]; then \
471
+ echo "The DAYS_BACK parameter is empty!"; \
472
+ exit 1; \
473
+ fi; \
474
+ grep -v '^#' "$<" | while read location; do \
475
+ for day_back in `seq 0 $(DAYS_INCREMENT) $(DAYS_BACK)`; do \
476
+ if [ "$(OVERPASS_QUERY_STOP_AFTER_TIME_HOUR)" == "`date '+%H'`" ]; then \
477
+ echo "Stopping. The time is `date`."; \
478
+ exit; \
479
+ fi; \
480
+ if [ "$$location" == "int_name♡Deutschland" ]; then \
481
+ echo "Making multiple queries to overcome a timeout bug of the overpass API."; \
482
+ $(MAKE) $(MAKE_OPTIONS) "OVERPASS_QUERY_KEY_FILTER_CMD=grep --line-regexp \"opening_hours\"" "export♡$$location♡`date -d \"$(START_DATE) - $$day_back days\" '+%F'`T00:00:00.json"; \
483
+ if [ "$$?" != "0" ]; then exit 1; fi; \
484
+ $(MAKE) $(MAKE_OPTIONS) "OVERPASS_QUERY_KEY_FILTER_CMD=grep --line-regexp --invert-match \"opening_hours\"" "export♡$$location♡`date -d \"$(START_DATE) - $$day_back days\" '+%F'`T00:00:00.json"; \
485
+ if [ "$$?" != "0" ]; then exit 1; fi; \
486
+ else \
487
+ $(MAKE) $(MAKE_OPTIONS) "export♡$$location♡`date -d \"$(START_DATE) - $$day_back days\" '+%F'`T00:00:00.json"; \
488
+ fi; \
489
+ if [ "$$?" != "0" ]; then exit 1; fi; \
490
+ done; \
491
+ done
492
+
493
+ ## To track the OSM activities of Jack Bauer :)
494
+ .PHONY: osm-tag-data-gen-stats-overpass-24-hours
495
+ osm-tag-data-gen-stats-overpass-24-hours: $(STATS_FOR_BOUNDARIES)
496
+ @grep -v '^#' "$<" | while read location; do \
497
+ for hour in `seq --equal-width 0 $(HOURS_INCREMENT) 23`; do \
498
+ if [ "$(OVERPASS_QUERY_STOP_AFTER_TIME_HOUR)" == "`date '+%H'`" ]; then \
499
+ echo "Stopping. The time is `date`."; \
500
+ exit; \
501
+ fi; \
502
+ $(MAKE) $(MAKE_OPTIONS) "export♡$$location♡`date -d \"$(START_DATE)" '+%F'`T$${hour}:00:00.json"; \
503
+ if [ "$$?" != "0" ]; then exit 1; fi; \
504
+ done; \
505
+ done
506
+
507
+ .PHONY: osm-tag-data-gen-stats-sort
508
+ osm-tag-data-gen-stats-sort:
509
+ @find . -name 'export*stats.csv' | while read file; do \
510
+ sort --numeric-sort "$$file" > "$$file.tmp" && \
511
+ mv "$$file.tmp" "$$file"; \
512
+ done
513
+ ## }}}
514
+
515
+ src/locales/word_error_correction.yaml: scripts/gen_word_error_correction.mjs
516
+ @echo "Generating word error correction data..."
517
+ $(NODEJS) scripts/gen_word_error_correction.mjs >/dev/null
518
+
519
+ src/locale-resolver/layers.json: scripts/gen_locale_resolver_layers.mjs src/locale-resolver/manual-aliases.yaml
520
+ @echo "Generating locale resolver layers..."
521
+ $(NODEJS) scripts/gen_locale_resolver_layers.mjs >/dev/null
522
+
523
+ README.html:
524
+
525
+ %.html: %.md
526
+ pandoc --from markdown_github --to html --standalone "$<" --output "$@"