summaryrefslogtreecommitdiff
path: root/src/modules/filters/teihtmlhref.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/filters/teihtmlhref.cpp')
-rw-r--r--src/modules/filters/teihtmlhref.cpp56
1 files changed, 51 insertions, 5 deletions
diff --git a/src/modules/filters/teihtmlhref.cpp b/src/modules/filters/teihtmlhref.cpp
index f08f994..443fd9c 100644
--- a/src/modules/filters/teihtmlhref.cpp
+++ b/src/modules/filters/teihtmlhref.cpp
@@ -2,7 +2,7 @@
*
* teihtmlhref.cpp - TEI to HTML with hrefs filter
*
- * $Id: teihtmlhref.cpp 3160 2014-04-17 04:02:17Z greg.hellings $
+ * $Id: teihtmlhref.cpp 3548 2017-12-10 05:11:38Z scribe $
*
* Copyright 2008-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -33,10 +33,10 @@ SWORD_NAMESPACE_START
TEIHTMLHREF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
- BiblicalText = false;
+ isBiblicalText = false;
if (module) {
version = module->getName();
- BiblicalText = (!strcmp(module->getType(), "Biblical Texts"));
+ isBiblicalText = (!strcmp(module->getType(), "Biblical Texts"));
}
}
@@ -132,7 +132,7 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
if (n != "") {
buf += "<br /><b>";
buf += n;
- buf += "</b>";
+ buf += "</b> ";
}
}
}
@@ -221,7 +221,7 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
// Compensate for starting :
ref = the_ref + 1;
- int size = target.size() - ref.size() - 1;
+ int size = (int)(target.size() - ref.size() - 1);
work.setSize(size);
strncpy(work.getRawData(), target, size);
}
@@ -275,6 +275,52 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
u->suspendTextPassThru = false;
}
}
+ // <graphic> image tag
+ else if (!strcmp(tag.getName(), "graphic")) {
+ const char *url = tag.getAttribute("url");
+ if (url) { // assert we have a url attribute
+ SWBuf filepath;
+ if (userData->module) {
+ filepath = userData->module->getConfigEntry("AbsoluteDataPath");
+ if ((filepath.size()) && (filepath[filepath.size()-1] != '/') && (url[0] != '/'))
+ filepath += '/';
+ }
+ filepath += url;
+ // images become clickable, if the UI supports showImage.
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><img src=\"file:%s\" border=\"0\" /></a>",
+ URL::encode(filepath.c_str()).c_str(),
+ URL::encode(u->version.c_str()).c_str(),
+ filepath.c_str());
+ u->suspendTextPassThru = true;
+ }
+ }
+ // <table> <row> <cell>
+ else if (!strcmp(tag.getName(), "table")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ buf += "<table><tbody>\n";
+ }
+ else if (tag.isEndTag()) {
+ buf += "</tbody></table>\n";
+ u->supressAdjacentWhitespace = true;
+ }
+
+ }
+ else if (!strcmp(tag.getName(), "row")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ buf += "\t<tr>";
+ }
+ else if (tag.isEndTag()) {
+ buf += "</tr>\n";
+ }
+ }
+ else if (!strcmp(tag.getName(), "cell")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ buf += "<td>";
+ }
+ else if (tag.isEndTag()) {
+ buf += "</td>";
+ }
+ }
else {
return false; // we still didn't handle token