[sword-svn] r2035 - trunk/src/modules/filters
tbiggs at www.crosswire.org
tbiggs at www.crosswire.org
Thu Mar 22 14:38:31 MST 2007
Author: tbiggs
Date: 2007-03-22 14:38:31 -0700 (Thu, 22 Mar 2007)
New Revision: 2035
Modified:
trunk/src/modules/filters/osishtmlhref.cpp
trunk/src/modules/filters/thmlhtmlhref.cpp
Log:
add href tags around image tags in order to support the ability to click an image
Modified: trunk/src/modules/filters/osishtmlhref.cpp
===================================================================
--- trunk/src/modules/filters/osishtmlhref.cpp 2007-03-21 06:05:39 UTC (rev 2034)
+++ trunk/src/modules/filters/osishtmlhref.cpp 2007-03-22 21:38:31 UTC (rev 2035)
@@ -511,10 +511,19 @@
}
filepath += src;
+ // images become clickable, if the UI supports showImage.
+ outText("<a href=\"passagestudy.jsp?action=showImage&value=", buf, u);
+ outText(URL::encode(filepath.c_str()).c_str(), buf, u);
+ outText("&module=", buf, u);
+ outText(URL::encode(u->version.c_str()).c_str(), buf, u);
+ outText("\">", buf, u);
+
// we do this because BibleCS looks for this EXACT format for an image tag
outText("<image src=\"", buf, u);
outText(filepath, buf, u);
outText("\" />", buf, u);
+
+ outText("</a>", buf, u);
}
else {
Modified: trunk/src/modules/filters/thmlhtmlhref.cpp
===================================================================
--- trunk/src/modules/filters/thmlhtmlhref.cpp 2007-03-21 06:05:39 UTC (rev 2034)
+++ trunk/src/modules/filters/thmlhtmlhref.cpp 2007-03-22 21:38:31 UTC (rev 2035)
@@ -209,7 +209,7 @@
}
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>*%c</sup></small></a>",
ch,
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
@@ -296,8 +296,23 @@
if (!src) // assert we have a src attribute
return false;
- buf += '<';
- for (const char *c = token; *c; c++) {
+ const char *c, *d;
+ if (((c = strchr(src+3, '"')) == NULL) ||
+ ((d = strchr( ++c , '"')) == NULL)) // identify endpoints.
+ return false; // abandon hope.
+
+ SWBuf imagename = "file:";
+ if (*c == '/') // as below, inside for loop.
+ imagename += userData->module->getConfigEntry("AbsoluteDataPath");
+ while (c != d) // move bits into the name.
+ imagename += *(c++);
+
+ // images become clickable, if the UI supports showImage.
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><",
+ URL::encode(imagename.c_str()).c_str(),
+ URL::encode(u->version.c_str()).c_str());
+
+ for (c = token; *c; c++) {
if (c == src) {
for (;((*c) && (*c != '"')); c++)
buf += *c;
@@ -315,7 +330,7 @@
}
buf += *c;
}
- buf += '>';
+ buf += "></a>";
}
else {
buf += '<';
More information about the sword-cvs
mailing list