This function is called for every token encountered in the input text.
146 MyUserData *u = (MyUserData *)userData;
153 if (!strcmp(tag.getName(),
"w")) {
156 if ((!tag.isEmpty()) && (!tag.isEndTag())) {
163 bool endTag = tag.isEndTag();
169 lastText = u->lastTextNode.
c_str();
171 else lastText =
"stuff";
175 if ((attrib = tag.getAttribute(
"xlit"))) {
176 val = strchr(attrib,
':');
177 val = (val) ? (val + 1) : attrib;
181 if ((attrib = tag.getAttribute(
"gloss"))) {
182 val = strchr(attrib,
':');
183 val = (val) ? (val + 1) : attrib;
187 if ((attrib = tag.getAttribute(
"lemma"))) {
188 int count = tag.getAttributePartCount(
"lemma",
' ');
189 int i = (count > 1) ? 0 : -1;
191 attrib = tag.getAttribute(
"lemma", i,
' ');
193 val = strchr(attrib,
':');
194 val = (val) ? (val + 1) : attrib;
195 const char *val2 = val;
196 if ((strchr(
"GH", *val)) && (isdigit(val[1])))
198 if ((!strcmp(val2,
"3588")) && (lastText.
length() < 1))
204 }
while (++i < count);
206 if ((attrib = tag.getAttribute(
"morph")) && (show)) {
207 SWBuf savelemma = tag.getAttribute(
"savlm");
208 if ((strstr(savelemma.
c_str(),
"3588")) && (lastText.
length() < 1))
211 int count = tag.getAttributePartCount(
"morph",
' ');
212 int i = (count > 1) ? 0 : -1;
214 attrib = tag.getAttribute(
"morph", i,
' ');
216 val = strchr(attrib,
':');
217 val = (val) ? (val + 1) : attrib;
218 const char *val2 = val;
219 if ((*val ==
'T') && (strchr(
"GH", val[1])) && (isdigit(val[2])))
223 }
while (++i < count);
226 if ((attrib = tag.getAttribute(
"POS"))) {
227 val = strchr(attrib,
':');
228 val = (val) ? (val + 1) : attrib;
239 else if (!strcmp(tag.getName(),
"note")) {
240 if (!tag.isEndTag()) {
241 if (!tag.isEmpty()) {
242 SWBuf type = tag.getAttribute(
"type");
244 if ((type !=
"x-strongsMarkup")
245 && (type !=
"strongsMarkup")
247 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
249 char ch = ((!strcmp(type.
c_str(),
"crossReference")) || (!strcmp(type.
c_str(),
"x-cross-ref"))) ?
'x':
'n';
250 scratch.
setFormatted(
"{\\super <a href=\"\">*%c%i.%s</a>} ", ch, u->vkey->getVerse(), footnoteNumber.
c_str());
252 u->inXRefNote = (ch ==
'x');
255 u->suspendTextPassThru = (++u->suspendLevel);
258 if (tag.isEndTag()) {
259 u->suspendTextPassThru = (--u->suspendLevel);
260 u->inXRefNote =
false;
265 else if (!strcmp(tag.getName(),
"p") || !strcmp(tag.getName(),
"lg")) {
266 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
267 outText(
"{\\fi200\\par}", buf, u);
269 else if (tag.isEndTag()) {
274 outText(
"{\\pard\\par}", buf, u);
282 else if (tag.isEmpty() && !strcmp(tag.getName(),
"div") && tag.getAttribute(
"type") && (!strcmp(tag.getAttribute(
"type"),
"x-p") || !strcmp(tag.getAttribute(
"type"),
"paragraph"))) {
284 if (tag.getAttribute(
"sID")) {
285 outText(
"{\\fi200\\par}", buf, u);
288 else if (tag.getAttribute(
"eID")) {
295 else if (!strcmp(tag.getName(),
"reference")) {
296 if (!u->inXRefNote) {
297 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
298 outText(
"{<a href=\"\">", buf, u);
300 else if (tag.isEndTag()) {
307 else if (!strcmp(tag.getName(),
"l")) {
309 if (tag.getAttribute(
"eID")) {
314 else if (tag.isEmpty() && !tag.getAttribute(
"sID")) {
318 else if (tag.isEndTag()) {
324 else if ((!strcmp(tag.getName(),
"lb") && (!tag.getAttribute(
"type") || strcmp(tag.getAttribute(
"type"),
"x-optional"))) || ((!strcmp(tag.getName(),
"milestone")) && (tag.getAttribute(
"type")) && (!strcmp(tag.getAttribute(
"type"),
"line")))) {
330 else if (!strcmp(tag.getName(),
"title")) {
331 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
332 outText(
"{\\par\\i1\\b1 ", buf, u);
334 else if (tag.isEndTag()) {
339 else if (!strcmp(tag.getName(),
"list")) {
340 if((!tag.isEndTag()) && (!tag.isEmpty())) {
341 outText(
"\\par\\pard", buf, u);
343 else if (tag.isEndTag()) {
344 outText(
"\\par\\pard", buf, u);
349 else if (!strcmp(tag.getName(),
"item")) {
350 if((!tag.isEndTag()) && (!tag.isEmpty())) {
353 else if (tag.isEndTag()) {
359 else if (!strcmp(tag.getName(),
"rdg") || !strcmp(tag.getName(),
"catchWord")) {
360 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
363 else if (tag.isEndTag()) {
369 else if (!strcmp(tag.getName(),
"hi")) {
370 SWBuf type = tag.getAttribute(
"type");
371 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
372 if (type ==
"bold" || type ==
"b" || type ==
"x-b")
377 else if (tag.isEndTag()) {
390 else if (!strcmp(tag.getName(),
"q")) {
391 SWBuf type = tag.getAttribute(
"type");
392 SWBuf who = tag.getAttribute(
"who");
393 const char *tmp = tag.getAttribute(
"level");
394 int level = (tmp) ? atoi(tmp) : 1;
395 tmp = tag.getAttribute(
"marker");
400 if ((!tag.isEmpty() && !tag.isEndTag()) || (tag.isEmpty() && tag.getAttribute(
"sID"))) {
402 if (!tag.isEmpty()) {
404 stdstr(&tagData, tag.toString());
405 u->quoteStack.push(tagData);
416 else if (u->osisQToTick)
417 outText((level % 2) ?
'\"' :
'\'', buf, u);
420 else if ((tag.isEndTag()) || (tag.getAttribute(
"eID"))) {
422 if (tag.isEndTag() && !u->quoteStack.empty()) {
423 char *tagData = u->quoteStack.top();
428 type = qTag.getAttribute(
"type");
429 who = qTag.getAttribute(
"who");
430 tmp = qTag.getAttribute(
"level");
431 level = (tmp) ? atoi(tmp) : 1;
432 tmp = qTag.getAttribute(
"marker");
441 else if (u->osisQToTick)
442 outText((level % 2) ?
'\"' :
'\'', buf, u);
452 else if (!strcmp(tag.getName(),
"milestone") && tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"cQuote")) {
453 const char *tmp = tag.getAttribute(
"marker");
456 tmp = tag.getAttribute(
"level");
457 int level = (tmp) ? atoi(tmp) : 1;
463 else if (u->osisQToTick)
464 outText((level % 2) ?
'\"' :
'\'', buf, u);
468 else if (!strcmp(tag.getName(),
"transChange")) {
469 SWBuf type = tag.getAttribute(
"type");
471 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
477 else if (tag.isEndTag()) {
483 else if (!strcmp(tag.getName(),
"divineName")) {
485 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
488 else if (tag.isEndTag()) {
494 else if (!strcmp(tag.getName(),
"div")) {
496 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
499 else if (tag.isEndTag()) {
505 else if (!strcmp(tag.getName(),
"figure")) {
506 const char *src = tag.getAttribute(
"src");
510 char* filepath =
new char[strlen(u->module->getConfigEntry(
"AbsoluteDataPath")) + strlen(token)];
513 strcat(filepath, src);
516 outText(
"<img src=\"", buf, u);
unsigned long length() const
virtual const char * getConfigEntry(const char *key) const
bool substituteToken(SWBuf &buf, const char *token)
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
const char * c_str() const
static void outText(const char *t, SWBuf &o, BasicFilterUserData *u)
bool supressAdjacentWhitespace
SWBuf & setFormatted(const char *format,...)