This function is called for every token encountered in the input text.
226 MyUserData *u = (MyUserData *)userData;
228 if ((!tag.isEndTag()) && (!tag.isEmpty()))
230 if (tag.getName() && !strcmp(tag.getName(),
"sync")) {
231 SWBuf value = tag.getAttribute(
"value");
232 if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"morph")) {
235 else if( tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Strongs")) {
236 if (value[0] ==
'H' || value[0] ==
'G' || value[0] ==
'A') {
240 else if (value[0] ==
'T') {
245 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Dict")) {
252 else if (!strcmp(tag.getName(),
"note")) {
253 if (!tag.isEndTag()) {
254 if (!tag.isEmpty()) {
255 SWBuf type = tag.getAttribute(
"type");
256 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
259 char ch = ((tag.getAttribute(
"type") && ((!strcmp(tag.getAttribute(
"type"),
"crossReference")) || (!strcmp(tag.getAttribute(
"type"),
"x-cross-ref")))) ?
'x':
'n');
260 buf.
appendFormatted(
"{\\super <a href=\"\">*%c%i.%s</a>} ", ch, u->vkey->getVerse(), footnoteNumber.
c_str());
262 u->suspendTextPassThru =
true;
265 if (tag.isEndTag()) {
266 u->suspendTextPassThru =
false;
271 else if (!strcmp(tag.getName(),
"scripRef")) {
272 if (!tag.isEndTag()) {
273 if (!tag.isEmpty()) {
274 u->suspendTextPassThru =
true;
277 if (tag.isEndTag()) {
278 if (!u->isBiblicalText) {
279 SWBuf refList = u->startTag.getAttribute(
"passage");
281 refList = u->lastTextNode;
282 SWBuf version = tag.getAttribute(
"version");
283 buf +=
"<a href=\"\">";
284 buf += refList.
c_str();
289 SWBuf footnoteNumber = u->startTag.getAttribute(
"swordFootnote");
292 buf.
appendFormatted(
"{\\super <a href=\"\">*x%i.%s</a>} ", u->vkey->getVerse(), footnoteNumber.
c_str());
297 u->suspendTextPassThru =
false;
301 else if (tag.getName() && !strcmp(tag.getName(),
"div")) {
302 if (tag.isEndTag() && u->inSecHead) {
304 u->inSecHead =
false;
306 else if (tag.getAttribute(
"class")) {
307 if (!
stricmp(tag.getAttribute(
"class"),
"sechead")) {
309 buf +=
"{\\par\\i1\\b1 ";
311 else if (!
stricmp(tag.getAttribute(
"class"),
"title")) {
313 buf +=
"{\\par\\i1\\b1 ";
317 else if (tag.getName() && (!strcmp(tag.getName(),
"img") || !strcmp(tag.getName(),
"image"))) {
318 const char *src = tag.getAttribute(
"src");
322 char* filepath =
new char[strlen(u->module->getConfigEntry(
"AbsoluteDataPath")) + strlen(token)];
325 strcat(filepath, src);
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