diff --git a/source/org/thdl/tib/scanner/LocalTibetanScanner.java b/source/org/thdl/tib/scanner/LocalTibetanScanner.java index bcdeefd..c5b86f5 100644 --- a/source/org/thdl/tib/scanner/LocalTibetanScanner.java +++ b/source/org/thdl/tib/scanner/LocalTibetanScanner.java @@ -165,7 +165,8 @@ public class LocalTibetanScanner extends TibetanScanner if (lastCompSil!=null) { - w = new Word(lastCompWord, lastCompSil.getDefs()); + if (lastCompWord.equals(wordActual)) w = new Word(lastCompWord, lastCompSil.getDefs()); + else w = new Word(lastCompWord, wordActual, lastCompSil.getDefs()); wordList.addLast(w); this.resetAll(); @@ -202,7 +203,8 @@ public class LocalTibetanScanner extends TibetanScanner while (lastCompSil!=null) { - w = new Word(lastCompWord, lastCompSil.getDefs()); + if (lastCompWord.equals(wordActual)) w = new Word(lastCompWord, lastCompSil.getDefs()); + else w = new Word(lastCompWord, wordActual, lastCompSil.getDefs()); wordList.addLast(w); this.resetAll(); diff --git a/source/org/thdl/tib/scanner/OnLineScannerFilter.java b/source/org/thdl/tib/scanner/OnLineScannerFilter.java index ee6ba94..7ea4e63 100644 --- a/source/org/thdl/tib/scanner/OnLineScannerFilter.java +++ b/source/org/thdl/tib/scanner/OnLineScannerFilter.java @@ -351,35 +351,35 @@ public class OnLineScannerFilter extends HttpServlet for (i=0; i < words.length; i++) { - if (words[i] instanceof Word) - { - word = new SwingWord((Word)words[i]); - if (word.getDefs().getDictionarySource()!=null) - pw.print(word.getLink()); - else pw.print(word.getWylie() + " "); - } - else - { - if (words[i] instanceof PunctuationMark) - { - pm = words[i].toString().charAt(0); - switch (pm) - { - case '\n': - pw.println("

"); - pw.print("

"); - break; - case '<': - pw.print("< "); - break; - case '>': - pw.print("> "); - break; - default: - pw.print(pm + " "); - } - } - } + if (words[i] instanceof Word) + { + word = new SwingWord((Word)words[i]); + // if (word.getDefs().getDictionarySource()!=null) + pw.print(word.getLink()); + // else pw.print(word.getWylie() + " "); + } + else + { + if (words[i] instanceof PunctuationMark) + { + pm = words[i].toString().charAt(0); + switch (pm) + { + case '\n': + pw.println("

"); + pw.print("

"); + break; + case '<': + pw.print("< "); + break; + case '>': + pw.print("> "); + break; + default: + pw.print(pm + " "); + } + } + } } pw.println("

"); } @@ -407,34 +407,24 @@ public class OnLineScannerFilter extends HttpServlet word = new SwingWord(words[j]); defs = word.getDefs(); ds = defs.getDictionarySource(); - if (ds==null || ds.isEmpty()) continue; pw.println(" "); - tag = ds.getTag(0); - // else tag = null; - /*if (tag!=null) - {*/ - pw.println(" "+ word.getBookmark(tibetan) +""); - pw.println(" "+ tag +""); - pw.println(" " + defs.def[0] + ""); - /*} - else - { - pw.println(" "+ words[j].getBookmark(tibetan) +""); - pw.println(" " + defs.def[0] + ""); - }*/ + if (ds!=null && !ds.isEmpty()) tag = ds.getTag(0); + else tag = " "; + + pw.println(" "+ word.getBookmark(tibetan) +""); + pw.println(" "+ tag +""); + pw.println(" " + defs.def[0] + ""); + pw.println(" "); for (i=1; i"); - if (ds!=null) tag = ds.getTag(i); - else tag = null; - if (tag!=null) - { - pw.println(" "+ tag +""); - pw.println(" " + defs.def[i] + ""); - } - else pw.println(" " + defs.def[i] + ""); - pw.println(" "); + pw.println(" "); + if (ds!=null && !ds.isEmpty()) tag = ds.getTag(i); + else tag = " "; + pw.println(" "+ tag +""); + pw.println(" " + defs.def[i] + ""); + //else pw.println(" " + defs.def[i] + ""); + pw.println(" "); } } catch (Exception e) diff --git a/source/org/thdl/tib/scanner/SwingWord.java b/source/org/thdl/tib/scanner/SwingWord.java index 524c9b9..5f5542d 100644 --- a/source/org/thdl/tib/scanner/SwingWord.java +++ b/source/org/thdl/tib/scanner/SwingWord.java @@ -76,28 +76,31 @@ public class SwingWord extends Word return getLink(false); } + /** Returns the word marked up as a link. + * + */ public String getLink(boolean tibetan) { String localWord, result=null; - // String result; - if (wordSinDec==null) localWord = super.token; - else localWord = wordSinDec; - if (tibetan) - { - try - { - result = TibetanHTML.getHTML(localWord + " "); - } - catch (Exception e) - { - result = localWord; - } - } - else result = localWord; -/* result = "" + localWord; - if (tibetan) result+= ""; - else result+= " "; - return result;*/ - return "" + result + " "; + + if (wordSinDec==null) localWord = super.token; + else localWord = wordSinDec; + if (tibetan) + { + try + { + result = TibetanHTML.getHTML(localWord + " "); + } + catch (Exception e) + { + result = localWord; + } + } + else result = localWord; +/* result = "" + localWord; + if (tibetan) result+= ""; + else result+= " "; + return result;*/ + return "" + result + " "; } }