https://github.com/cran/CollocInfer
Raw File
Tip revision: 41bf713b4d66e5c1d58114455c66a35ff8f8f7c3 authored by Giles Hooker on 29 July 2011, 00:00:00 UTC
version 0.1.7
Tip revision: 41bf713
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