summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/common/lzsscomprs.cpp4
-rw-r--r--src/modules/filters/gbfhtmlhref.cpp22
-rw-r--r--src/modules/filters/osishtmlhref.cpp64
-rw-r--r--src/modules/filters/teihtmlhref.cpp13
-rw-r--r--src/modules/filters/thmlhtmlhref.cpp14
-rw-r--r--src/modules/filters/utf8utf16.cpp1
-rw-r--r--src/modules/lexdict/zld/zld.cpp2
7 files changed, 69 insertions, 51 deletions
diff --git a/src/modules/common/lzsscomprs.cpp b/src/modules/common/lzsscomprs.cpp
index 00177db..624942d 100644
--- a/src/modules/common/lzsscomprs.cpp
+++ b/src/modules/common/lzsscomprs.cpp
@@ -618,9 +618,9 @@ void LZSSCompress::Decode(void)
break;
if (SendChars((char *) c, 1) != 1) {
- totalLen++;
break;
}
+ totalLen++;
// Add to buffer, and increment to next spot. Wrap at end.
@@ -673,9 +673,9 @@ void LZSSCompress::Decode(void)
// Add the "len" :characters to the output stream.
if (SendChars((char *) c, len) != (unsigned int)len) {
- totalLen += len;
break;
}
+ totalLen += len;
}
}
slen = totalLen;
diff --git a/src/modules/filters/gbfhtmlhref.cpp b/src/modules/filters/gbfhtmlhref.cpp
index b4cdde0..3f25e3a 100644
--- a/src/modules/filters/gbfhtmlhref.cpp
+++ b/src/modules/filters/gbfhtmlhref.cpp
@@ -155,11 +155,11 @@ bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
// else
if (!strncmp(token, "WG", 2)) { // strong's numbers
//buf += " <small><em>&lt;<a href=\"type=Strongs value=";
- buf += " <small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=Greek&value=";
+ buf += " <small><em class=\"strongs\">&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=Greek&value=";
for (tok = token+2; *tok; tok++)
//if(token[i] != '\"')
buf += *tok;
- buf += "\">";
+ buf += "\" class=\"strongs\">";
for (tok = token + 2; *tok; tok++)
//if(token[i] != '\"')
buf += *tok;
@@ -167,11 +167,11 @@ bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
}
else if (!strncmp(token, "WH", 2)) { // strong's numbers
//buf += " <small><em>&lt;<a href=\"type=Strongs value=";
- buf += " <small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=Hebrew&value=";
+ buf += " <small><em class=\"strongs\">&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=Hebrew&value=";
for (tok = token+2; *tok; tok++)
//if(token[i] != '\"')
buf += *tok;
- buf += "\">";
+ buf += "\" class=\"strongs\">";
for (tok = token + 2; *tok; tok++)
//if(token[i] != '\"')
buf += *tok;
@@ -179,11 +179,11 @@ bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
}
else if (!strncmp(token, "WTG", 3)) { // strong's numbers tense
//buf += " <small><em>(<a href=\"type=Strongs value=";
- buf += " <small><em>(<a href=\"passagestudy.jsp?action=showStrongs&type=Greek&value=";
+ buf += " <small><em class=\"strongs\">(<a href=\"passagestudy.jsp?action=showStrongs&type=Greek&value=";
for (tok = token + 3; *tok; tok++)
if(*tok != '\"')
buf += *tok;
- buf += "\">";
+ buf += "\" class=\"strongs\">";
for (tok = token + 3; *tok; tok++)
if(*tok != '\"')
buf += *tok;
@@ -191,11 +191,11 @@ bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
}
else if (!strncmp(token, "WTH", 3)) { // strong's numbers tense
//buf += " <small><em>(<a href=\"type=Strongs value=";
- buf += " <small><em>(<a href=\"passagestudy.jsp?action=showStrongs&type=Hebrew&value=";
+ buf += " <small><em class=\"strongs\">(<a href=\"passagestudy.jsp?action=showStrongs&type=Hebrew&value=";
for (tok = token + 3; *tok; tok++)
if(*tok != '\"')
buf += *tok;
- buf += "\">";
+ buf += "\" class=\"strongs\">";
for (tok = token + 3; *tok; tok++)
if(*tok != '\"')
buf += *tok;
@@ -204,12 +204,12 @@ bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags
//buf += " <small><em>(<a href=\"type=morph class=none value=";
- buf += " <small><em>(<a href=\"passagestudy.jsp?action=showMorph&type=Greek&value=";
+ buf += " <small><em class=\"morph\">(<a href=\"passagestudy.jsp?action=showMorph&type=Greek&value=";
for (tok = token + 2; *tok; tok++)
if(*tok != '\"')
buf += *tok;
- buf += "\">";
+ buf += "\" class=\"morph\">";
for (tok = token + 2; *tok; tok++)
if(*tok != '\"')
buf += *tok;
@@ -240,7 +240,7 @@ bool GBFHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
if (vkey) {
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
//char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup>*n</sup></small></a> ",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup class=\"n\">*n</sup></small></a> ",
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(vkey->getText()).c_str());
diff --git a/src/modules/filters/osishtmlhref.cpp b/src/modules/filters/osishtmlhref.cpp
index bdabd83..3406e1b 100644
--- a/src/modules/filters/osishtmlhref.cpp
+++ b/src/modules/filters/osishtmlhref.cpp
@@ -34,14 +34,21 @@
SWORD_NAMESPACE_START
-class OSISHTMLHREF::QuoteStack : public std::stack<char *> {
+namespace {
+ typedef std::stack<SWBuf> TagStack;
+}
+
+// TODO: this bridge pattern is to preserve binary compat on 1.6.x
+class OSISHTMLHREF::TagStacks {
+public:
+ TagStack quoteStack;
+ TagStack hiStack;
};
OSISHTMLHREF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
- inBold = false;
inXRefNote = false;
suspendLevel = 0;
- quoteStack = new QuoteStack();
+ tagStacks = new TagStacks();
wordsOfChristStart = "<font color=\"red\"> ";
wordsOfChristEnd = "</font> ";
if (module) {
@@ -56,13 +63,7 @@ OSISHTMLHREF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) :
}
OSISHTMLHREF::MyUserData::~MyUserData() {
- // Just in case the quotes are not well formed
- while (!quoteStack->empty()) {
- char *tagData = quoteStack->top();
- quoteStack->pop();
- delete [] tagData;
- }
- delete quoteStack;
+ delete tagStacks;
}
OSISHTMLHREF::OSISHTMLHREF() {
@@ -117,7 +118,7 @@ void processLemma(bool suspendTextPassThru, XMLTag &tag, SWBuf &buf) {
// show = false;
//else {
if (!suspendTextPassThru) {
- buf.appendFormatted("<small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\">%s</a>&gt;</em></small>",
+ buf.appendFormatted("<small><em class=\"strongs\">&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\" class=\"strongs\">%s</a>&gt;</em></small>",
(gh.length()) ? gh.c_str() : "",
URL::encode(val2).c_str(),
val2);
@@ -147,7 +148,7 @@ void processMorph(bool suspendTextPassThru, XMLTag &tag, SWBuf &buf) {
if ((*val == 'T') && (strchr("GH", val[1])) && (isdigit(val[2])))
val2+=2;
if (!suspendTextPassThru) {
- buf.appendFormatted("<small><em>(<a href=\"passagestudy.jsp?action=showMorph&type=%s&value=%s\">%s</a>)</em></small>",
+ buf.appendFormatted("<small><em class=\"morph\">(<a href=\"passagestudy.jsp?action=showMorph&type=%s&value=%s\" class=\"morph\">%s</a>)</em></small>",
URL::encode(tag.getAttribute("morph")).c_str(),
URL::encode(val).c_str(),
val2);
@@ -252,19 +253,21 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
SWCATCH ( ... ) { }
if (vkey) {
//printf("URL = %s\n",URL::encode(vkey->getText()).c_str());
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup>*%c</sup></small></a>",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c</sup></small></a>",
ch,
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(vkey->getText()).c_str(),
+ ch,
ch);
}
else {
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup>*%c</sup></small></a>",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c</sup></small></a>",
ch,
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(u->key->getText()).c_str(),
+ ch,
ch);
}
}
@@ -386,12 +389,15 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
// <milestone type="x-p"/>
// <milestone type="cQuote" marker="x"/>
else if ((!strcmp(tag.getName(), "milestone")) && (tag.getAttribute("type"))) {
- if(!strcmp(tag.getAttribute("type"), "line")) {
+ if (!strcmp(tag.getAttribute("type"), "line")) {
outText("<br />", buf, u);
+ if (tag.getAttribute("subType") && !strcmp(tag.getAttribute("subType"), "x-PM")) {
+ outText("<br />", buf, u);
+ }
userData->supressAdjacentWhitespace = true;
}
- else if(!strcmp(tag.getAttribute("type"),"x-p")) {
- if( tag.getAttribute("marker"))
+ else if (!strcmp(tag.getAttribute("type"),"x-p")) {
+ if (tag.getAttribute("marker"))
outText(tag.getAttribute("marker"), buf, u);
else outText("<!p>", buf, u);
}
@@ -482,17 +488,21 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
if (type == "bold" || type == "b" || type == "x-b") {
outText("<b>", buf, u);
- u->inBold = true;
}
else { // all other types
outText("<i>", buf, u);
- u->inBold = false;
}
+ u->tagStacks->hiStack.push(tag.toString());
}
else if (tag.isEndTag()) {
- if(u->inBold) {
+ SWBuf type = "";
+ if (!u->tagStacks->hiStack.empty()) {
+ XMLTag tag(u->tagStacks->hiStack.top());
+ u->tagStacks->hiStack.pop();
+ type = tag.getAttribute("type");
+ }
+ if (type == "bold" || type == "b" || type == "x-b") {
outText("</b>", buf, u);
- u->inBold = false;
}
else outText("</i>", buf, u);
}
@@ -519,9 +529,7 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if ((!tag.isEmpty() && !tag.isEndTag()) || (tag.isEmpty() && tag.getAttribute("sID"))) {
// if <q> then remember it for the </q>
if (!tag.isEmpty()) {
- char *tagData = 0;
- stdstr(&tagData, tag.toString());
- u->quoteStack->push(tagData);
+ u->tagStacks->quoteStack.push(tag.toString());
}
// Do this first so quote marks are included as WoC
@@ -538,11 +546,9 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
// close </q> or <q eID... />
else if ((tag.isEndTag()) || (tag.isEmpty() && tag.getAttribute("eID"))) {
// if it is </q> then pop the stack for the attributes
- if (tag.isEndTag() && !u->quoteStack->empty()) {
- char *tagData = u->quoteStack->top();
- u->quoteStack->pop();
- XMLTag qTag(tagData);
- delete [] tagData;
+ if (tag.isEndTag() && !u->tagStacks->quoteStack.empty()) {
+ XMLTag qTag(u->tagStacks->quoteStack.top());
+ u->tagStacks->quoteStack.pop();
type = qTag.getAttribute("type");
who = qTag.getAttribute("who");
diff --git a/src/modules/filters/teihtmlhref.cpp b/src/modules/filters/teihtmlhref.cpp
index 7e27667..47bb7b9 100644
--- a/src/modules/filters/teihtmlhref.cpp
+++ b/src/modules/filters/teihtmlhref.cpp
@@ -55,7 +55,7 @@ TEIHTMLHREF::TEIHTMLHREF() {
addAllowedEscapeString("amp");
addAllowedEscapeString("lt");
addAllowedEscapeString("gt");
-
+
setTokenCaseSensitive(true);
}
@@ -87,6 +87,8 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
u->lastHi = rend;
if (rend == "ital")
buf += "<i>";
+ else if (rend == "italic")
+ buf += "<i>";
else if (rend == "bold")
buf += "<b>";
else if (rend == "sup")
@@ -97,6 +99,8 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
SWBuf rend = u->lastHi;
if (rend == "ital")
buf += "</i>";
+ else if (rend == "italic")
+ buf += "</i>";
else if (rend == "bold")
buf += "</b>";
else if (rend == "sup")
@@ -138,6 +142,11 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
}
}
+ // <lb.../>
+ else if (!strcmp(tag.getName(), "lb")) {
+ buf += "<br />";
+ }
+
// <pos>, <gen>, <case>, <gram>, <number>, <mood>, <pron>, <def>
else if (!strcmp(tag.getName(), "pos") ||
!strcmp(tag.getName(), "gen") ||
@@ -251,7 +260,7 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
if (tag.isEndTag()) {
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup>*n</sup></small></a>",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup class=\"n\">*n</sup></small></a>",
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(u->key->getText()).c_str());
diff --git a/src/modules/filters/thmlhtmlhref.cpp b/src/modules/filters/thmlhtmlhref.cpp
index 83f5a80..c0887f1 100644
--- a/src/modules/filters/thmlhtmlhref.cpp
+++ b/src/modules/filters/thmlhtmlhref.cpp
@@ -175,21 +175,21 @@ bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
SWBuf value = tag.getAttribute("value");
if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "morph")) { //&gt;
if(value.length())
- buf.appendFormatted("<small><em>(<a href=\"passagestudy.jsp?action=showMorph&type=Greek&value=%s\">%s</a>)</em></small>",
+ buf.appendFormatted("<small><em class=\"morph\">(<a href=\"passagestudy.jsp?action=showMorph&type=Greek&value=%s\" class=\"morph\">%s</a>)</em></small>",
URL::encode(value.c_str()).c_str(),
value.c_str());
}
else if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "lemma")) { //&gt;
if(value.length())
// empty "type=" is deliberate.
- buf.appendFormatted("<small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=&value=%s\">%s</a>&gt;</em></small>",
+ buf.appendFormatted("<small><em class=\"strongs\">&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=&value=%s\" class=\"strongs\">%s</a>&gt;</em></small>",
URL::encode(value.c_str()).c_str(),
value.c_str());
}
else if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "Strongs")) {
char ch = *value;
value<<1;
- buf.appendFormatted("<small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\">",
+ buf.appendFormatted("<small><em class=\"strongs\">&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\" class=\"strongs\">",
((ch == 'H') ? "Hebrew" : "Greek"),
URL::encode(value.c_str()).c_str());
buf += (value.length()) ? value.c_str() : "";
@@ -215,20 +215,22 @@ bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if (vkey) {
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup>*%c</sup></small></a>",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c</sup></small></a>",
ch,
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(vkey->getText()).c_str(),
+ ch,
ch);
}
else {
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup>*%c</sup></small></a>",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c</sup></small></a>",
ch,
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(u->key->getText()).c_str(),
+ ch,
ch);
}
u->suspendTextPassThru = true;
@@ -272,7 +274,7 @@ bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if (vkey) {
// leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
//buf.appendFormatted("<a href=\"noteID=%s.x.%s\"><small><sup>*x</sup></small></a> ", vkey->getText(), footnoteNumber.c_str());
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=x&value=%s&module=%s&passage=%s\"><small><sup>*x</sup></small></a>",
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=x&value=%s&module=%s&passage=%s\"><small><sup class=\"x\">*x</sup></small></a>",
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(vkey->getText()).c_str());
diff --git a/src/modules/filters/utf8utf16.cpp b/src/modules/filters/utf8utf16.cpp
index a770d5f..e5b96d7 100644
--- a/src/modules/filters/utf8utf16.cpp
+++ b/src/modules/filters/utf8utf16.cpp
@@ -63,6 +63,7 @@ char UTF8UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *modul
}
text.setSize(text.size()+2);
*((__u16 *)(text.getRawData()+(text.size()-2))) = (__u16)0;
+ text.setSize(text.size()-2);
return 0;
diff --git a/src/modules/lexdict/zld/zld.cpp b/src/modules/lexdict/zld/zld.cpp
index 4e786bc..2c46657 100644
--- a/src/modules/lexdict/zld/zld.cpp
+++ b/src/modules/lexdict/zld/zld.cpp
@@ -48,7 +48,7 @@ zLD::zLD(const char *ipath, const char *iname, const char *idesc, long blockCoun
*/
zLD::~zLD() {
-
+ flushCache();
}