last updated:

In the same vein as the fix yesterday, here’s a fix for the same problem with relative image src attributes.

(Briefly, if you use a relative src attribute — like <img src=”/image.jpg”> rather than <img src=”http://some.site.com/image.jpg”> — then the XML that’s generated by Manila keeps the path relative, which means that My.Userland doesn’t understand it, and tries to make the image source relative to http://my.userland.com/>.)

So, to fix the problem, here’s a patch to the script manilaSuite.xml.getScriptingNewsXml. I recommend that you not modify the script, but rather that you copy it into some other site, modify that copy, and then change the script that sits at your Manila site’s xml/scriptingNews2.xml location to call your version.

Add the following function to the script (I added it between the encodeWithAmpersands and extractLinks functions). Note that, if you didn’t know it already, Frontier is very smart about cut & paste — you can just copy the below procedure, highlight the place in your script that you want it, and paste it, and Frontier will correctly format it.

on fixImageTags (s) { // added by JEL 01/05/2000
	local {
		pat1 = "<img ", pat2 = "src=\"", pat3 = ">";
		loc1, loc2, loc3;
		newS};
	loop {
		loc1 = string.patternMatch(pat1, string.lower(s));
		if loc1 == 0 {
			break};
		newS = string.mid(s, 1, loc1 + 4);
		s = string.delete(s, 1, loc1 + 4);
		loc2 = string.patternMatch(pat2, string.lower(s));
		loc3 = string.patternMatch(pat3, s);
		if loc3 < loc2 { // no src attribute
			break};
		if loc2 != 1 { // the src attribute isn't first
			newS = newS + string.mid(s, 1, loc2 + 3);
			s = string.delete(s, 1, loc2 + 3)}
		else {
			newS = newS + string.mid(s, 1, 4);
			s = string.delete(s, 1, 4)};
		if string.mid(s, 1, 1) == "\"" { // deal with quotes
			newS = newS + "\"";
			s = string.mid(s, 2, infinity)};
		if string.patternMatch(":", s) == 0 { // relative link!
			newS = newS + pta^.ftpSite^.url;
			if string.mid(s, 1, 1) == "/" { // remove slash
				s = string.mid(s, 2, infinity)}};
		loc3 = string.patternMatch(pat3, s);
		newS = newS + string.mid(s, 1, loc3);
		s = string.delete(s, 1, loc3)};
	newS = newS + s;
	return(newS)}

Next, add a single line to the chewOneBit function. Between the two lines that read:

s = extractLinks (s, @links, @lines);
add ("<item>"); indent++

add a line so that they read:

s = extractLinks (s, @links, @lines);
s = fixImageTags(s);
add ("<item>"); indent++

You should be all set! This patch takes into account that the image tag doesn’t always carry the src parameter right after the opening img text, and that the whole thing can be in upper case or lower case.