This function is called for every token encountered in the input text.
176 MyUserData *u = (MyUserData *)userData;
179 if ((!tag.isEndTag()) && (!tag.isEmpty()))
182 if (tag.getName() && !strcmp(tag.getName(),
"sync")) {
183 SWBuf value = tag.getAttribute(
"value");
184 if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"morph")) {
186 buf.
appendFormatted(
"<small><em class=\"morph\">(<a href=\"passagestudy.jsp?action=showMorph&type=Greek&value=%s\" class=\"morph\">%s</a>)</em></small>",
190 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"lemma")) {
193 buf.
appendFormatted(
"<small><em class=\"strongs\"><<a href=\"passagestudy.jsp?action=showStrongs&type=&value=%s\" class=\"strongs\">%s</a>></em></small>",
197 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Strongs")) {
200 buf.
appendFormatted(
"<small><em class=\"strongs\"><<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\" class=\"strongs\">",
201 ((ch ==
'H') ?
"Hebrew" :
"Greek"),
204 buf +=
"</a>></em></small>";
206 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Dict")) {
207 buf += (tag.isEndTag() ?
"</b>" :
"<b>");
212 else if (!strcmp(tag.getName(),
"note")) {
213 if (!tag.isEndTag()) {
214 SWBuf type = tag.getAttribute(
"type");
217 if (type ==
"x-cross-ref") type =
"crossReference";
219 SWBuf subType = tag.getAttribute(
"subType");
220 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
221 SWBuf noteName = tag.getAttribute(
"n");
222 SWBuf classExtras =
"";
227 if (subType.
size()) {
230 if (!tag.isEmpty()) {
233 char ch = (type ==
"crossReference" ?
'x':
'n');
234 buf.
appendFormatted(
"<a class=\"noteMarker%s\" href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>",
245 char ch = ((tag.getAttribute(
"type") && ((!strcmp(tag.getAttribute(
"type"),
"crossReference")) || (!strcmp(tag.getAttribute(
"type"),
"x-cross-ref")))) ?
'x':
'n');
246 buf.
appendFormatted(
"<a class=\"noteMarker%s\" href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>",
256 u->suspendTextPassThru =
true;
259 if (tag.isEndTag()) {
260 u->suspendTextPassThru =
false;
263 else if (!strcmp(tag.getName(),
"scripture")) {
264 buf += (tag.isEndTag() ?
"</i>" :
"<i>");
267 else if (!strcmp(tag.getName(),
"scripRef")) {
268 if (!tag.isEndTag()) {
269 if (!tag.isEmpty()) {
270 u->suspendTextPassThru =
true;
273 if (tag.isEndTag()) {
274 if (!u->isBiblicalText) {
275 SWBuf refList = u->startTag.getAttribute(
"passage");
277 refList = u->lastTextNode;
278 SWBuf version = tag.getAttribute(
"version");
280 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">",
282 (version.length()) ?
URL::encode(version.c_str()).c_str() :
"");
283 buf += u->lastTextNode.
c_str();
287 SWBuf footnoteNumber = u->startTag.getAttribute(
"swordFootnote");
288 SWBuf noteName = tag.getAttribute(
"n");
292 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>",
301 u->suspendTextPassThru =
false;
304 else if (tag.getName() && !strcmp(tag.getName(),
"div")) {
305 if (tag.isEndTag() && u->secHeadLevel) {
307 buf += u->secHeadLevel;
311 else if (tag.getAttribute(
"class")) {
312 if (!
stricmp(tag.getAttribute(
"class"),
"sechead")) {
313 u->secHeadLevel =
'3';
316 else if (!
stricmp(tag.getAttribute(
"class"),
"title")) {
317 u->secHeadLevel =
'2';
328 else if (tag.getName() && (!strcmp(tag.getName(),
"img") || !strcmp(tag.getName(),
"image"))) {
329 const char *src = strstr(token,
"src");
334 if (((c = strchr(src+3,
'"')) ==
NULL) ||
335 ((d = strchr( ++c ,
'"')) ==
NULL))
338 SWBuf imagename =
"file:";
345 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><",
349 for (c = token; *c; c++) {
350 if ((*c ==
'/') && (*(c+1) ==
'\0'))
353 for (;((*c) && (*c !=
'"')); c++)
356 if (!*c) { c--;
continue; }
362 if (buf[buf.
length()-2] ==
'/')
369 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
SWBuf & append(const char *str, long max=-1)
unsigned long size() const
static const SWBuf encode(const char *urlText)