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")) {
189 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"lemma")) {
195 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Strongs")) {
196 if (!tag.isEndTag()) {
200 ((ch ==
'H') ?
"Hebrew" :
"Greek"),
206 else if (tag.getAttribute(
"type") && !strcmp(tag.getAttribute(
"type"),
"Dict")) {
207 if (!tag.isEndTag()) {
216 else if (!strcmp(tag.getName(),
"note")) {
217 if (!tag.isEndTag()) {
218 if (!tag.isEmpty()) {
219 SWBuf type = tag.getAttribute(
"type");
220 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
221 SWBuf noteName = tag.getAttribute(
"n");
222 SWBuf footnoteBody =
"";
224 footnoteBody += u->module->getEntryAttributes()[
"Footnote"][footnoteNumber][
"body"];
228 char ch = ((tag.getAttribute(
"type") && ((!strcmp(tag.getAttribute(
"type"),
"crossReference")) || (!strcmp(tag.getAttribute(
"type"),
"x-cross-ref")))) ?
'x':
'n');
231 footnoteNumber.
c_str(),
237 char ch = ((tag.getAttribute(
"type") && ((!strcmp(tag.getAttribute(
"type"),
"crossReference")) || (!strcmp(tag.getAttribute(
"type"),
"x-cross-ref")))) ?
'x':
'n');
240 footnoteNumber.
c_str(),
245 u->suspendTextPassThru =
true;
247 buf += u->module->renderText(footnoteBody).
c_str();
251 if (tag.isEndTag()) {
253 u->suspendTextPassThru =
false;
256 else if (!strcmp(tag.getName(),
"scripture")) {
257 buf += (tag.isEndTag() ?
"\\swordquote" :
"}");
260 else if (!strcmp(tag.getName(),
"scripRef")) {
261 if (!tag.isEndTag()) {
262 if (!tag.isEmpty()) {
263 u->suspendTextPassThru =
true;
266 if (!tag.isEndTag()) {
267 if (!u->isBiblicalText) {
268 SWBuf refList = u->startTag.getAttribute(
"passage");
270 refList = u->lastTextNode;
271 SWBuf version = tag.getAttribute(
"version");
275 (version.length()) ? version.c_str() :
"");
276 buf += u->lastTextNode.
c_str();
280 SWBuf footnoteNumber = u->startTag.getAttribute(
"swordFootnote");
281 SWBuf noteName = tag.getAttribute(
"n");
282 SWBuf footnoteBody =
"";
284 footnoteBody += u->module->getEntryAttributes()[
"Footnote"][footnoteNumber][
"body"];
293 footnoteNumber.
c_str(),
298 buf += u->module->renderText(footnoteBody).
c_str();
305 else if (tag.isEndTag()){
308 u->suspendTextPassThru =
false;
311 else if (tag.getName() && !strcmp(tag.getName(),
"div")) {
318 if (!tag.isEndTag() && u->inSecHead) {
319 buf +=
"\\swordsection{sechead}{";
320 u->inSecHead =
false;
323 else if (!tag.isEndTag() && tag.getAttribute(
"class")) {
324 buf +=
"\\swordsection{";
325 buf += tag.getAttribute(
"class");
329 else if (!tag.isEndTag()) {
330 buf +=
"\\swordsection{}{";
333 else if (tag.isEndTag()) {
337 else if (tag.getName() && (!strcmp(tag.getName(),
"img") || !strcmp(tag.getName(),
"image"))) {
338 const char *src = strstr(token,
"src");
343 if (((c = strchr(src+3,
'"')) ==
NULL) ||
344 ((d = strchr( ++c ,
'"')) ==
NULL))
351 for (c = token; *c; c++) {
352 if ((*c ==
'/') && (*(c+1) ==
'\0'))
355 for (;((*c) && (*c !=
'"')); c++)
358 if (!*c) { c--;
continue; }
362 buf +=
"\\includegraphics{";
364 if (buf[buf.
length()-2] ==
'/')
373 else if (tag.getName() && (!strcmp(tag.getName(),
"i"))){
374 if (!tag.isEndTag()) {
379 else if (tag.getName() && (!strcmp(tag.getName(),
"br"))){
SWBuf & appendFormatted(const char *format,...)
unsigned long length() const
virtual const char * getConfigEntry(const char *key) const
bool substituteToken(SWBuf &buf, const char *token)
const char * c_str() const