#!/usr/bin/env ruby # Copyright (C) 2003, NAGY Bence # This program can be distributed under the terms of the # GNU General Public License version 2. $programname='Testhyphenation' $programversion='v20031102' class Testhyphenation def initialize print "Minták betöltése...\n" @patterns=[] patterns=0 IO.foreach("huhyphn.tex"){|aline| unless aline=~/[\\%{}]/ aline=aline.gsub('®','õ').gsub('¶','û') letter=false key,value='','' aline.chop.length.times{|i| if aline[i,1]=~/\d/ value<key.length key.length.times{|i| pattern<1 key='.'+word+'.' value='0'*key.length key.tr!('A-ZÁÄÉÍÓÖÕÚÜÛ','a-záäéíóöõúüû') pattern='' 1.upto(key.length){|i| 0.upto(key.length-i){|j| if @patterns[i] and pattern=@patterns[i][key[j,i]] print "\t",getpattern(key[j,i].dup,pattern.dup),"\n" pattern.length.times{|k| value[j+i-pattern.length+k]=pattern[k] if value[j+i-pattern.length+k] #{hyphenated}\n\n" hyphenated end end print "#{$programname} #{$programversion}\n" testhyphenation=Testhyphenation.new while gets break if $_=="\n" testhyphenation.hyphenword($_.strip) end