This function is called for every token encountered in the input text.
67 MyUserData *u = (MyUserData *)userData;
70 if (!strcmp(tag.getName(),
"p")) {
71 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
74 else if (tag.isEndTag()) {
85 else if (!strcmp(tag.getName(),
"hi")) {
86 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
87 SWBuf rend = tag.getAttribute(
"rend");
90 if (rend ==
"italic" || rend ==
"ital")
92 else if (rend ==
"bold")
94 else if (rend ==
"super" || rend ==
"sup")
96 else if (rend ==
"sub")
98 else if (rend ==
"overline")
102 else if (tag.isEndTag()) {
108 else if (!strcmp(tag.getName(),
"entryFree")) {
109 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
110 SWBuf n = tag.getAttribute(
"n");
112 buf +=
"\\teiEntryFree{";
120 else if (!strcmp(tag.getName(),
"sense")) {
121 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
122 SWBuf n = tag.getAttribute(
"n");
124 buf +=
"\n\\teiSense{";
132 else if (!strcmp(tag.getName(),
"div")) {
134 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
137 else if (tag.isEndTag()) {
142 else if (!strcmp(tag.getName(),
"lb")) {
147 else if (!strcmp(tag.getName(),
"pos") ||
148 !strcmp(tag.getName(),
"gen") ||
149 !strcmp(tag.getName(),
"case") ||
150 !strcmp(tag.getName(),
"gram") ||
151 !strcmp(tag.getName(),
"number") ||
152 !strcmp(tag.getName(),
"pron") ||
153 !strcmp(tag.getName(),
"tr") ||
154 !strcmp(tag.getName(),
"orth") ||
155 !strcmp(tag.getName(),
"etym") ||
156 !strcmp(tag.getName(),
"usg") ||
159 !strcmp(tag.getName(),
"def")) {
160 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
162 buf += tag.getName();
165 else if (tag.isEndTag()) {
170 else if (!strcmp(tag.getName(),
"ref")) {
171 if (!tag.isEndTag()) {
172 u->suspendTextPassThru =
true;
177 int was_osisref =
false;
178 if(tag.getAttribute(
"osisRef"))
180 target += tag.getAttribute(
"osisRef");
183 else if(tag.getAttribute(
"target"))
184 target += tag.getAttribute(
"target");
188 const char* the_ref = strchr(target,
':');
206 (ref) ? ref.
c_str() :
"",
213 (work.
size()) ? work.
c_str() : u->version.c_str(),
214 (ref) ? ref.
c_str() :
""
225 buf += u->lastTextNode.
c_str();
228 u->suspendTextPassThru =
false;
233 else if (!strcmp(tag.getName(),
"note")) {
234 if (!tag.isEndTag()) {
235 if (!tag.isEmpty()) {
236 u->suspendTextPassThru =
true;
239 if (tag.isEndTag()) {
240 SWBuf footnoteNumber = tag.getAttribute(
"swordFootnote");
241 SWBuf noteName = tag.getAttribute(
"n");
242 SWBuf footnoteBody =
"";
244 footnoteBody += u->module->getEntryAttributes()[
"Footnote"][footnoteNumber][
"body"];
248 footnoteNumber.
c_str(),
253 buf += u->module->renderText(footnoteBody).
c_str();
255 u->suspendTextPassThru =
false;
260 else if (!strcmp(tag.getName(),
"graphic")) {
261 const char *url = tag.getAttribute(
"url");
266 if ((filepath.
size()) && (filepath[filepath.
size()-1] !=
'/') && (url[0] !=
'/'))
273 u->suspendTextPassThru =
false;
279 else if (!strcmp(tag.getName(),
"table")) {
280 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
281 buf +=
"\n\\begin{tabular}";
283 else if (tag.isEndTag()) {
284 buf +=
"\n\\end{tabular}";
285 ++u->consecutiveNewlines;
286 u->supressAdjacentWhitespace =
true;
290 else if (!strcmp(tag.getName(),
"row")) {
291 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
295 else if (tag.isEndTag()) {
297 u->firstCell =
false;
301 else if (!strcmp(tag.getName(),
"cell")) {
302 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
303 if (u->firstCell ==
false) {
307 u->firstCell =
false;
310 else if (tag.isEndTag()) {
315 else if (!strcmp(tag.getName(),
"list")) {
316 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
318 SWBuf rend = tag.getAttribute(
"rend");
321 if (rend ==
"numbered") {
322 buf +=
"\\begin{enumerate}\n";
324 else if (rend ==
"bulleted") {
325 buf +=
"\\begin{itemize}\n";
328 buf +=
"\\begin{list-";
333 else if (tag.isEndTag()) {
334 SWBuf rend = u->lastHi;
335 if (rend ==
"numbered") {
336 buf +=
"\\end{enumerate}\n>";
338 else if (rend ==
"bulleted") {
339 buf +=
"\\end{itemize}\n";
343 buf +=
"\\end{list-";
347 u->supressAdjacentWhitespace =
true;
350 else if (!strcmp(tag.getName(),
"item")) {
351 if ((!tag.isEndTag()) && (!tag.isEmpty())) {
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
void setSize(unsigned long len)