This method processes and appropriately modifies the text given it for a particular filter task
48 bool keepToken =
false;
56 bool suspendTextPassThru =
false;
60 bool lastspace =
false;
62 const char *wordStart = text.
c_str();
63 const char *wordEnd =
NULL;
65 const char *textStart =
NULL;
66 const char *textEnd =
NULL;
73 for (
const char* from = orig.
c_str(); *from; ++from) {
89 suspendTextPassThru =
false;
93 while (wordStart < (text.
c_str() + text.
length())) {
94 if (strchr(
";,. :?!()'\"", *wordStart) && wordStart[0] && wordStart[1])
98 while (wordEnd > wordStart) {
99 if (strchr(
" ,;:.?!()'\"", *wordEnd))
105 if (!strncmp(token,
"scripRef", 8)) {
106 suspendTextPassThru =
true;
110 else if (!strncmp(token,
"/scripRef", 9)) {
112 tmp.
append(textStart, (
int)(textEnd - textStart)+1);
116 suspendTextPassThru =
false;
121 if (!strcmp(token,
"RF") || !strncmp(token,
"RF ", 3)) {
123 text +=
"<note type=\"x-StudyNote\">";
128 else if (!strcmp(token,
"Rf")) {
134 if (!strcmp(token,
"TH")) {
135 text +=
"<title type=\"psalm\">";
140 else if (!strcmp(token,
"Th")) {
146 if (!strcmp(token,
"FI")) {
147 text +=
"<transChange type=\"added\">";
152 else if (!strcmp(token,
"Fi")) {
153 text +=
"</transChange>";
158 if (!strcmp(token,
"CT")) {
165 if (!strcmp(token,
"CG")) {
172 if (!strcmp(token,
"CM")) {
173 text +=
"<milestone type=\"x-p\" />";
180 else if (!strncmp(token,
"img ", 4)) {
181 const char *src = strstr(token,
"src");
186 text +=
"<figure src=\"";
188 for (c = src;((*c) && (*c !=
'"')); c++);
199 for (c++;((*c) && (*c !=
'"')); c++) {
209 else if (*token ==
'W' && (token[1] ==
'G' || token[1] ==
'H')) {
210 bool divineName =
false;
215 if (!strncmp(wordStart,
"<w ", 3)) {
216 const char *attStart = strstr(wordStart,
"lemma");
224 attStart = wordStart + 3;
233 if (!strcmp(value.
c_str(),
"H03068")) {
248 text +=
"</w></divineName>";
258 else if (*token ==
'W' && token[1] ==
'T') {
259 if (token[2] ==
'G' || token[2] ==
'H') {
262 else value = token+1;
264 if (!strncmp(wordStart,
"<w ", 3)) {
265 const char *attStart = strstr(wordStart,
"morph");
272 attStart = wordStart + 3;
295 if (from[1] && strchr(
" ,;.:?!()'\"", from[1])) {
317 if ((tokpos < 2045) && ((*from != 10)&&(*from != 13))) {
318 token[tokpos++] = *from;
332 if (newWord && (*from !=
' ')) {
341 if (!suspendTextPassThru) {
343 lastspace = (*from ==
' ');
SWBuf & appendFormatted(const char *format,...)
virtual SWKey * clone() const
unsigned long length() const
static SWLog * getSystemLog()
virtual void setChapter(int ichapter)
static const char * convertToOSIS(const char *inRef, const SWKey *defaultKey)
void insert(unsigned long pos, const char *str, unsigned long start=0, signed long max=-1)
virtual void setIntros(bool val)
const char * c_str() const
SWBuf & append(const char *str, long max=-1)
virtual void setVerse(int iverse)
virtual int getVerse() const
virtual const char * getOSISRef() const
#define SWDYNAMIC_CAST(className, object)
void logError(const char *fmt,...) const
virtual void setAutoNormalize(bool iautonorm)