Revision 6d754374c2840d8292035ea1d14eec280b964a06 authored by Giles Hooker on 25 April 2010, 00:00:00 UTC, committed by Gabor Csardi on 25 April 2010, 00:00:00 UTC
1 parent 053ac3c
Raw File
add-links.rb

Dir["*/*.[rR]d"].each do |path|
  puts path
  file = File.new(path, "r")

  update = file.read.gsub(/\\seealso\{(.*?)\}/smi) do
    "\\seealso{\n" +
    $1.gsub("\n","").split(/[\, ]+/).map{|f| "\\code{\\link{#{f}}}"}.join(", \n") +
    "\n}"
  end
  
  file.close

  file = File.new(path, "w")
  file.write update
  file.close
  
end
back to top