From d6cc0ec3d8491871abd1d02e3472628ab1319a45 Mon Sep 17 00:00:00 2001 From: low012 Date: Mon, 27 Feb 2006 12:33:34 +0000 Subject: [PATCH] *) Fixed a bug: Images in tables were not displayed if alt or align attributes were added. *) Align for images only accepts valid parameters (bottom, top, center, middle, left , right) now. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1775 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/data/wikiCode.java | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/data/wikiCode.java b/source/de/anomic/data/wikiCode.java index 15d28a379..dbbed1696 100644 --- a/source/de/anomic/data/wikiCode.java +++ b/source/de/anomic/data/wikiCode.java @@ -311,7 +311,16 @@ public class wikiCode { else if ((result.startsWith("||")) && (table)) { line+="\t\t0)?(result.indexOf("||",2)):(result.length()); - int propEnd=(result.indexOf("|",2)>0)?(result.indexOf("|",2)):(cellEnd); + int propEnd = 0; + //If resultOf("[[Image:") is less than propEnd, that means that there is no + //property for this cell, only an image. Without this, YaCy could get confused + //by a | in [[Image:picture.png|alt-text]] or [[Image:picture.png|alt-text]] + if(((propEnd = result.indexOf("|",2)) > 0)&&(!(result.indexOf("[[Image:",2) < propEnd))){ + propEnd = result.indexOf("|",2); + } + else { + propEnd = cellEnd; + } // both point at same place => new line if (propEnd==cellEnd) { propEnd=1; @@ -747,7 +756,19 @@ public class wikiCode { // if there are 2 arguments, write them into ALIGN and ALT if ((p = kv.indexOf("|")) > 0) { - align = " align=\"" + kv.substring(0, p) + "\""; + align = kv.substring(0, p); + //checking validity of value for align. Only non browser specific + //values get supported. Not supported: absmiddle, baseline, texttop + if ((align.equals("bottom"))|| + (align.equals("center"))|| + (align.equals("left"))|| + (align.equals("middle"))|| + (align.equals("right"))|| + (align.equals("top"))) + { + align = " align=\"" + align + "\""; + } + else align = ""; alt = " alt=\"" + kv.substring(p + 1) + "\""; }