Mercurial > hg > Papers > 2021 > soto-prosym
view Paper/src/escape_agda.rb @ 0:c59202657321
init
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Nov 2021 06:55:58 +0900 |
parents | |
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', 'λ' => 'lambda', '∧' => 'wedge', '⇒' => 'Rightarrow', '¬' => 'neg', '≤' => 'leq', '⊥' => 'bot', } 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)