1#!/usr/bin/env ruby 2# 3# Lao 4# 5# Script written by Mojca Miklavec <mojca.miklavec.lists at gmail.com> 6# (who is not the author of patterns) 7# 8$file = File.new("../../../../../tex/generic/hyph-utf8/patterns/tex/hyph-lo.tex", "w") 9$file = File.new("/tmp/hyph-lo.tex", "w") 10 11# write comments into the file 12def add_comment(str) 13 $file.puts "% " + str.gsub(/\n/, "\n% ").gsub(/% \n/, "%\n") 14end 15 16vowels=%w{ա ե է ը ի ո օ} 17consonants=%w{բ գ դ զ թ ժ լ խ ծ կ հ ձ ղ ճ մ յ ն շ չ պ ջ ռ ս վ տ ր ց փ ք} 18 19add_comment( 20"Hyphenation patterns for Armenian. 21 22Written by Sahak Petrosyan <sahak at mit.edu> 23 for Hyphenator.js (http://code.google.com/p/hyphenator/) 24 and later adapted for TeX 25 26Licence: LGPL 27Version: May 2010 28 29These are just primitive rules that hyphenate combinations like 30<vowel> - <consonant><vowel>. 31 32File auto-generated by a script (see source/generic/hyph-utf8/languages/hy) 33 34Vowels: #{vowels.join(" ")} 35Consonants: #{consonants.join(" ")} 36 37Some of the patterns below represent combinations that never 38appear in Armenian, but they would be hyphenated according to the rules. 39") 40 41$file.puts '\patterns{' 42 43add_comment( 44"և-<vowel>") 45vowels.each do |vowel| 46 $file.puts "և1#{vowel}" 47end 48 49add_comment( 50"<vowel>-<consonant><vowel>") 51vowels.each do |v1| 52 consonants.each do |c| 53 patterns = [] 54 vowels.each do |v2| 55 patterns.push "#{v1}1#{c}#{v2}" 56 end 57 $file.puts patterns.join(" ") 58 end 59 $file.puts "%" 60end 61 62$file.puts "}" 63