require 'cgi' require 'vimcolordirect' include VimColorDirect # 日本語コメントテスト def make_mkup(infile) mk_lines = [] lineno = 0 linemap = Hash.new infile.each{|ln| ln.chomp! ln = ln ? ln.gsub("\t", ' ') : '' lineno += 1 ml_append(lineno, ln) linemap[lineno] = ln } hidxs = start_highlight hnames = highlight_map lineno = 1 line = nil hlen = hidxs.length pos = 0 col = 0 line = linemap[lineno] words = [] while pos < hlen do if hidxs[pos] == -1 col = 0 lineno += 1 line = linemap[lineno] pos += 1 mk_lines << words words = [] else len = hidxs[pos+1] hli = hidxs[pos] wd = line[col, len] if hli > 0 && wd =~ /[^ ]/ words << "#{ CGI.escapeHTML( wd ) }" else words << CGI.escapeHTML( wd ) end col += len pos += 2 end end return mk_lines end if __FILE__ == $0 src_fn = "testserver.rb" tmpl = < #{src_fn}
EOS

init_vim

buf = open_buffer(nil)
load_syntax("syntax.vim")
load_syntax("syntax/ruby.vim")

puts tmpl

File.open(src_fn) {|f|
	lines = make_mkup(f)
	lines.map!{|ln| ln.join('') }
	puts lines.join("\n")
}

puts " 
\n\n" buf.close free_vim end