-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathextract_idl.rb
executable file
·47 lines (39 loc) · 1.01 KB
/
extract_idl.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env ruby
require 'date'
if ARGV.length < 1
puts "Filename required"
exit 2
end
outfile = ARGV[0]
YEAR=DateTime.now.year
HEADER=<<HERE
// Copyright (C) [#{YEAR}] World Wide Web Consortium,
// (Massachusetts Institute of Technology, European Research Consortium for
// Informatics and Mathematics, Keio University, Beihang).
// All Rights Reserved.
//
// This work is distributed under the W3C (R) Software License [1] in the hope
// that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// [1] http://www.w3.org/Consortium/Legal/copyright-software
//
// **** This file is auto-generated. Do not edit. ****
//
HERE
File.open(outfile, 'w') do |f|
f.puts HEADER
in_idl = false
File.open('index.bs').read.split("\n").each do |l|
if in_idl
if l =~ /<\/xmp>/
f.puts
in_idl = false
else
f.puts l
end
elsif l =~ /xmp class="?idl/
in_idl = true
end
end
end