File: mkind.rb

package info (click to toggle)
ruby-pgplot 0.1.3-6
  • links: PTS, VCS
  • area: contrib
  • in suites: wheezy
  • size: 480 kB
  • sloc: ruby: 1,382; ansic: 73; makefile: 37
file content (62 lines) | stat: -rw-r--r-- 919 bytes parent folder | download | duplicates (5)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
funcs = %w[
  pgopen
  pgbeg
  pgask
  pgenv
  pgline
  pgpt
  pgpnts
  pgbin
  pghist
  pgerrb
  pgerrx
  pgerry
  pgcont
  pgcons
  pgconb
  pgconf
  pgconl
  pgimag
  pggray
  pgctab
  pgpixl
  pgvect
  pgband
  pgolin
  pgncur
  pglcur
  pgtick
  pgaxis
]
rbpg={}
funcs.each{|f| rbpg[f.upcase]=true }

fin=open(ARGV[0])
fout=open(ARGV[1],"w")
fout.print "
=begin
= Ruby/PGPLOT categorized method index
"

fin.each do |line|
  line.chomp!
  name = line[/(^PG[A-Z0-9]+)/]
  #line.sub!(/^# /, "===")
  line.sub!(/^(PG[A-Z0-9]+)/, '* (({\1}))')
  #if rbpg[name]
  #  line.gsub!(/\b(PG(?!PLOT)[A-Z0-9]+)/) do |x|
  #    '((<%s|URL:rbpg-doc.html#%s>))' % [x.downcase,x]
  #  end
  #  line << ' ( ((<FORTRAN|URL:pgplot.html#%s>)) )' % name
  #else
    line.gsub!(/\b(PG(?!PLOT)[A-Z0-9]+)/) do |x|
      '((<%s|URL:rbpgplot.html#%s>))' % [x.downcase,x]
    end
  #end
  fout.puts(line)
end

fout.print "
<<< trailer
=end
"