[sword-cvs] sword/src/modules/filters thmlfootnotes.cpp,1.7,1.8 thmlhtml.cpp,1.24,1.25 thmlhtmlhref.cpp,1.27,1.28 thmlmorph.cpp,1.7,1.8 thmlscripref.cpp,1.7,1.8 thmlwebif.cpp,1.1,1.2
sword@www.crosswire.org
sword@www.crosswire.org
Fri, 6 Jun 2003 11:25:58 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv10529/src/modules/filters
Modified Files:
thmlfootnotes.cpp thmlhtml.cpp thmlhtmlhref.cpp thmlmorph.cpp
thmlscripref.cpp thmlwebif.cpp
Log Message:
filter fixes, encodeURL fixes
Index: thmlfootnotes.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlfootnotes.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** thmlfootnotes.cpp 7 Mar 2003 14:48:18 -0000 1.7
--- thmlfootnotes.cpp 6 Jun 2003 18:25:56 -0000 1.8
***************
*** 70,76 ****
// if not a footnote token, keep token in text
if (!hide) {
! text += '<';
! text.append(token);
! text += '>';
}
continue;
--- 70,74 ----
// if not a footnote token, keep token in text
if (!hide) {
! text += '<' + token + '>';
}
continue;
Index: thmlhtml.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlhtml.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** thmlhtml.cpp 21 Feb 2003 03:29:01 -0000 1.24
--- thmlhtml.cpp 6 Jun 2003 18:25:56 -0000 1.25
***************
*** 19,22 ****
--- 19,23 ----
#include <thmlhtml.h>
#include <swmodule.h>
+ #include <utilxml.h>
SWORD_NAMESPACE_START
***************
*** 130,134 ****
setTokenCaseSensitive(true);
- addTokenSubstitute("/scripRef", " </a>");
addTokenSubstitute("note", " <font color=\"#800000\"><small>(");
addTokenSubstitute("/note", ")</small></font> ");
--- 131,134 ----
***************
*** 137,178 ****
bool ThMLHTML::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
! if (!substituteToken(buf, token)) {
! // manually process if it wasn't a simple substitution
! if (!strncmp(token, "sync type=\"Strongs\" value=\"", 27)) {
! if (token[27] == 'H' || token[27] == 'G' || token[27] == 'A') {
! buf += "<small><em>";
! for (const char *tok = token + 5; *tok; tok++)
! if(*tok != '\"')
! buf += *tok;
! buf += "</em></small>";
! }
! else if (token[27] == 'T') {
! buf += "<small><i>";
! for (unsigned int i = 29; token[i] != '\"'; i++)
! buf += token[i];
! buf += "</i></small>";
! }
! }
! else if (!strncmp(token, "sync type=\"morph\" value=\"", 25)) {
! buf += "<small><em>";
! for (unsigned int i = 25; token[i] != '\"'; i++)
! buf += token[i];
! buf += "</em></small>";
! }
! else if (!strncmp(token, "sync type=\"lemma\" value=\"", 25)) {
! buf += "<small><em>(";
! for (unsigned int i = 25; token[i] != '\"'; i++)
! buf += token[i];
! buf += ")</em></small>";
}
! else if (!strncmp(token, "scripRef", 8)) {
! buf += "<a href=\"";
! for (const char *tok = token + 9; *tok; tok++)
! if(*tok != '\"')
! buf += *tok;
! buf += '\"';
! buf += '>';
}
! else if (!strncmp(token, "img ", 4)) {
const char *src = strstr(token, "src");
if (!src) // assert we have a src attribute
--- 137,187 ----
bool ThMLHTML::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
! if (!substituteToken(buf, token)) { // manually process if it wasn't a simple substitution
! XMLTag tag(token);
! if (!strcmp(tag.getName(), "sync")) {
! if (tag.getAttribute("type") && tag.getAttribute("value") && !strcmp(tag.getAttribute("type"), "Strongs")) {
! const char* value = tag.getAttribute("value");
! if (*value == 'H' || *value == 'G' || *value == 'A') {
! value++;
! buf += "<small><em>";
! buf += value;
! buf += "</em></small>";
! }
! else if (*value == 'T') {
! value += 2;
!
! buf += "<small><i>";
! buf += value;
! buf += "</i></small>";
! }
! }
! else if (tag.getAttribute("type") && tag.getAttribute("value") && !strcmp(tag.getAttribute("type"), "morph")) {
! buf += "<small><em>";
! buf += tag.getAttribute("value");
! buf += "</em></small>";
! }
! else if (tag.getAttribute("type") && tag.getAttribute("value") && !strcmp(tag.getAttribute("type"), "lemma")) {
! buf += "<small><em>(";
! buf += tag.getAttribute("value");
! buf += ")</em></small>";
! }
}
! else if (!strcmp(tag.getName(), "div")) {
! if (tag.isEndTag() && (userData["SecHead"] == "true")) {
! buf += "</i></b><br />";
! userData["SecHead"] = "false";
! }
! else if (tag.getAttribute("class")) {
! if (!strcasecmp(tag.getAttribute("class"), "sechead")) {
! userData["SecHead"] = "true";
! buf += "<br /><b><i>";
! }
! else if (!strcasecmp(tag.getAttribute("class"), "title")) {
! userData["SecHead"] = "true";
! buf += "<br /><b><i>";
! }
! }
}
! else if (!strcmp(tag.getName(), "img")) {
const char *src = strstr(token, "src");
if (!src) // assert we have a src attribute
***************
*** 200,209 ****
buf += '>';
}
! else if(!strncmp(token, "note", 4)) {
! buf += " <font color=\"#800000\"><small>(";
! }
else {
! return false; // we still didn't handle token
}
}
--- 209,221 ----
buf += '>';
}
! else if (!strcmp(tag.getName(), "scripRef")) { //do nothing with scrip refs, we leave them out
+ }
else {
! buf += '<';
! buf += token;
! buf += '>';
!
! // return false; // we still didn't handle token
}
}
Index: thmlhtmlhref.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlhtmlhref.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** thmlhtmlhref.cpp 13 Mar 2003 15:35:03 -0000 1.27
--- thmlhtmlhref.cpp 6 Jun 2003 18:25:56 -0000 1.28
***************
*** 19,22 ****
--- 19,23 ----
#include <thmlhtmlhref.h>
#include <swmodule.h>
+ #include <utilxml.h>
SWORD_NAMESPACE_START
***************
*** 138,148 ****
bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
const char *tok;
! if (!substituteToken(buf, token)) {
! // manually process if it wasn't a simple substitution
! if (!strncmp(token, "sync ", 5)) {
if(strstr(token,"type=\"morph\"")){
buf += "<small><em> (<a href=\"";
}
! else
buf += "<small><em> <<a href=\"";
for (tok = token + 5; *(tok+1); tok++)
--- 139,149 ----
bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
const char *tok;
! if (!substituteToken(buf, token)) { // manually process if it wasn't a simple substitution
! XMLTag tag(token);
! if (!strcmp(tag.getName(), "sync")) {
if(strstr(token,"type=\"morph\"")){
buf += "<small><em> (<a href=\"";
}
! else
buf += "<small><em> <<a href=\"";
for (tok = token + 5; *(tok+1); tok++)
***************
*** 163,233 ****
}
}
! if(strstr(token,"type=\"morph\""))
buf += "</a>) </em></small>";
! else
buf += "</a>> </em></small>";
}
!
! else if (!strncmp(token, "scripture ", 10)) {
userData["inscriptRef"] = "true";
buf += "<i>";
- }
-
- else if (!strncmp(token, "scripRef p", 10) || !strncmp(token, "scripRef v", 10)) {
- userData["inscriptRef"] = "true";
- buf += "<a href=\"";
- for (const char *tok = token + 9; *(tok+1); tok++)
- if(*tok != '\"')
- buf += *tok;
- buf += '\"';
- buf += '>';
- }
-
- // we're starting a scripRef like "<scripRef>John 3:16</scripRef>"
- else if (!strcmp(token, "scripRef")) {
- userData["inscriptRef"] = "false";
- // let's stop text from going to output
- userData["suspendTextPassThru"] = "true";
}
! // we've ended a scripRef
! else if (!strcmp(token, "/scripRef")) {
! if (userData["inscriptRef"] == "true") { // like "<scripRef passage="John 3:16">John 3:16</scripRef>"
! userData["inscriptRef"] = "false";
! buf +="</a>";
}
!
! else { // like "<scripRef>John 3:16</scripRef>"
! buf += "<a href=\"passage=";
! //char *strbuf = (char *)userData["lastTextNode"].c_str();
! buf += userData["lastTextNode"].c_str();
buf += "\">";
! //buf += '>';
! buf += userData["lastTextNode"].c_str();
! // let's let text resume to output again
! userData["suspendTextPassThru"] = "false";
! buf += "</a>";
}
}
!
! else if (!strncmp(token, "div class=\"sechead\"", 19)) {
! userData["SecHead"] = "true";
! buf += "<br /><b><i>";
! }
! else if (!strncmp(token, "div class=\"title\"", 19)) {
! userData["SecHead"] = "true";
! buf += "<br /><b><i>";
! }
! else if (!strncmp(token, "/div", 4)) {
! if (userData["SecHead"] == "true") {
! buf += "</i></b><br />";
userData["SecHead"] = "false";
}
}
! /*
! else if (!strncmp(token, "sync type=\"Strongs\" value=\"T", 28)) {
buf +="<a href=\"");
! for (tok = token + 5; *(tok+1); tok++)
! if(*tok != '\"')
*(*buf)++ = *tok;
*(*buf)++ = '\"';
--- 164,236 ----
}
}
!
! if(strstr(token,"type=\"morph\""))
buf += "</a>) </em></small>";
! else
buf += "</a>> </em></small>";
}
! else if (!strcmp(tag.getName(), "scripture")) {
userData["inscriptRef"] = "true";
buf += "<i>";
}
+ else if (!strcmp(tag.getName(), "scripRef")) {
+ if (tag.isEndTag()) {
+ if (userData["inscriptRef"] == "true") { // like "<scripRef passage="John 3:16">John 3:16</scripRef>"
+ userData["inscriptRef"] = "false";
+ buf += "</a>";
+ }
+ else { // end of scripRef like "<scripRef>John 3:16</scripRef>"
+ buf += "<a href=\"passage=";
+ buf += userData["lastTextNode"].c_str();
+ buf += "\">";
! buf += userData["lastTextNode"].c_str();
! buf += "</a>";
!
! // let's let text resume to output again
! userData["suspendTextPassThru"] = "false";
! }
}
! else if (tag.getAttribute("passage")) { //passage given
! userData["inscriptRef"] = "true";
!
! buf += "<a href=\"";
! if (const char* version = tag.getAttribute("version")) {
! buf += "version=";
! buf += version;
! buf += " ";
! }
! if (const char* passage = tag.getAttribute("passage")) {
! buf += "passage=";
! buf += passage;
! }
buf += "\">";
! }
! else { //no passage or version given
! userData["inscriptRef"] = "false";
! // let's stop text from going to output
! userData["suspendTextPassThru"] = "true";
}
}
! else if (!strcmp(tag.getName(), "div")) {
! if (tag.isEndTag() && userData["SecHead"] == "true") {
! buf += "</i></b><br />";
userData["SecHead"] = "false";
}
+ else if (tag.getAttribute("class")) {
+ if (!strcasecmp(tag.getAttribute("class"), "sechead")) {
+ userData["SecHead"] = "true";
+ buf += "<br /><b><i>";
+ }
+ else if (!strcasecmp(tag.getAttribute("class"), "title")) {
+ userData["SecHead"] = "true";
+ buf += "<br /><b><i>";
+ }
+ }
}
! /* else if (!strncmp(token, "sync type=\"Strongs\" value=\"T", 28)) {
buf +="<a href=\"");
! for (tok = token + 5; *(tok+1); tok++)
! if(*tok != '\"')
*(*buf)++ = *tok;
*(*buf)++ = '\"';
***************
*** 239,243 ****
}
*/
! else if (!strncmp(token, "img ", 4)) {
const char *src = strstr(token, "src");
if (!src) // assert we have a src attribute
--- 242,246 ----
}
*/
! else if (!strcmp(tag.getName(), "img")) {
const char *src = strstr(token, "src");
if (!src) // assert we have a src attribute
***************
*** 265,271 ****
buf += '>';
}
- else if (!strncmp(token, "note", 4)) {
- buf += " <small><font color=\"#800000\">(";
- }
else {
buf += '<';
--- 268,271 ----
Index: thmlmorph.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlmorph.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** thmlmorph.cpp 7 Mar 2003 14:48:18 -0000 1.7
--- thmlmorph.cpp 6 Jun 2003 18:25:56 -0000 1.8
***************
*** 62,68 ****
}
// if not a morph tag token, keep token in text
! text += '<';
! text.append(token);
! text += '>';
continue;
}
--- 62,66 ----
}
// if not a morph tag token, keep token in text
! text += '<' + token + '>';
continue;
}
Index: thmlscripref.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlscripref.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** thmlscripref.cpp 21 Feb 2003 20:54:29 -0000 1.7
--- thmlscripref.cpp 6 Jun 2003 18:25:56 -0000 1.8
***************
*** 70,76 ****
// if not a scripref token, keep token in text
if (!hide) {
! text += '<';
! text.append(token);
! text += '>';
}
continue;
--- 70,74 ----
// if not a scripref token, keep token in text
if (!hide) {
! text += '<' + token + '>';
}
continue;
Index: thmlwebif.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlwebif.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** thmlwebif.cpp 1 Jun 2003 14:32:09 -0000 1.1
--- thmlwebif.cpp 6 Jun 2003 18:25:56 -0000 1.2
***************
*** 48,52 ****
}
}
! buf.appendFormatted("<a href=\"%s?sync_key=%s\">", passageStudyURL.c_str(), encodeURL(url).c_str() );
//scan for value and add it to the buffer
--- 48,52 ----
}
}
! buf.appendFormatted("<a href=\"%s?key=%s\">", passageStudyURL.c_str(), encodeURL(url).c_str() );
//scan for value and add it to the buffer
***************
*** 77,81 ****
}
! buf.appendFormatted("<a href=\"%s?p_key=%s\">", passageStudyURL.c_str(), encodeURL(url).c_str());
}
--- 77,81 ----
}
! buf.appendFormatted("<a href=\"%s?key=%s\">", passageStudyURL.c_str(), encodeURL(url).c_str());
}