Skip to content

Commit

Permalink
*) yacyWiki: easy way to link to files on local peers (external links)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1223 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
low012 committed Dec 16, 2005
1 parent 3df24b8 commit eb0f511
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions source/de/anomic/data/wikiCode.java
Expand Up @@ -349,7 +349,7 @@ public String transformLine(String result, plasmaSwitchboard switchboard) {
}

// replace incomplete URLs and make them point to http://peerip:port/...
// with this feature you can acces an image in DATA/HTDOCS/share/yacy.gif
// with this feature you can access an image in DATA/HTDOCS/share/yacy.gif
// using the wikicode [[Image:share/yacy.gif]]
// or an image DATA/HTDOCS/grafics/kaskelix.jpg with [[Image:grafics/kaskelix.jpg]]
// you are free to use other sub-paths of DATA/HTDOCS
Expand Down Expand Up @@ -385,12 +385,20 @@ public String transformLine(String result, plasmaSwitchboard switchboard) {
if ((p = kl.indexOf(" ")) > 0) {
kv = kl.substring(p + 1);
kl = kl.substring(0, p);
} else {
}
// No text for the link? -> <a href="http://www.url.com/">http://www.url.com/</a>
else {
kv = kl;
}
if (!(kl.startsWith("http://"))) kl = "http://" + kl;
// replace incomplete URLs and make them point to http://peerip:port/...
// with this feature you can access a file at DATA/HTDOCS/share/page.html
// using the wikicode [share/page.html]
// or a file DATA/HTDOCS/www/page.html with [www/page.html]
// you are free to use other sub-paths of DATA/HTDOCS
if (!((kl.startsWith("http://"))||(kl.startsWith("ftp://")))) {
kl = "http://" + yacyCore.seedDB.mySeed.getAddress().trim() + "/" + kl;
}
result = result.substring(0, p0) + "<a class=\"extern\" href=\"" + kl + "\">" + kv + "</a>" + result.substring(p1 + 1);

}
}

Expand Down

0 comments on commit eb0f511

Please sign in to comment.