[sword-svn] r1984 - in trunk: include src/modules/filters

scribe at www.crosswire.org scribe at www.crosswire.org
Sat Oct 7 22:06:58 MST 2006


Author: scribe
Date: 2006-10-07 22:06:52 -0700 (Sat, 07 Oct 2006)
New Revision: 1984

Modified:
   trunk/include/swbasicfilter.h
   trunk/include/swbuf.h
   trunk/src/modules/filters/gbffootnotes.cpp
   trunk/src/modules/filters/gbfrtf.cpp
   trunk/src/modules/filters/osisrtf.cpp
   trunk/src/modules/filters/swbasicfilter.cpp
Log:
Updated filters to better handle a few small things like GBF footnotes in the ASV, and divineName in the beta of the NASB.

Modified: trunk/include/swbasicfilter.h
===================================================================
--- trunk/include/swbasicfilter.h	2006-10-05 07:51:20 UTC (rev 1983)
+++ trunk/include/swbasicfilter.h	2006-10-08 05:06:52 UTC (rev 1984)
@@ -39,6 +39,7 @@
 	const SWModule *module;
 	const SWKey *key;
 	SWBuf lastTextNode;
+	SWBuf lastSuspendSegment;
 	bool suspendTextPassThru;
 	bool supressAdjacentWhitespace;
 };

Modified: trunk/include/swbuf.h
===================================================================
--- trunk/include/swbuf.h	2006-10-05 07:51:20 UTC (rev 1983)
+++ trunk/include/swbuf.h	2006-10-08 05:06:52 UTC (rev 1984)
@@ -151,9 +151,15 @@
 	*/
 	inline unsigned long size() const { return length(); }
 
+	/** 
+	 * set's the size of the buffer.  This is a quick inline method which checks
+	 * for changes before actually calling setSize().
+	 * @param newSize new size of the buffer
+	 */
+	inline void size(unsigned long newSize) { if (end - buf - newSize) setSize(newSize); }
+
 	/**
 	* @return size() and length() return only the number of characters of the string.
-	* Add one for the following null and one for each char to be appended!
 	*/
 	inline unsigned long length() const { return end - buf; }
 

Modified: trunk/src/modules/filters/gbffootnotes.cpp
===================================================================
--- trunk/src/modules/filters/gbffootnotes.cpp	2006-10-05 07:51:20 UTC (rev 1983)
+++ trunk/src/modules/filters/gbffootnotes.cpp	2006-10-08 05:06:52 UTC (rev 1984)
@@ -74,9 +74,9 @@
 				
 					if((tagText.length() == 1) || !strcmp(module->Name(), "IGNT")) {
 						if (option) { // for ASV marks text in verse then put explanation at end of verse
-							text.append(" <FS>(");
+							text.append(" <FS>[");
 							text.append(tagText);
-							text.append(")<Fs>");
+							text.append("]<Fs>");
 							hide = false;
 							continue;
 						}

Modified: trunk/src/modules/filters/gbfrtf.cpp
===================================================================
--- trunk/src/modules/filters/gbfrtf.cpp	2006-10-05 07:51:20 UTC (rev 1983)
+++ trunk/src/modules/filters/gbfrtf.cpp	2006-10-08 05:06:52 UTC (rev 1984)
@@ -180,10 +180,10 @@
 					text += "</a>";
 				  continue;
 				case 'F':               // footnote begin
-					text += "{\\i1 \\sub (";
+					text += "{\\i1 \\sub [ ";
 					continue;
 				case 'f':               // footnote end
-					text += ") }";
+					text += " ] }";
 					continue;
 				}
 				break;

Modified: trunk/src/modules/filters/osisrtf.cpp
===================================================================
--- trunk/src/modules/filters/osisrtf.cpp	2006-10-05 07:51:20 UTC (rev 1983)
+++ trunk/src/modules/filters/osisrtf.cpp	2006-10-08 05:06:52 UTC (rev 1984)
@@ -60,8 +60,8 @@
 			delete tagData;
 		}
 	}
-static inline void outText(const char *t, SWBuf &o, BasicFilterUserData *u) { if (!u->suspendTextPassThru) o += t; }
-static inline void outText(char t, SWBuf &o, BasicFilterUserData *u) { if (!u->suspendTextPassThru) o += t; }
+static inline void outText(const char *t, SWBuf &o, BasicFilterUserData *u) { if (!u->suspendTextPassThru) o += t; else u->lastSuspendSegment += t; }
+static inline void outText(char t, SWBuf &o, BasicFilterUserData *u) { if (!u->suspendTextPassThru) o += t; else u->lastSuspendSegment += t; }
 };
 
 
@@ -448,7 +448,7 @@
 				u->suspendTextPassThru = (++u->suspendLevel);
 			}
 			else if (tag.isEndTag()) {
-				SWBuf lastText = u->lastTextNode.c_str();
+				SWBuf lastText = u->lastSuspendSegment.c_str();
 				u->suspendTextPassThru = (--u->suspendLevel);
 				if (lastText.size()) {
 					toupperstr(lastText);

Modified: trunk/src/modules/filters/swbasicfilter.cpp
===================================================================
--- trunk/src/modules/filters/swbasicfilter.cpp	2006-10-05 07:51:20 UTC (rev 1983)
+++ trunk/src/modules/filters/swbasicfilter.cpp	2006-10-08 05:06:52 UTC (rev 1984)
@@ -382,9 +382,11 @@
 		else {
  			if ((!userData->supressAdjacentWhitespace) || (*from != ' ')) {
 				if (!userData->suspendTextPassThru) {
-					text.append( *from );
+					text.append(*from);
+					userData->lastSuspendSegment.size(0);
 				}
-				lastTextNode.append( *from );
+				else	userData->lastSuspendSegment.append(*from);
+				lastTextNode.append(*from);
  			}
 			userData->supressAdjacentWhitespace = false;
 		}




More information about the sword-cvs mailing list