16 lines
458 B
Ruby
Executable file
16 lines
458 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
##
|
|
# This script generates bindata/chapters-length.json - a JSON file
|
|
# that maps each chapter in The Qur'an to the number of verses
|
|
# a chapter contains.
|
|
|
|
require "json"
|
|
src = File.join("src", "json", "ar", "%{chapter}.json")
|
|
result = {}
|
|
1.upto(114) do
|
|
path = format(src, chapter: _1)
|
|
result[_1] = JSON.parse(File.read(path)).size
|
|
end
|
|
File.write File.join("bindata", "chapters-length.json"),
|
|
JSON.pretty_generate(result)
|