Here's an example of one of the helpers. The problem: I need to annotate a bunch of Ruby code in RDoc, and I want to add a link to the bottom of the RDoc in every file that points to the source directory of the file in question. But, it needs to be a relative path. There is probably some really much cooler way to solve this, but here is the snippet I created:
---
source: link:../${TM_FILEPATH/\/Users\/jNf\/Documents\/dev\/ruby\/meta-programming\///}
This says to add a horizontal rule (the "---" in RDoc), then do a substitution for the built-in TM_FILEPATH variable, substituting the full path stuff (up to the file name) with nothing. The general syntax for the substitution is ${VARIABLE/pattern/substituion}. The resulting link looks like this:
Which is exactly what I want.
---
source: link:../16.delegation/forwarding.rb
No comments:
Post a Comment