[sword-svn] r441 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Sat Aug 19 02:45:16 MST 2017


Author: scribe
Date: 2017-08-19 02:45:15 -0700 (Sat, 19 Aug 2017)
New Revision: 441

Modified:
   trunk/webapp/fetchdata.jsp
Log:
added better support for in/sub-scriptio
fixed liddell-scott lookup with utf-8 key


Modified: trunk/webapp/fetchdata.jsp
===================================================================
--- trunk/webapp/fetchdata.jsp	2017-08-19 09:43:36 UTC (rev 440)
+++ trunk/webapp/fetchdata.jsp	2017-08-19 09:45:15 UTC (rev 441)
@@ -20,9 +20,13 @@
 
 	SWMgr mgr = SwordOrb.getSWMgrInstance(request);
 	SWModule book = null;
+	String modName = request.getParameter("mod");
 	String ks = request.getParameter("key");
-	if (ks != null) ks = new String(ks.getBytes("iso8859-1"), "UTF-8");
-	String modName = request.getParameter("mod");
+
+	if (ks != null && !"betacode".equals(modName)) {
+		ks = new String(ks.getBytes("iso8859-1"), "UTF-8");
+	}
+//	if (ks != null) ks = new String(ks.getBytes("iso8859-1"), "UTF-8");
 	String fn = request.getParameter("fn");
 	String format = request.getParameter("format");
 	mgr.setGlobalOption("Footnotes", "Off");
@@ -56,7 +60,7 @@
 			String key = parts[i];
 
 			if ("betacode".equals(modName)) {
-				key = new String(key.getBytes("iso8859-1"), "UTF-8");
+//				key = new String(key.getBytes("iso8859-1"), "UTF-8");
 			}
 
 			if (i > 0) out.print("<br/>__________________<br/><br/>");
@@ -221,14 +225,45 @@
 					}
 
 					// shift subscriptio to the end
-					if (keyList.length > 0 && SwordOrb.BIBLES.equals(book.getCategory()) && keyList[0].split("\\.").length == 2 && "1".equals(keyList[0].split("\\.")[1])) {
-						String start = keyList[0];
-						System.arraycopy(keyList, 1, keyList, 0, keyList.length - 1);
-						keyList[keyList.length - 1] = start;
+					boolean lastInscriptio = false;
+					String subscriptio = null;
+					if (keyList.length > 0 && SwordOrb.BIBLES.equals(book.getCategory())) {
+						String curBook = "";
+//System.out.println("***** cleaning up in/subsriptios");
+						for (int k = 0; k < keyList.length; ++k) {
+							String keyParts[] = keyList[k].split("\\.");
+							String thisBook = keyParts[0];
+//System.out.println("Key: " + keyList[k] + "; thisBook: " + thisBook + "; keyParts.length: " + keyParts.length + "; lastInscription: " + lastInscriptio);
+
+							if (subscriptio != null && thisBook != curBook) {
+								keyList[k-1] = subscriptio;
+								subscriptio = null;
+								curBook = thisBook;
+							}
+							if (keyParts.length == 2 && "1".equals(keyParts[1])) {
+//System.out.println("Scriptio found ("+k+"): " + keyList[k]);
+								if (lastInscriptio) keyList[k] = null;
+								else subscriptio = keyList[k];
+							}
+							lastInscriptio = (keyParts.length == 1);
+							if (subscriptio != null && k < keyList.length-1) {
+								keyList[k] = keyList[k+1]; 
+							}
+							curBook = thisBook;
+/* shift first to end
+							String start = keyList[0];
+							System.arraycopy(keyList, 1, keyList, 0, keyList.length - 1);
+							keyList[keyList.length - 1] = start;
+*/
+						}
+						if (subscriptio != null) keyList[keyList.length-1] = subscriptio;
+//System.out.println("===== finished cleaning up in/subsriptios");
 					}
 
+
 					for (int k = 0; k < keyList.length; ++k) {
 						String k1 = keyList[k];
+						if (k1 == null) continue;
 						
 						// kludge for verse 0 which comes out to e.g., "Rev.2"
 						if (k1.split("\\.").length == 2 && SwordOrb.BIBLES.equals(book.getCategory())) {
@@ -240,9 +275,9 @@
 							k1 = "=" + k1 + ".0.0";
 //							continue;	// just skip chapter headings
 						}
-System.out.println("key: " + k1);
+//System.out.println("key: " + k1);
 						book.setKeyText(k1);
-System.out.println("book key: " + book.getKeyText());
+//System.out.println("book key: " + book.getKeyText());
 						if (("StrongsGreek".equals(modName)) && ("3588".equals(k1))) {
 							out.print("with Greek Article");
 						}




More information about the sword-cvs mailing list