File: makedoc.rb

package info (click to toggle)
ruby-kyotocabinet 1.32-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,192 kB
  • ctags: 789
  • sloc: cpp: 3,501; ruby: 1,580; sh: 15; makefile: 2
file content (45 lines) | stat: -rwxr-xr-x 1,240 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
#! /usr/bin/ruby

system("rm -rf doc")

File::open("kyotocabinet-doc.rb") { |ifile|
  File::open("kyotocabinet.rb", "w") { |ofile|
    ifile.each { |line|
      line = line.chomp
      line = line.sub(/# +@param +(\w+) +/, '# - <b>@param <i>\\1</i></b> ')
      line = line.sub(/# +@(\w+) +/, '# - <b>@\\1</b> ')
      ofile.printf("%s\n", line)
    }
  }
}

system('rdoc --title "Kyoto Cabinet" --main kyotocabinet.rb -o doc kyotocabinet.rb')

IO::popen("find doc") { |list|
  list.each { |path|
    path = path.chomp
    if path =~ /\.html$/
      File::open(path) { |ifile|
        tmppath = path + ".tmp"
        File::open(tmppath, "w") { |ofile|
          ifile.each { |line|
            line = line.chomp
            next if line =~ /\[Validate\]<\/a>/
            ofile.printf("%s\n", line)
          }
        }
        File::unlink(path)
        File::rename(tmppath, path)
      }
    end
  }
}

File::open("doc/rdoc.css", "a") { |file|
  file.printf("\n")
  file.printf("pre { background: none #ddddee; border: solid 1px #dddddd; }\n")
  file.printf(".method-description ul { margin: 0ex 0ex 1ex 2ex; padding: 0ex; }\n")
  file.printf(".method-description ul li { list-style-type: none; }\n")
}

system("rm -f kyotocabinet.rb")