View Single Post
Old 09-15-2004, 02:09 PM   #14
Francesco
Aficionado
Francesco will become famous soon enoughFrancesco will become famous soon enoughFrancesco will become famous soon enoughFrancesco will become famous soon enoughFrancesco will become famous soon enoughFrancesco will become famous soon enoughFrancesco will become famous soon enough
 
Francesco's Avatar
 
Posts: 391
Karma: 710
Join Date: Jul 2003
Location: Denver, CO, USA
Device: Nexus 7, Kindle Touch
Quote:
Originally Posted by Laurens
If you're interested, you can also look at the link rewriting feature available through scripting. This lets you change links on-the-fly so that they point to printable versions of articles. Scripting is much simpler than XSLT and it's also documented(open "Help Contents" from within Sunrise). There are several example SDLs in the distribution that use link rewriting, including NY Times and Brighthand.
Ok, I'm really excited now.
I need to combine two script instructions, append and replace. How do I do that?
I.e. I need to change links of this type:

http://www.xxxxx.com/aaa/bbb/ccc/

Into this:

http://www.xxxxx.com/ddd/print.asp?hand=6&page=../aaa/bbb/ccc/default.html

what about this:
Code:
document.onanchorlink = function(link) {
	link.uri = link.uri.replace("http://www.xxxxx.com/aaa/bbb/ccc/", "http://www.xxxxx.com/ddd/print.asp?hand=6&page=../aaa/bbb/ccc/");
	link.uri += "default.html";
};
I doesn't work, but maybe my fault is somewhere else.

Last edited by Francesco; 09-15-2004 at 02:27 PM.
Francesco is offline