1
/******************************************************************************
3
* gbfrtf - SWFilter descendant to convert all GBF tags to RTF tags
6
* Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
7
* CrossWire Bible Society
11
* This program is free software; you can redistribute it and/or modify it
12
* under the terms of the GNU General Public License as published by the
13
* Free Software Foundation version 2.
15
* This program is distributed in the hope that it will be useful, but
16
* WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* General Public License for more details.
33
char GBFRTF::processText(SWBuf &text, const SWKey *key, const SWModule *module)
44
bool hideText = false;
51
for (text = ""; *from; from++) {
64
// process desired tokens
65
// deal with OSIS note tags. Just hide till OSISRTF
66
if (!strncmp(token, "note ", 5)) {
69
if (!strncmp(token, "/note", 5)) {
74
case 'w': // OSIS Word (temporary until OSISRTF is done)
78
num = strstr(token, "lemma=\"x-Strongs:");
80
for (num+=17; ((*num) && (*num != '\"')); num++)
83
if (atoi((!isdigit(*val))?val+1:val) < 5627) {
84
// normal strongs number
85
strongnum += "{\\cf3 \\sub <";
86
for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
90
/* forget these for now
93
sprintf(wordstr, "%03d", word-1);
94
module->getEntryAttributes()["Word"][wordstr]["Morph"] = val;
99
num = strstr(token, "lemma=\"strong:");
101
for (num+=14; ((*num) && (*num != '\"')); num++)
104
if (atoi((!isdigit(*val))?val+1:val) < 5627) {
105
// normal strongs number
106
strongnum += "{\\cf3 \\sub <";
107
for (tok = (!isdigit(*val))?val+1:val; *tok; tok++)
111
/* forget these for now
114
sprintf(wordstr, "%03d", word-1);
115
module->getEntryAttributes()["Word"][wordstr]["Morph"] = val;
121
num = strstr(token, "morph=\"x-Robinson:");
123
for (num+=18; ((*num) && (*num != '\"')); num++)
126
// normal robinsons tense
127
strongtense += "{\\cf4 \\sub (";
128
for (tok = val; *tok; tok++)
135
if (token[1] == 'w') {
136
if ((wordCount > 0) || (strongnum != "{\\cf3 \\sub <3588>}")) {
137
//for (i = 0; i < strongnum.length(); i++)
139
//for (i = 0; i < strongtense.length(); i++)
149
text += "{\\cf3 \\sub <";
150
for (tok = token + 2; *tok; tok++)
156
text += "{\\cf4 \\sub (";
157
bool separate = false;
158
for (tok = token + 2; *tok; tok++) {
166
for (tok++; *tok; tok++) {
178
for (; *tok; tok++) {
190
text += "<a href=\"\">";
195
case 'F': // footnote begin
196
text += "{\\i1 \\sub [ ";
198
case 'f': // footnote end
203
case 'F': // font tags
205
case 'I': // italic start
208
case 'i': // italic end
211
case 'B': // bold start
214
case 'b': // bold end
219
if (!strnicmp(token+2, "Symbol", 6))
221
if (!strnicmp(token+2, "Courier", 7))
261
case 'C': // special character tags
263
case 'A': // ASCII value
264
text += (char)atoi(&token[2]);
269
case 'L': // line break
272
case 'M': // new paragraph
279
case 'T': // title formatting
282
case 'T': // Book title begin
289
text += "\\par {\\i1\\b1 ";
312
token[tokpos++] = *from;