packagevelthuisimport("fmt""io/ioutil""os""path/filepath""regexp""strings")varpaliWordsInVelthuisScheme=regexp.MustCompile(`[abcdeghijklmnoprstuvyABCDEGHIJKLMNOPRSTUVY"~.]+`)funcreplacePaliWordsInVelthuisScheme(b[]byte)[]byte{iflen(b)==1{returnb}ifstring(b)==".."{returnb}fmt.Println(string(b))returnb}funcprocessRst(pathstring){fmt.Println("processing "+path+" ...")b,err:=ioutil.ReadFile(path)iferr!=nil{panic(err)}paliWordsInVelthuisScheme.ReplaceAllFunc(b,replacePaliWordsInVelthuisScheme)}funcFindPaliWordsInVelthuisScheme(dirnamestring){// walk all files in directoryfilepath.Walk(dirname,func(pathstring,infoos.FileInfo,errerror)error{if!info.IsDir()&&strings.HasSuffix(info.Name(),".rst"){processRst(path)}returnnil})}