OSDN Git Service

Refactoring bd2tex using tex_commands
[dianzhuhui/script.git] / sw2ebas.rb
1 require 'erb'
2
3 SOURCE_DIR = File.join(File.dirname(__FILE__), '..', 'data')
4 TARGET_DIR = File.join(File.dirname(__FILE__), '..', 'htdocs')
5 MAPPING_TABLE = File.join(SOURCE_DIR, 'swfont.txt')
6
7 class MyMapper
8  extend ERB::DefMethod
9   def_erb_method('render()', 'sw2ebas.rhtml')
10   def initialize
11    @lines = Array.new
12     table_file = File.new(MAPPING_TABLE)
13     table_file.each_line do |line|
14       line.chomp!
15       (codepoint, sw, chars) = line.split(/\s/)
16 #      printf("> %s %s %s\n", codepoint, sw, chars)
17       @lines.push([codepoint, sw, chars])
18     end
19   end
20 end
21
22 out = File.new(File.join(TARGET_DIR, 'sw2ebas.html'), 'w')
23 out.print MyMapper.new.render()