#!/usr/bin/ruby def indexOfSelf(fname = $0) index = '' document = '' begin File.open(fname){|f| document = f.readlines} document.each { |line| term = %r{^===([^=]*)}.match(line.chomp).to_a[1] # term = %r{^===(.*)}.match(line).to_a[1] index += "*((<#{term}>))\n" if term and (term.length > 0) }# document.each { |line| res = index return res rescue # File.open(fname) stder.print "File not found: #{$_}\n" end # File.open(fname) end # def indexOfSelf(fname = $0) def rubyruby(rb, rt, *rp) case rp.size when 0 rp = ['(', ')'] when 1 rp[1] = rp[0] end # case rp.size ruby = '' ruby+= "((::))" ruby+= "((::))#{rb}((::))" ruby+= "((:#{rp[0]}" ruby+= "#{rt}" ruby+= "#{rp[1]}:))" ruby+= "((::))" return ruby end # def rubyruby(rb, rt, *rp) def color(color, string) ret = '' ret+= '((::))' ret+= string ret+= '((::))' return ret end # def color(color, string)