view paper/replace_agda.rb @ 78:6f699b37dc55

Add original number count
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Wed, 18 Feb 2015 12:26:17 +0900
parents 1181b4facaf9
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