[sword-svn] r3257 - in trunk: include src/modules/filters
scribe at crosswire.org
scribe at crosswire.org
Mon Sep 22 18:08:24 MST 2014
Author: scribe
Date: 2014-09-22 18:08:24 -0700 (Mon, 22 Sep 2014)
New Revision: 3257
Modified:
trunk/include/osiswebif.h
trunk/include/osisxhtml.h
trunk/src/modules/filters/osiswebif.cpp
trunk/src/modules/filters/osisxhtml.cpp
Log:
added ability for osisxhtml subclasses to specify how they want to markup intermodule links
added webif markup for intermodule links
Modified: trunk/include/osiswebif.h
===================================================================
--- trunk/include/osiswebif.h 2014-09-15 20:03:26 UTC (rev 3256)
+++ trunk/include/osiswebif.h 2014-09-23 01:08:24 UTC (rev 3257)
@@ -35,6 +35,7 @@
bool javascript;
protected:
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key);
virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
public:
OSISWEBIF();
Modified: trunk/include/osisxhtml.h
===================================================================
--- trunk/include/osisxhtml.h 2014-09-15 20:03:26 UTC (rev 3256)
+++ trunk/include/osisxhtml.h 2014-09-23 01:08:24 UTC (rev 3257)
@@ -36,11 +36,11 @@
protected:
class TagStack;
- // used by derived classes so we have it in the header
virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key);
virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ // used by derived classes so we have it in the header
class MyUserData : public BasicFilterUserData {
public:
bool osisQToTick;
@@ -49,6 +49,8 @@
int suspendLevel;
SWBuf wordsOfChristStart;
SWBuf wordsOfChristEnd;
+ SWBuf interModuleLinkStart;
+ SWBuf interModuleLinkEnd;
TagStack *quoteStack;
TagStack *hiStack;
TagStack *titleStack;
Modified: trunk/src/modules/filters/osiswebif.cpp
===================================================================
--- trunk/src/modules/filters/osiswebif.cpp 2014-09-15 20:03:26 UTC (rev 3256)
+++ trunk/src/modules/filters/osiswebif.cpp 2014-09-23 01:08:24 UTC (rev 3257)
@@ -37,6 +37,13 @@
}
+BasicFilterUserData *OSISWEBIF::createUserData(const SWModule *module, const SWKey *key) {
+ MyUserData *u = (MyUserData *)OSISXHTML::createUserData(module, key);
+ u->interModuleLinkStart = "<a href=\"#\" onclick=\"return im('%s', '%s');\">";
+ u->interModuleLinkEnd = "</a>";
+ return u;
+}
+
bool OSISWEBIF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
MyUserData *u = (MyUserData *)userData;
SWBuf scratch;
Modified: trunk/src/modules/filters/osisxhtml.cpp
===================================================================
--- trunk/src/modules/filters/osisxhtml.cpp 2014-09-15 20:03:26 UTC (rev 3256)
+++ trunk/src/modules/filters/osisxhtml.cpp 2014-09-23 01:08:24 UTC (rev 3257)
@@ -161,6 +161,8 @@
suspendLevel = 0;
wordsOfChristStart = "<span class=\"wordsOfJesus\"> ";
wordsOfChristEnd = "</span> ";
+ interModuleLinkStart = "<a href=\"sword://%s/%s\">";
+ interModuleLinkEnd = "</a>";
if (module) {
osisQToTick = ((!module->getConfigEntry("OSISqToTick")) || (strcmp(module->getConfigEntry("OSISqToTick"), "false")));
version = module->getName();
@@ -379,14 +381,14 @@
else
{
// Dictionary link, or something
- buf.appendFormatted("<a href=\"sword://%s/%s\">",
+ buf.appendFormatted(u->interModuleLinkStart,
URL::encode(work.c_str()).c_str(),
URL::encode(ref.c_str()).c_str()
);
}
}
else {
- outText("</a>", buf, u);
+ outText(u->interModuleLinkEnd, buf, u);
}
}
}
More information about the sword-cvs
mailing list