view replace_agda.rb @ 48:422e96fda05a

Wrote description monad-laws on delta
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Sun, 15 Feb 2015 12:35:58 +0900
parents 12c5e455fe55
children
line wrap: on
line source

#!/usr/bin/env ruby

replace_table = {
  '->' => 'rightarrow',
  '∙'  => 'circ',
  '≡' => 'equiv',
  '×' => 'times',
  '⟨'  => 'langle',
  '⟩'  => 'rangle',
  '∎'  => 'blacksquare'
}
footer = '.replaced'

sources = Dir.glob('src/*.agda')

sources.each do |src|
  code = File.read(src)

  replace_table.each do |k, v|
    code = code.gsub(k, "@$\\#{v}$@" )
  end

  File.write(src+footer , code)
end