On 14/07/06, Ana Nelson nelson.ana@gmail.com wrote:
Yes, or also:
cat `find /Library/Frameworks/R.framework/Versions/Current/Resources/ library -name "$TM_CURRENT_WORD.html" -print` or cat `find /Library/Frameworks/R.framework/Versions/Current/Resources/ library -name "$TM_CURRENT_SELECTION.html" -print`
would work here too.
True, although it's useful to let TM itself decide whether to use word or selection.
Once you open an R help page in this way, the hyperlinks don't work. Anyone know if it's possible to fix that?
Back to Ruby! This is a little quick and dirty, but it seems to work fine:
#! /usr/bin/ruby text = STDIN.read file = `find /Library/Frameworks/R.framework/Versions/Current/Resources/library -name #{text}.html -print` unless file.empty? dir = File.dirname(file) html = `cat #{file}` print html.gsub(/href=['"]([^'"]+)['"]/, "href="tm-file://#{dir}/\1"") end