https://github.com/cran/fda
Raw File
Tip revision: ef3c5a4789b77f2f7a328fc26ed5419b233d4eb3 authored by J. O. Ramsay on 26 April 2007, 00:00:00 UTC
version 1.2.0
Tip revision: ef3c5a4
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