diff --git a/htroot/Wiki.java b/htroot/Wiki.java
index a1bb16608..a372eafe0 100644
--- a/htroot/Wiki.java
+++ b/htroot/Wiki.java
@@ -40,6 +40,7 @@
// Contributions and changes to the program code must be marked as such.
// Contains contributions from Alexandier Schier [AS]
+// and Marc Nause [MN]
// You must compile this file with
// javac -classpath .:../classes Wiki.java
@@ -334,27 +335,59 @@ public class Wiki {
// create links
- String kl, kv;
+ String kl, kv, alt, align;
int p;
- // internal links
+ // internal links and images
while ((p0 = result.indexOf("[[")) >= 0) {
p1 = result.indexOf("]]", p0 + 2);
if (p1 <= p0) break; else; {
kl = result.substring(p0 + 2, p1);
- if ((p = kl.indexOf("|")) > 0) {
- kv = kl.substring(p + 1);
- kl = kl.substring(0, p);
- } else {
- kv = kl;
- }
- if (switchboard.wikiDB.read(kl) != null)
- result = result.substring(0, p0) +
- "" + kv + "" +
- result.substring(p1 + 2);
- else
- result = result.substring(0, p0) +
- "" + kv + "" +
- result.substring(p1 + 2);
+
+ // this is the part of the code that's responsible for images
+ // contibuted by [MN]
+ if(kl.startsWith("Image:")){
+ alt = "";
+ align = "";
+ kv = "";
+ kl = kl.substring(6);
+
+ // are there any arguments for the image?
+ if ((p = kl.indexOf("|")) > 0) {
+ kv = kl.substring(p+1);
+ kl = kl.substring(0, p);
+
+ // if there are 2 arguments, write them into ALIGN and ALT
+ if ((p = kv.indexOf("|")) > 0) {
+ align = " align=\"" + kv.substring(0, p) +"\"";
+ alt = " alt=\"" + kv.substring(p + 1) +"\"";
+ }
+
+ // if there is just one, put it into ALT
+ else alt = " alt=\"" + kv +"\"";
+ }
+
+ result = result.substring(0, p0) + "" + result.substring(p1 + 2);
+ }
+ // end contrib [MN]
+
+ // if it's no image, it might be an internal link
+ else {
+
+ if ((p = kl.indexOf("|")) > 0) {
+ kv = kl.substring(p + 1);
+ kl = kl.substring(0, p);
+ } else {
+ kv = kl;
+ }
+ if (switchboard.wikiDB.read(kl) != null)
+ result = result.substring(0, p0) +
+ "" + kv + "" +
+ result.substring(p1 + 2);
+ else
+ result = result.substring(0, p0) +
+ "" + kv + "" +
+ result.substring(p1 + 2);
+ }
}
}