From c5d445c93f54f19b17ccac44c619bb90d34d26b3 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 18 Jul 2009 03:37:09 +0200 Subject: new screenshot --- data/generate.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'data') diff --git a/data/generate.rb b/data/generate.rb index bc85b93b..52a4c8e4 100755 --- a/data/generate.rb +++ b/data/generate.rb @@ -1,22 +1,21 @@ #!/usr/bin/ruby ## Parses mime.types and creates mime.dat -file = File.read(ARGV[0] || "mime.types") +file = File.read(ARGV.first || "mime.types") table = {} -for l in file.lines - next if l[0] == ?# - next unless l.size > 3 - next unless l.include? ?\t +for line in file.lines + next if line[0] == ?# or + line.size <= 3 or + !line.include?( ?\t ) - left, *exts = l.split(/\s+/) -# print exts.inspect - for ext in exts - table[ext] = left + name, *extensions = line.split(/\s+/) + for ext in extensions + table[ext] = name end end -File.open('mime.dat', 'w') do |f| - f.write Marshal.dump(table) +File.open( 'mime.dat', 'w' ) do |f| + f.write Marshal.dump( table ) end -- cgit 1.4.1-2-gfad0