Sha256: b09f84cdc0d3e37818d8458fe11a529df4d0eae5a90336ccf59ae53ad3fafd67
Contents?: true
Size: 552 Bytes
Versions: 35
Compression:
Stored size: 552 Bytes
Contents
#!/usr/bin/env ruby1.9 # # A small script to extract entities from the ONIX DTD # # USAGE: ./extract <dir> # # Where dir is a directory containing an ONIX 2.1r3 DTD. # unless File.directory?(ARGV.first) $stderr.puts "directory doesn't exist" exit(1) end Dir.entries(ARGV.first).each do |f| next unless f[-4,4] == ".ent" content = File.binread(ARGV.first + "/" + f) content.scan(/ENTITY [a-zA-Z0-9]+.*"\&#x.+;/).each do |str| m, name, numeric = *str.match(/ENTITY ([a-zA-Z0-9]+).*"\&([^;]+);/) puts "#{name}:#{numeric}" end end
Version data entries
35 entries across 35 versions & 4 rubygems