Mercurial > hg > Papers > 2018 > nozomi-master
view paper/escape_agda.rb @ 189:1369f653e34e default tip
fix
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 01 Mar 2018 15:04:46 +0900 |
parents | 40ae32725e55 |
children |
line wrap: on
line source
#!/usr/bin/env ruby Suffix = '.agda.replaced' EscapeChar = '@' FileName = ARGV.first ReplaceTable = { '->' => 'rightarrow', '⊔' => 'sqcup', '∷' => 'text{::}', '∙' => 'circ', '≡' => 'equiv', '×' => 'times', '⟨' => 'langle', '⟩' => 'rangle', '₁' => 'text{1}', 'ℕ' => 'mathbb{N}', '∎' => 'blacksquare' } code = File.read(FileName) ReplaceTable.each do |k, v| escaped_str = EscapeChar + "$\\#{v}$" + EscapeChar code = code.gsub(k, escaped_str) end File.write(FileName.sub(/.agda$/, Suffix), code)