aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanglassey <danglassey>2002-10-26 13:01:54 +0000
committerdanglassey <danglassey>2002-10-26 13:01:54 +0000
commite330651fbc54920cd6c7d5d3a56527516efa3b82 (patch)
treedbd36463faa386e077e4ca71866adcf70c6b1f69
parent18f4f46bd0bf73109a15d4a888083be356141d65 (diff)
downloadsword-sf-cvs-e330651fbc54920cd6c7d5d3a56527516efa3b82.tar.gz
sync with crosswire 20021026-1300
-rw-r--r--src/modules/filters/gbfosis.cpp3
-rw-r--r--src/modules/filters/thmlosis.cpp18
-rw-r--r--tests/filtertest.cpp8
3 files changed, 22 insertions, 7 deletions
diff --git a/src/modules/filters/gbfosis.cpp b/src/modules/filters/gbfosis.cpp
index ac41e5b..0d9f8f1 100644
--- a/src/modules/filters/gbfosis.cpp
+++ b/src/modules/filters/gbfosis.cpp
@@ -279,7 +279,8 @@ char GBFOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWModu
case '\'':
case '\"':
case '`':
- quoteStack.handleQuote(fromStart, from, &to);
+// quoteStack.handleQuote(fromStart, from, &to);
+ *to++ = *from;
from++;
break;
default:
diff --git a/src/modules/filters/thmlosis.cpp b/src/modules/filters/thmlosis.cpp
index f04b1b9..4035108 100644
--- a/src/modules/filters/thmlosis.cpp
+++ b/src/modules/filters/thmlosis.cpp
@@ -48,6 +48,7 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
std::string tmp;
bool suspendTextPassThru = false;
bool keepToken = false;
+ bool handled = false;
len = strlen(text) + 1; // shift string to right of buffer
if (len < maxlen) {
@@ -77,7 +78,7 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
keepToken = false;
suspendTextPassThru = false;
newWord = true;
-
+ handled = false;
while (wordStart < (text+maxlen)) {
// if (strchr(" ,;.?!()'\"", *wordStart))
@@ -96,12 +97,14 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
// pushString(buf, "<reference osisRef=\"");
suspendTextPassThru = true;
newText = true;
+ handled = true;
}
else if (!strncmp(token, "/scripRef", 9)) {
tmp = "";
tmp.append(textStart, (int)(textEnd - textStart)+1);
pushString(&to, convertToOSIS(tmp.c_str(), key));
suspendTextPassThru = false;
+ handled = true;
}
// Footnote
@@ -109,6 +112,7 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
// pushString(buf, "<reference work=\"Bible.KJV\" reference=\"");
suspendTextPassThru = true;
newText = true;
+ handled = true;
}
else if (!strcmp(token, "/note")) {
tmp = "<note type=\"x-StudyNote\"><notePart type=\"x-MainText\">";
@@ -116,13 +120,15 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
tmp += "</notePart></note>";
pushString(&to, tmp.c_str());
suspendTextPassThru = false;
+ handled = true;
}
// Figure
else if (!strncmp(token, "img ", 4)) {
const char *src = strstr(token, "src");
if (!src) // assert we have a src attribute
- return false;
+ continue;
+// return false;
pushString(&to, "<figure src=\"");
const char *c;
@@ -141,7 +147,7 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
*to++ = *c;
pushString(&to, "\" />");
- return true;
+ handled = true;
}
// Strongs numbers
@@ -170,6 +176,7 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
module->getEntryAttributes()["Word"][wordstr]["Morph"] = val;
}
}
+ handled = true;
}
// Morphology
@@ -209,9 +216,14 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod
to+=strlen(buf);
}
}
+ handled = true;
}
if (!keepToken) { // if we don't want strongs
+ if (!handled) {
+ SWLog::systemlog->LogError("Unprocessed Token: <%s>", token);
+// exit(-1);
+ }
if (strchr(" ,:;.?!()'\"", from[1])) {
if (lastspace)
to--;
diff --git a/tests/filtertest.cpp b/tests/filtertest.cpp
index 0301c49..3d49084 100644
--- a/tests/filtertest.cpp
+++ b/tests/filtertest.cpp
@@ -2,6 +2,7 @@
#include <thmlhtmlhref.h>
#include <thmlosis.h>
#include <gbfosis.h>
+#include <thmlosis.h>
#include <versekey.h>
#include <swmgr.h>
#ifndef NO_SWORD_NAMESPACE
@@ -11,15 +12,16 @@ using namespace sword;
#define MAXBUF 30000
int main(int argc, char **argv) {
SWMgr mgr;
- SWModule *module = mgr.Modules["KJV"];
+ SWModule *module = mgr.Modules["TR"];
if (!module)
module = mgr.Modules.begin()->second;
((VerseKey *)(SWKey *)*module)->AutoNormalize(0);
((VerseKey *)(SWKey *)*module)->Headings(1);
// ThMLHTMLHREF filter;
- GBFOSIS filter;
- module->Key() = ((argc > 1) ? argv[1] : "jas1:1");
+// GBFOSIS filter;
+ ThMLOSIS filter;
+ module->Key() = ((argc > 1) ? argv[1] : "mat4:15");
char *buf = new char [ MAXBUF ];
memset(buf, 0, MAXBUF);
// strcpy(buf, "This is a verse reference: <scripRef>jas1:22,23-25;3;5:1;rom1-9</scripRef> with an <img src=\"/images/yoyo.jpg\">");