[sword-svn] r3790 - trunk/src/modules/filters

scribe at crosswire.org scribe at crosswire.org
Fri Sep 11 11:26:02 EDT 2020


Author: scribe
Date: 2020-09-11 11:26:02 -0400 (Fri, 11 Sep 2020)
New Revision: 3790

Modified:
   trunk/src/modules/filters/osisstrongs.cpp
   trunk/src/modules/filters/thmlstrongs.cpp
Log:
Consistently always show a .# for lemma and morph, even if there is only 1 entry.  Simplifies client logic so they don't have to test for both, e.g., Lemma.1 and if not exists, then Lemma.


Modified: trunk/src/modules/filters/osisstrongs.cpp
===================================================================
--- trunk/src/modules/filters/osisstrongs.cpp	2020-09-11 15:24:25 UTC (rev 3789)
+++ trunk/src/modules/filters/osisstrongs.cpp	2020-09-11 15:26:02 UTC (rev 3790)
@@ -138,13 +138,11 @@
 							morphClass += mClass;
 							morph += mp;
 							mp.replaceBytes("+", ' ');
-							if (count > 1) {
-								SWBuf tmp;
-								tmp.setFormatted("Morph.%d", i+1);
-								module->getEntryAttributes()["Word"][wordstr][tmp] = mp;
-								tmp.setFormatted("MorphClass.%d", i+1);
-								module->getEntryAttributes()["Word"][wordstr][tmp] = mClass;
-							}
+							SWBuf tmp;
+							tmp.setFormatted("Morph.%d", i+1);
+							module->getEntryAttributes()["Word"][wordstr][tmp] = mp;
+							tmp.setFormatted("MorphClass.%d", i+1);
+							module->getEntryAttributes()["Word"][wordstr][tmp] = mClass;
 						} while (++i < count);
 					}
 
@@ -182,13 +180,11 @@
 							lemma += l;
 							l.replaceBytes("+", ' ');
 							lemmaClass += lClass;
-							if (count > 1) {
-								SWBuf tmp;
-								tmp.setFormatted("Lemma.%d", i+1);
-								module->getEntryAttributes()["Word"][wordstr][tmp] = l;
-								tmp.setFormatted("LemmaClass.%d", i+1);
-								module->getEntryAttributes()["Word"][wordstr][tmp] = lClass;
-							}
+							SWBuf tmp;
+							tmp.setFormatted("Lemma.%d", i+1);
+							module->getEntryAttributes()["Word"][wordstr][tmp] = l;
+							tmp.setFormatted("LemmaClass.%d", i+1);
+							module->getEntryAttributes()["Word"][wordstr][tmp] = lClass;
 						} while (++i < count);
 						module->getEntryAttributes()["Word"][wordstr]["PartCount"].setFormatted("%d", count);
 					}
@@ -205,11 +201,9 @@
 							mp += attrib;
 							src += mp;
 							mp.replaceBytes("+", ' ');
-							if (count > 1) {
-								SWBuf tmp;
-								tmp.setFormatted("Src.%d", i+1);
-								module->getEntryAttributes()["Word"][wordstr][tmp] = mp;
-							}
+							SWBuf tmp;
+							tmp.setFormatted("Src.%d", i+1);
+							module->getEntryAttributes()["Word"][wordstr][tmp] = mp;
 						} while (++i < count);
 					}
 

Modified: trunk/src/modules/filters/thmlstrongs.cpp
===================================================================
--- trunk/src/modules/filters/thmlstrongs.cpp	2020-09-11 15:24:25 UTC (rev 3789)
+++ trunk/src/modules/filters/thmlstrongs.cpp	2020-09-11 15:26:02 UTC (rev 3790)
@@ -94,6 +94,8 @@
 						module->getEntryAttributes()["Word"][wordstr]["PartCount"] = "1";
 						module->getEntryAttributes()["Word"][wordstr]["Lemma"] = val;
 						module->getEntryAttributes()["Word"][wordstr]["LemmaClass"] = "strong";
+						module->getEntryAttributes()["Word"][wordstr]["Lemma.1"] = val;
+						module->getEntryAttributes()["Word"][wordstr]["LemmaClass.1"] = "strong";
 						tmp = "";
 						tmp.append(text.c_str()+textStart, (int)(textEnd - textStart));
 						module->getEntryAttributes()["Word"][wordstr]["Text"] = tmp;
@@ -105,6 +107,8 @@
 						sprintf(wordstr, "%03d", word);
 						module->getEntryAttributes()["Word"][wordstr]["Morph"] = val;
 						module->getEntryAttributes()["Word"][wordstr]["MorphClass"] = "OLBMorph";
+						module->getEntryAttributes()["Word"][wordstr]["Morph.1"] = val;
+						module->getEntryAttributes()["Word"][wordstr]["MorphClass.1"] = "OLBMorph";
 */
 						word--;	// for now, completely ignore this word attribute.
 					}
@@ -133,6 +137,7 @@
 								strcpy(val, "robinson");
 							}
 							module->getEntryAttributes()["Word"][wordstr]["MorphClass"] = val;
+							module->getEntryAttributes()["Word"][wordstr]["MorphClass.1"] = val;
 						}
 						if (!strncmp(ch, "value=\"", 7)) {
 							valto = val;
@@ -141,6 +146,7 @@
 							*valto = 0;
 							sprintf(wordstr, "%03d", word-1);
 							module->getEntryAttributes()["Word"][wordstr]["Morph"] = val;
+							module->getEntryAttributes()["Word"][wordstr]["Morph.1"] = val;
 						}
 					}
 					newText = true;



More information about the sword-cvs mailing list