[sword-svn] r241 - in trunk: . src/org/crosswire/swordweb webapp
webapp/examples
scribe at crosswire.org
scribe at crosswire.org
Sat Jan 28 21:45:50 MST 2006
Author: scribe
Date: 2006-01-28 21:45:49 -0700 (Sat, 28 Jan 2006)
New Revision: 241
Added:
trunk/webapp/examples/
Removed:
trunk/examples/
Modified:
trunk/src/org/crosswire/swordweb/PerseusUtils.java
trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java
trunk/webapp/examples/suggest.jsp
trunk/webapp/init.jsp
Log:
Updated to new directory scheme
Modified: trunk/src/org/crosswire/swordweb/PerseusUtils.java
===================================================================
--- trunk/src/org/crosswire/swordweb/PerseusUtils.java 2006-01-29 04:12:14 UTC (rev 240)
+++ trunk/src/org/crosswire/swordweb/PerseusUtils.java 2006-01-29 04:45:49 UTC (rev 241)
@@ -18,25 +18,35 @@
public static String getLiddellScottDef(String lemma) {
UnicodeToBetacode bc = new UnicodeToBetacode();
String retVal = "";
- String lemmaUnicode = lemma;
- lemma = bc.convertString(lemma).toLowerCase();
- // Perseus wants final sigma to be "s"
- if (lemma.endsWith("j")) lemma = lemma.substring(0, lemma.length()-1) + "s";
XPath xpath = XPathFactory.newInstance().newXPath();
String expression = "//entry/sense";
URL url = null;
- try {
- url = new URL("http://www.perseus.tufts.edu/hopper/xmlchunk.jsp?doc=Perseus%3Atext%3A1999.04.0058%3Aentry%3D"+URLEncoder.encode(lemma));
- InputSource inputSource = new InputSource(url.openStream());
- DTMNodeList nodes = (DTMNodeList)xpath.evaluate(expression, inputSource, XPathConstants.NODESET);
- if (nodes.getLength() > 0) {
- retVal = "<h2><span class=\"verse\">"+lemmaUnicode+"</span></h2>";
- for (int i = 0; i < nodes.getLength(); i++) {
- Node n = nodes.item(i);
- retVal += outputSenseNode(n);
- }
- }
- } catch (Exception ex) { ex.printStackTrace(); }
+ int start = 0;
+ int end = 0;
+ if (lemma.indexOf(", ") > -1) {
+ retVal = "<h2><span class=\"verse\">"+lemma+"</span></h2>";
+ }
+ do {
+ end = lemma.indexOf(", ", start);
+ String part = (end > -1) ? lemma.substring(start, end) : lemma.substring(start);
+ String lemmaUnicode = part;
+ part = bc.convertString(part).toLowerCase();
+ // Perseus wants final sigma to be "s"
+ if (part.endsWith("j")) part = part.substring(0, part.length()-1) + "s";
+ start = end + 2;
+ try {
+ url = new URL("http://www.perseus.tufts.edu/hopper/xmlchunk.jsp?doc=Perseus%3Atext%3A1999.04.0058%3Aentry%3D"+URLEncoder.encode(part));
+ InputSource inputSource = new InputSource(url.openStream());
+ DTMNodeList nodes = (DTMNodeList)xpath.evaluate(expression, inputSource, XPathConstants.NODESET);
+ if (nodes.getLength() > 0) {
+ retVal += "<h2><span class=\"verse\">"+lemmaUnicode+"</span></h2>";
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node n = nodes.item(i);
+ retVal += outputSenseNode(n);
+ }
+ }
+ } catch (Exception ex) { ex.printStackTrace(); }
+ } while (end > -1);
return retVal;
}
Modified: trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java
===================================================================
--- trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java 2006-01-29 04:12:14 UTC (rev 240)
+++ trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java 2006-01-29 04:45:49 UTC (rev 241)
@@ -41,7 +41,7 @@
final boolean rtol = ("RtoL".equalsIgnoreCase(mod
.getConfigEntry("Direction")));
- String[] heads = mod.getEntryAttribute("Heading", "Preverse", "0");
+ String[] heads = mod.getEntryAttribute("Heading", "Preverse", "0", true);
if (heads.length > 0) {
if (header == null) {
header = new StringBuffer();
Copied: trunk/webapp/examples (from rev 240, trunk/examples)
Modified: trunk/webapp/examples/suggest.jsp
===================================================================
--- trunk/examples/suggest.jsp 2006-01-29 04:12:14 UTC (rev 240)
+++ trunk/webapp/examples/suggest.jsp 2006-01-29 04:45:49 UTC (rev 241)
@@ -34,9 +34,11 @@
if (mod != null && key != null) {
SWModule book = mgr.getModuleByName(mod);
if (book != null) {
+System.err.println("setting: ["+key+"]");
book.setKeyText(key);
String body = new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8");
String keyText = new String(book.getKeyText().getBytes("iso8859-1"), "UTF-8");
+System.err.println("getting: ["+keyText+"]");
out.print("<h2>"+keyText+"</h2>"+body);
}
}
Modified: trunk/webapp/init.jsp
===================================================================
--- trunk/webapp/init.jsp 2006-01-29 04:12:14 UTC (rev 240)
+++ trunk/webapp/init.jsp 2006-01-29 04:45:49 UTC (rev 241)
@@ -31,15 +31,15 @@
styleFiles = new Vector();
styleDescriptions = new Vector();
+ styleNames.add("Washed Out");
+ styleFiles.add("wash.css");
+
styleNames.add("Parchment");
styleFiles.add("parchment.css");
styleNames.add("Sandy Creek");
styleFiles.add("sandy.css");
- styleNames.add("Washed Out");
- styleFiles.add("wash.css");
-
tabNames = new Vector();
tabLinks = new Vector();
tabTitles = new Vector();
More information about the sword-cvs
mailing list