This function is called for every token encountered in the input text.
62 MyUserData *u = (MyUserData *)userData;
66 if (!strcmp(tag.getName(),
"w")) {
69 if ((!tag.isEmpty()) && (!tag.isEndTag())) {
75 bool endTag = tag.isEndTag();
81 lastText = u->lastTextNode.
c_str();
83 else lastText =
"stuff";
87 if ((attrib = tag.getAttribute(
"xlit"))) {
88 val = strchr(attrib,
':');
89 val = (val) ? (val + 1) : attrib;
92 if ((attrib = tag.getAttribute(
"gloss"))) {
93 val = strchr(attrib,
':');
94 val = (val) ? (val + 1) : attrib;
97 if ((attrib = tag.getAttribute(
"lemma"))) {
98 int count = tag.getAttributePartCount(
"lemma");
99 int i = (count > 1) ? 0 : -1;
101 attrib = tag.getAttribute(
"lemma", i);
103 val = strchr(attrib,
':');
104 val = (val) ? (val + 1) : attrib;
105 const char *val2 = val;
106 if ((strchr(
"GH", *val)) && (isdigit(val[1])))
108 if ((!strcmp(val2,
"3588")) && (lastText.
length() < 1))
111 if (!strchr(
"G", *val)) {
112 buf.
appendFormatted(
" <small><em><<a href=\"!DIATHEKE_URL!StrongsGreek=on&verse=%s\">%s</a>></em></small> ", val2, val);
115 buf.
appendFormatted(
" <small><em><<a href=\"!DIATHEKE_URL!StrongsHebrew=on&verse=%s\">%s</a>></em></small> ", val2, val);
118 }
while (++i < count);
120 if ((attrib = tag.getAttribute(
"morph")) && (show)) {
121 SWBuf savelemma = tag.getAttribute(
"savlm");
122 if ((strstr(savelemma.
c_str(),
"3588")) && (lastText.
length() < 1))
125 int count = tag.getAttributePartCount(
"morph");
126 int i = (count > 1) ? 0 : -1;
128 attrib = tag.getAttribute(
"morph", i);
130 val = strchr(attrib,
':');
131 val = (val) ? (val + 1) : attrib;
132 const char *val2 = val;
133 if ((*val ==
'T') && (strchr(
"GH", val[1])) && (isdigit(val[2])))
135 if (!strchr(
"G", *val)) {
136 buf.
appendFormatted(
" <small><em>(;<a href=\"!DIATHEKE_URL!StrongsGreek=on&verse=%s\">%s</a>)</em></small> ", val+1, tag.getAttribute(
"morph"));
138 else if (!strchr(
"H", *val)) {
139 buf.
appendFormatted(
" <small><em>(<a href=\"!DIATHEKE_URL!StrongsHebrew=on&verse=%s\">%s</a>)</em></small> ", val+1, tag.getAttribute(
"morph"));
142 buf.
appendFormatted(
" <small><em>(<a href=\"!DIATHEKE_URL!Packard=on&verse=%s\">%s</a>)</em></small> ", val, tag.getAttribute(
"morph"));
144 }
while (++i < count);
147 if ((attrib = tag.getAttribute(
"POS"))) {
148 val = strchr(attrib,
':');
149 val = (val) ? (val + 1) : attrib;
159 else if (!strcmp(tag.getName(),
"note")) {
160 if (!tag.isEndTag()) {
161 if (!tag.isEmpty()) {
162 SWBuf type = tag.getAttribute(
"type");
164 if (type !=
"x-strongsMarkup" &&
165 type !=
"strongsMarkup") {
166 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
174 char ch = ((tag.getAttribute(
"type") && (!strcmp(tag.getAttribute(
"type"),
"crossReference"))) ?
'x':
'n');
175 buf.
appendFormatted(
"<a href=\"noteID=%s.%c.%s\"><small><sup>*%c</sup></small></a> ", vkey->
getText(), ch, footnoteNumber.
c_str(), ch);
178 u->suspendTextPassThru =
true;
181 if (tag.isEndTag()) {
182 u->suspendTextPassThru =
false;
187 else if (!strcmp(tag.getName(),
"p")) {
188 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
191 else if (tag.isEndTag()) {
202 else if (!strcmp(tag.getName(),
"reference")) {
206 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
207 buf +=
"<a href=\"!DIATHEKE_URL!verse=";
208 if ((attrib = tag.getAttribute(
"osisRef"))) {
209 val = strchr(attrib,
':');
210 val = (val) ? (val + 1) : attrib;
215 else if (tag.isEndTag()) {
221 else if (!strcmp(tag.getName(),
"l")) {
225 else if (tag.isEndTag()) {
228 else if (tag.getAttribute(
"sID")) {
234 else if ((!strcmp(tag.getName(),
"lb")) || ((!strcmp(tag.getName(),
"milestone")) && (tag.getAttribute(
"type")) && (!strcmp(tag.getAttribute(
"type"),
"line")))) {
240 else if (!strcmp(tag.getName(),
"title")) {
241 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
244 else if (tag.isEndTag()) {
250 else if (!strcmp(tag.getName(),
"hi")) {
251 SWBuf type = tag.getAttribute(
"type");
252 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
253 if (type ==
"bold" || type ==
"x-b") {
262 else if (tag.isEndTag()) {
276 else if (!strcmp(tag.getName(),
"q")) {
277 SWBuf type = tag.getAttribute(
"type");
278 SWBuf who = tag.getAttribute(
"who");
279 const char *lev = tag.getAttribute(
"level");
280 int level = (lev) ? atoi(lev) : 1;
282 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
287 buf += (level % 2) ?
'\"' :
'\'';
289 if (who ==
"Jesus") {
290 buf +=
"<font color=\"red\"> ";
293 else if (tag.isEndTag()) {
296 buf += (level % 2) ?
'\"' :
'\'';
302 buf += (level % 2) ?
'\"' :
'\'';
307 else if (!strcmp(tag.getName(),
"transChange")) {
308 SWBuf type = tag.getAttribute(
"type");
310 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
316 else if (tag.isEndTag()) {
SWBuf & appendFormatted(const char *format,...)
unsigned long length() const
bool substituteToken(SWBuf &buf, const char *token)
virtual const char * getText() const
const char * c_str() const
#define SWDYNAMIC_CAST(className, object)
bool supressAdjacentWhitespace