This function is called for every token encountered in the input text.
97 MyUserData *u = (MyUserData *)userData;
100 if (!strcmp(tag.getName(),
"p")) {
101 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
104 else if (tag.isEndTag()) {
105 buf +=
"<!/P><br />";
115 else if (!strcmp(tag.getName(),
"hi")) {
116 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
117 SWBuf rend = tag.getAttribute(
"rend");
120 if (rend ==
"italic" || rend ==
"ital")
122 else if (rend ==
"bold")
124 else if (rend ==
"super" || rend ==
"sup")
126 else if (rend ==
"sub")
128 else if (rend ==
"overline")
129 buf +=
"<span style=\"text-decoration:overline\">";
132 else if (tag.isEndTag()) {
133 SWBuf rend = u->lastHi;
134 if (rend ==
"italic" || rend ==
"ital")
136 else if (rend ==
"bold")
138 else if (rend ==
"super" || rend ==
"sup")
140 else if (rend ==
"sub")
142 else if (rend ==
"overline")
148 else if (!strcmp(tag.getName(),
"entryFree")) {
149 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
150 SWBuf n = tag.getAttribute(
"n");
152 buf +=
"<span class=\"entryFree\">";
160 else if (!strcmp(tag.getName(),
"sense")) {
161 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
162 SWBuf n = tag.getAttribute(
"n");
163 buf +=
"<br/><span class=\"sense";
172 else if (tag.isEndTag()) {
178 else if (!strcmp(tag.getName(),
"div")) {
180 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
183 else if (tag.isEndTag()) {
188 else if (!strcmp(tag.getName(),
"lb")) {
193 else if (!strcmp(tag.getName(),
"pos") ||
194 !strcmp(tag.getName(),
"gen") ||
195 !strcmp(tag.getName(),
"case") ||
196 !strcmp(tag.getName(),
"gram") ||
197 !strcmp(tag.getName(),
"number") ||
198 !strcmp(tag.getName(),
"pron") ||
199 !strcmp(tag.getName(),
"def") ||
200 !strcmp(tag.getName(),
"tr") ||
201 !strcmp(tag.getName(),
"orth") ||
202 !strcmp(tag.getName(),
"etym") ||
203 !strcmp(tag.getName(),
"usg") ||
204 !strcmp(tag.getName(),
"quote")||
205 !strcmp(tag.getName(),
"cit")||
206 !strcmp(tag.getName(),
"persName")||
207 !strcmp(tag.getName(),
"oVar"))
209 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
210 buf +=
"<span class=\"";
211 buf += tag.getName();
212 if (tag.getAttribute(
"type")) {
213 buf +=
"\" type =\"";
214 buf += tag.getAttribute(
"type");
216 if (tag.getAttribute(
"rend")) {
217 buf +=
"\" rend =\"";
218 buf += tag.getAttribute(
"rend");
222 else if (tag.isEndTag()) {
227 else if (!strcmp(tag.getName(),
"ref")) {
228 if (!tag.isEndTag()) {
229 u->suspendTextPassThru =
true;
234 int was_osisref =
false;
235 if(tag.getAttribute(
"osisRef"))
237 target += tag.getAttribute(
"osisRef");
240 else if(tag.getAttribute(
"target"))
241 target += tag.getAttribute(
"target");
245 const char* the_ref = strchr(target,
':');
262 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">",
282 buf += u->lastTextNode.
c_str();
285 u->suspendTextPassThru =
false;
290 else if (!strcmp(tag.getName(),
"note")) {
291 if (!tag.isEndTag()) {
292 if (!tag.isEmpty()) {
293 u->suspendTextPassThru =
true;
297 if (tag.isEndTag()) {
298 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
299 SWBuf noteName = tag.getAttribute(
"n");
301 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup class=\"n\">*n%s</sup></small></a>",
307 u->suspendTextPassThru =
false;
311 else if (!strcmp(tag.getName(),
"graphic")) {
312 const char *url = tag.getAttribute(
"url");
317 if ((filepath.
size()) && (filepath[filepath.
size()-1] !=
'/') && (url[0] !=
'/'))
321 buf.
appendFormatted(
"<a href=\"passagestudy.jsp?action=showImage&value=%s&module=%s\"><img src=\"file:%s\" border=\"0\" /></a>",
325 u->suspendTextPassThru =
false;
329 else if (!strcmp(tag.getName(),
"table")) {
330 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
331 buf +=
"<table><tbody>\n";
333 else if (tag.isEndTag()) {
334 buf +=
"</tbody></table>\n";
335 u->supressAdjacentWhitespace =
true;
338 else if (!strcmp(tag.getName(),
"row")) {
339 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
342 else if (tag.isEndTag()) {
346 else if (!strcmp(tag.getName(),
"cell")) {
347 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
350 else if (tag.isEndTag()) {
355 else if (!strcmp(tag.getName(),
"list")) {
356 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
358 SWBuf rend = tag.getAttribute(
"rend");
361 if (rend ==
"numbered") {
364 else if (rend ==
"lettered") {
365 buf +=
"<ol type=\"A\">\n";
367 else if (rend ==
"bulleted") {
371 buf +=
"<ul class=\"list ";
376 else if (tag.isEndTag()) {
377 SWBuf rend = u->lastHi;
378 if (rend ==
"numbered") {
381 else if (rend ==
"lettered") {
384 else if (rend ==
"bulleted") {
390 u->supressAdjacentWhitespace =
true;
393 else if (!strcmp(tag.getName(),
"item")) {
394 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
397 else if (tag.isEndTag()) {
SWBuf & appendFormatted(const char *format,...)
virtual const char * getConfigEntry(const char *key) const
bool substituteToken(SWBuf &buf, const char *token)
const char * c_str() const
unsigned long size() const
static const SWBuf encode(const char *urlText)
void setSize(unsigned long len)