RE: Haddock's -s switch is broken

On 02 May 2005 12:40, Peter Simons wrote:
it appears that the '-s' switch in the CVS-HEAD version of Haddock stopped working the way I know it. I run
haddock -h -s . *.hs
to generate the documentation, and it does have the "Source Code" link on every page, but the link points to the "." _directory_, not to "./{module-name}.hs" file like it should.
Am I doing something wrong or is this a bug?
If you're using Haddock from CVS, then it works a little differently. Actually, I didn't think I'd committed this change, it looks like it crept in with something else... so feedback is welcome, we can always change it. I was experimenting to see whether we could get accurate source code links from the library documentation, but that didn't work out (we still can't tell the orignal source filename because the files are preprocessed before Haddock sees them). Anyway, in CVS, the argument to -s is transformed as follows: - the string %M is replaced by the module name (with '.' replaced by '/') - the string %F is replaced by the source file name so to get the behaviour of Haddock 0.6, you say 'haddock -s <url>/%F'. Cheers, Simon

Simon Marlow writes:
Anyway, in CVS, the argument to -s is transformed as follows:
- the string %M is replaced by the module name (with '.' replaced by '/')
- the string %F is replaced by the source file name
so to get the behaviour of Haddock 0.6, you say 'haddock -s <url>/%F'.
Very cool. Adding the '%F' did fix the problem; thanks for the pointer. I am all for having links to the source code wherever possible, by the way, I think that's the right direction to go. IMHO, the best solution would be generate the pages with the source along with the documentation. This approach gets rid of most file-name-guessing problems, and it allows for nifty features to be added (such as adding hyperlinks in the source code, too). Doxygen, which seems to be C++'s Haddock on steroids, does it this way and it works nicely. Peter
participants (2)
-
Peter Simons
-
Simon Marlow