This function is called for every token encountered in the input text.
171 MyUserData *u = (MyUserData *)userData;
174 if ((!tag.isEndTag()) && (!tag.isEmpty()))
177 if (tag.getName() && !strcmp(tag.getName(),
"sync")) {
178 SWBuf value = tag.getAttribute(
"value");
179 if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"morph")) {
181 buf.
appendFormatted(
"<small><em class=\"morph\">(<a href=\"passagestudy.jsp?action=showMorph&type=Greek&value=%s\" class=\"morph\">%s</a>)</em></small>",
185 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"lemma")) {
188 buf.
appendFormatted(
"<small><em class=\"strongs\"><<a href=\"passagestudy.jsp?action=showStrongs&type=&value=%s\" class=\"strongs\">%s</a>></em></small>",
192 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Strongs")) {
195 buf.
appendFormatted(
"<small><em class=\"strongs\"><<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\" class=\"strongs\">",
196 ((ch ==
'H') ?
"Hebrew" :
"Greek"),
199 buf +=
"</a>></em></small>";
201 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Dict")) {
202 buf += (tag.isEndTag() ?
"</b>" :
"<b>");
207 else if (!strcmp(tag.getName(),
"note")) {
208 if (!tag.isEndTag()) {
209 if (!tag.isEmpty()) {
210 SWBuf type = tag.getAttribute(
"type");
211 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
212 SWBuf noteName = tag.getAttribute(
"n");
215 char ch = ((tag.getAttribute(
"type") && ((!strcmp(tag.getAttribute(
"type"),
"crossReference")) || (!strcmp(tag.getAttribute(
"type"),
"x-cross-ref")))) ?
'x':
'n');
216 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>",
226 char ch = ((tag.getAttribute(
"type") && ((!strcmp(tag.getAttribute(
"type"),
"crossReference")) || (!strcmp(tag.getAttribute(
"type"),
"x-cross-ref")))) ?
'x':
'n');
227 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>",
236 u->suspendTextPassThru =
true;
239 if (tag.isEndTag()) {
240 u->suspendTextPassThru =
false;
243 else if (!strcmp(tag.getName(),
"scripture")) {
244 buf += (tag.isEndTag() ?
"</i>" :
"<i>");
247 else if (!strcmp(tag.getName(),
"scripRef")) {
248 if (!tag.isEndTag()) {
249 if (!tag.isEmpty()) {
250 u->suspendTextPassThru =
true;
253 if (tag.isEndTag()) {
254 if (!u->isBiblicalText) {
255 SWBuf refList = u->startTag.getAttribute(
"passage");
257 refList = u->lastTextNode;
258 SWBuf version = tag.getAttribute(
"version");
260 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">",
262 (version.length()) ?
URL::encode(version.c_str()).c_str() :
"");
263 buf += u->lastTextNode.
c_str();
267 SWBuf footnoteNumber = u->startTag.getAttribute(
"swordFootnote");
268 SWBuf noteName = tag.getAttribute(
"n");
272 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showNote&type=x&value=%s&module=%s&passage=%s\"><small><sup class=\"x\">*x%s</sup></small></a>",
281 u->suspendTextPassThru =
false;
284 else if (tag.getName() && !strcmp(tag.getName(),
"div")) {
285 if (tag.isEndTag() && u->inSecHead) {
286 buf +=
"</i></b><br />";
287 u->inSecHead =
false;
289 else if (tag.getAttribute(
"class")) {
290 if (!
stricmp(tag.getAttribute(
"class"),
"sechead")) {
292 buf +=
"<br /><b><i>";
294 else if (!
stricmp(tag.getAttribute(
"class"),
"title")) {
296 buf +=
"<br /><b><i>";
306 else if (tag.getName() && (!strcmp(tag.getName(),
"img") || !strcmp(tag.getName(),
"image"))) {
307 const char *src = strstr(token,
"src");
312 if (((c = strchr(src+3,
'"')) ==
NULL) ||
313 ((d = strchr( ++c ,
'"')) ==
NULL))
316 SWBuf imagename =
"file:";
323 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><",
327 for (c = token; *c; c++) {
328 if ((*c ==
'/') && (*(c+1) ==
'\0'))
331 for (;((*c) && (*c !=
'"')); c++)
334 if (!*c) { c--;
continue; }
340 if (buf[buf.
length()-2] ==
'/')
347 buf +=
" border=0 /></a>";
SWBuf & appendFormatted(const char *format,...)
unsigned long length() const
virtual const char * getConfigEntry(const char *key) const
bool substituteToken(SWBuf &buf, const char *token)
int stricmp(const char *s1, const char *s2)
const char * c_str() const
static const SWBuf encode(const char *urlText)