Home
The Toolkit for Online Communities
15900 Community Members, 0 members online, 2455 visitors today
Log In Register

Forum OpenACS Q&A: FYI: Making links to api-doc

OpenACS Home : Forums : OpenACS Q&A : FYI: Making links to api-doc

Icon of Envelope Request notifications

+
Posted by Lars Pind on
I'd just finished the package developer's guide to workflow, when I realized that it would be really nice if all mentions of workflow API were made links to the api-documentation.

So Peter helped me write this little Perl script, which does that. It's idempotent, meaning you can run it multiple times, and it won't mess up.

perl -pi -e 's#([^=])(workflow::[a-z_:]+)(?=[^a-z_:])(?!</a>)#\1<a href="/api-doc/proc-view?proc=\2">\2</a>\3#g' developer-guide.html

You'll need to modify it for your own needs. I'm searching for 'workflow::' here, only care about lowercase, and I deliberately only process the developer-guide file, which is in HTML.

It would be good if our docbook XSL contained a tag for API procs, which would do this.

/Lars

+
Posted by Roberto Mello on
Lars,

That's great. Last night I suggested on #openacs that we could change api-doc to cross-reference function calls. We could search for the functions executed within [] and make links to api-doc.

-Roberto

+
Posted by Jamie Rasmussen on
I have a procedure that does cross-linking and colorization in api-doc.  I haven't submitted it as a patch because of some known bugs, but I already find it invaluable during development.  See  http://empoweringminds.mle.ie/openacs/openacs_changes.html for the code.
+
Posted by Peter Marklund on
Jamie,
thanks for posting about this as I hadn't seen it before! I think what you're doing is superb! If you submit the patch I volunteer to apply it tomorrow...

Since your code looks very readable and well designed I'm sure we can collectively weed out the remaining bugs in the proc.

+
Posted by Roberto Mello on
That's right... I remember now. I had forgotten about Jamie's proc. That's exactly what I had in mind!

-Roberto

+
Posted by Jamie Rasmussen on
I've submitted the colorization and cross-linking patch: http://openacs.org/bugtracker/openacs/patch?patch_number=156
+
Posted by Jamie Rasmussen on
One other thing that I noticed while testing the proc: In ad_form, there is a call to report -code error; should that be return -code error?
+
Posted by Peter Marklund on
Jamie,
yes, it should - thanks for catching that mistake. Change report to return.