37 static const char oName[] =
"Word Javascript";
38 static const char oTip[] =
"Toggles Word Javascript data";
42 static const StringList oVals(&choices[0], &choices[2]);
72 unsigned int textStart = 0, lastAppendLen = 0, textEnd = 0;
75 bool needWordOut =
false;
78 SWBuf wordSrcPrefix = modName;
80 const SWBuf orig = text;
81 const char * from = orig.
c_str();
87 for (text =
""; *from; from++) {
94 textEnd = (
unsigned int)text.
length();
99 if (!
strnicmp(token,
"sync type=\"Strongs\" ", 20)) {
101 for (
unsigned int i = 27; token[i] !=
'\"' && i < 150; i++)
104 if (atoi((!isdigit(*val))?val+1:val) < 5627) {
106 sprintf(wordstr,
"%03d", word++);
107 needWordOut = (word > 2);
109 (*wordAttrs)[
"Strongs"] = val;
112 tmp.
append(text.
c_str()+textStart, (int)(textEnd - textStart));
113 (*wordAttrs)[
"Text"] = tmp;
117 (*wordAttrs)[
"TextStart"] = ts;
123 (*wordAttrs)[
"Morph"] = val;
128 if (!strncmp(token,
"sync type=\"morph\"", 17)) {
129 for (ch = token+17; *ch; ch++) {
130 if (!strncmp(ch,
"class=\"", 7)) {
132 for (
unsigned int i = 7; ch[i] !=
'\"' && i < 127; i++)
135 (*wordAttrs)[
"MorphClass"] = val;
138 if (!strncmp(ch,
"value=\"", 7)) {
140 for (
unsigned int i = 7; ch[i] !=
'\"' && i < 127; i++)
143 (*wordAttrs)[
"Morph"] = val;
155 sprintf(wstr,
"%03d", word-2);
158 SWBuf strong = (*wAttrs)[
"Strongs"];
159 SWBuf morph = (*wAttrs)[
"Morph"];
160 SWBuf morphClass = (*wAttrs)[
"MorphClass"];
161 SWBuf wordText = (*wAttrs)[
"Text"];
162 SWBuf textSt = (*wAttrs)[
"TextStart"];
165 gh = isdigit(strong[0]) ? 0:strong[0];
188 if (lexName ==
"StrongsGreek")
190 if (lexName ==
"StrongsHebrew")
201 for (
unsigned int i = 0; i < wordID.
size(); i++) {
202 if ((!isdigit(wordID[i])) && (!isalpha(wordID[i]))) {
208 int textStr = atoi(textSt.
c_str());
209 textStr += lastAppendLen;
210 SWBuf spanStart =
"";
214 if (!sMorph) sMorph = 0;
224 const char *
m = strchr(morph.
c_str(),
':');
226 else m = morph.
c_str();
227 spanStart.
appendFormatted(
"<span class=\"clk\" onclick=\"p('%s','%s','%s','%s','','%s');\" >", lexName.
c_str(), strong.
c_str(), wordID.
c_str(),
m, modName.
c_str());
228 text.
insert(textStr, spanStart);
229 lastAppendLen = (
unsigned int)spanStart.
length();
235 textStart = (
unsigned int)text.
length(); newText =
false;
241 token[tokpos++] = *from;
252 sprintf(wstr,
"%03d", word-1);
255 SWBuf strong = (*wAttrs)[
"Strongs"];
256 SWBuf morph = (*wAttrs)[
"Morph"];
257 SWBuf morphClass = (*wAttrs)[
"MorphClass"];
258 SWBuf wordText = (*wAttrs)[
"Text"];
259 SWBuf textSt = (*wAttrs)[
"TextStart"];
262 gh = isdigit(strong[0]) ? 0:strong[0];
282 if (lexName ==
"StrongsGreek")
284 if (lexName ==
"StrongsHebrew")
295 for (
unsigned int i = 0; i < wordID.
size(); i++) {
296 if ((!isdigit(wordID[i])) && (!isalpha(wordID[i]))) {
302 int textStr = atoi(textSt.
c_str());
303 textStr += lastAppendLen;
304 SWBuf spanStart =
"";
306 const char *
m = strchr(morph.
c_str(),
':');
308 else m = morph.
c_str();
309 spanStart.
appendFormatted(
"<span class=\"clk\" onclick=\"p('%s','%s','%s','%s','','%s');\" >", lexName.
c_str(), strong.
c_str(), wordID.
c_str(),
m, modName.
c_str());
310 text.
insert(textStr, spanStart);
const char * getName() const
#define SWORD_NAMESPACE_START
SWBuf & appendFormatted(const char *format,...)
unsigned long length() const
SWModule * defaultHebParse
virtual char processText(SWBuf &text, const SWKey *key=0, const SWModule *module=0)
static const StringList * oValues()
virtual const char * getText() const
std::map< SWBuf, SWBuf, std::less< SWBuf > > AttributeValue
void insert(unsigned long pos, const char *str, unsigned long start=0, signed long max=-1)
const char * c_str() const
std::list< SWBuf > StringList
SWBuf & append(const char *str, long max=-1)
static const char oName[]
virtual int getVerse() const
#define SWDYNAMIC_CAST(className, object)
unsigned long size() const
virtual AttributeTypeList & getEntryAttributes() const
static const char * choices[4]
SWModule * defaultGreekLex
int strnicmp(const char *s1, const char *s2, int len)
#define SWORD_NAMESPACE_END
SWModule * defaultGreekParse
virtual char getTestament() const