46 bool types =
false, descriptions =
false, names =
false, bibliography =
false;
48 if (!::
stricmp(key,
"localelist")) {
51 for (list<SWBuf>::iterator li = loclist.begin(); li != loclist.end(); ++li) {
52 *output << li->c_str() << endl;
55 else if (!::
stricmp(key,
"modulelist")) {
60 else if (!::
stricmp(key,
"modulelistnames")) {
63 else if (!::
stricmp(key,
"modulelistdescriptions")) {
66 else if (!::
stricmp(key,
"bibliography")) {
72 if (types || descriptions || names || bibliography) {
73 const char *modTypes[] = {
82 for (
int i = 0; modTypes[i]; ++i) {
84 if (types) *output << modTypes[i] <<
":\n";
85 for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
87 if (!strcmp(target->getType(), modTypes[i])) {
88 if (names) *output << target->getName();
89 if (names && (descriptions || bibliography)) *output <<
" : ";
90 if (descriptions) *output << target->getDescription();
91 if (bibliography) *output << target->getBibliography();
101 void doquery(
unsigned long maxverses = -1,
unsigned char outputformat =
FMT_PLAIN,
unsigned char outputencoding =
ENC_UTF8,
unsigned long optionfilters = 0,
unsigned char searchtype =
ST_NONE,
const char *
range = 0,
const char *text = 0,
const char *locale = 0,
const char *ref = 0, ostream* output = &cout,
const char *script = 0,
signed char variants = 0) {
106 const char *DEFAULT_FONT =
"Gentium";
109 const char *font = 0;
116 char inputformat = 0;
119 if (!locale) { locale =
"en";
123 syslocale = SWBuf(locale);
124 syslocale.append(
".en");
127 syslanguage = lom->
translate(syslocale,
"locales");
131 if (!::
stricmp(text,
"system")) {
140 target = manager.getModule(text);
143 if (target->getLanguage()) {
144 modlocale = target->getLanguage();
146 modlanguage = lm->
translate(modlocale.append(
".en"),
"locales");
151 modlanguage =
"English";
155 SWBuf sourceType = target->getConfigEntry(
"SourceType");
156 if (sourceType ==
"GBF") inputformat =
FMT_GBF;
157 else if (sourceType ==
"ThML") inputformat =
FMT_THML;
158 else if (sourceType ==
"OSIS") inputformat =
FMT_OSIS;
159 else if (sourceType ==
"TEI") inputformat =
FMT_TEI;
161 SWBuf encoding = target->getConfigEntry(
"Encoding");
165 switch (inputformat) {
166 case FMT_THML : *output <<
"ThML";
break;
167 case FMT_GBF : *output <<
"GBF" ;
break;
168 case FMT_OSIS : *output <<
"OSIS";
break;
169 case FMT_TEI : *output <<
"TEI" ;
break;
170 default: *output <<
"Other";
173 *output << target->getType();
180 manager.setGlobalOption(
"Footnotes", (optionfilters &
OP_FOOTNOTES) ?
"On":
"Off");
181 manager.setGlobalOption(
"Headings", (optionfilters &
OP_HEADINGS) ?
"On":
"Off");
182 manager.setGlobalOption(
"Strong's Numbers", (optionfilters &
OP_STRONGS) ?
"On":
"Off");
183 manager.setGlobalOption(
"Morphological Tags", (optionfilters &
OP_MORPH) ?
"On":
"Off");
184 manager.setGlobalOption(
"Hebrew Cantillation", (optionfilters &
OP_CANTILLATION) ?
"On":
"Off");
185 manager.setGlobalOption(
"Hebrew Vowel Points", (optionfilters &
OP_HEBREWPOINTS) ?
"On":
"Off");
186 manager.setGlobalOption(
"Greek Accents", (optionfilters &
OP_GREEKACCENTS) ?
"On":
"Off");
187 manager.setGlobalOption(
"Lemmas", (optionfilters &
OP_LEMMAS) ?
"On":
"Off");
188 manager.setGlobalOption(
"Cross-references", (optionfilters &
OP_SCRIPREF) ?
"On":
"Off");
189 manager.setGlobalOption(
"Words of Christ in Red", (optionfilters &
OP_REDLETTERWORDS) ?
"On":
"Off");
190 manager.setGlobalOption(
"Arabic Vowel Points", (optionfilters &
OP_ARABICPOINTS) ?
"On":
"Off");
191 manager.setGlobalOption(
"Glosses", (optionfilters &
OP_GLOSSES) ?
"On":
"Off");
192 manager.setGlobalOption(
"Transliterated Forms", (optionfilters &
OP_XLIT) ?
"On":
"Off");
193 manager.setGlobalOption(
"Enumerations", (optionfilters &
OP_ENUM) ?
"On":
"Off");
194 manager.setGlobalOption(
"Morpheme Segmentation", (optionfilters &
OP_MORPHSEG) ?
"On":
"Off");
195 manager.setGlobalOption(
"Transliteration", (optionfilters &
OP_TRANSLITERATOR && script) ? script :
"Off");
197 VerseKey *parser = (
SWDYNAMIC_CAST(VerseKey, target->getKey())) ? (VerseKey *)target->createKey() : 0;
198 if (parser && (optionfilters &
OP_INTROS)) { parser->setIntros(
true); ((VerseKey *)target->getKey())->setIntros(
true); }
203 manager.setGlobalOption(
"Textual Variants",
"All Readings");
204 else if (variants == 1)
205 manager.setGlobalOption(
"Textual Variants",
"Secondary Reading");
207 else manager.setGlobalOption(
"Textual Variants",
"Primary Reading");
212 char st = 1 - searchtype;
214 *output <<
"Verses containing \"";
216 else *output <<
"Entries containing \"";
220 if (
range && parser) {
221 ListKey scope = parser->parseVerseList(
range,
"Gen 1:1",
true);
222 listkey = target->search(ref, st,
REG_ICASE, &scope);
224 else listkey = target->search(ref, st,
REG_ICASE);
227 if (listkey.getCount()) {
228 for (listkey =
TOP; !listkey.popError(); listkey++) {
229 if (!listkey.popError()) {
230 if (outputformat ==
FMT_CGI) *output <<
"<entry>";
231 *output << listkey.getText();
232 if (outputformat ==
FMT_CGI) *output <<
"</entry>";
234 if (first) first =
false;
235 else *output <<
" ; ";
239 *output << listkey.getCount() <<
" matches total (";
244 *output << target->getName();
250 listkey = parser->parseVerseList(ref,
"Gen1:1",
true);
254 font = target->getConfigEntry(
"Font");
255 if (!font) font = DEFAULT_FONT;
258 *output <<
"{\\rtf1\\ansi{\\fonttbl{\\f0\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f1\\fdecor\\fprq2 ";
260 *output <<
";}{\\f7\\froman\\fcharset2\\fprq2 Symbol;}}";
264 *output <<
"\\documentclass{bibletext}\n"
265 "\\usepackage{sword}\n"
266 "\\title{" << target->getDescription() <<
" \\\\\\small " << ref <<
"}\n";
268 if (syslanguage.size()) {
269 syslanguage[0] = tolower(syslanguage[0]);
270 *output <<
"\\setmainlanguage{" << syslanguage <<
"}\n";
273 if (modlanguage.size()) {
274 modlanguage[0] = tolower(modlanguage[0]);
277 modlanguage =
"english";
280 if (!(modlanguage == syslanguage)) {
281 *output <<
"\\setotherlanguage{" << modlanguage <<
"}\n";
285 *output <<
"\\date{}\n"
286 "\\begin{document}\n"
289 if (!(modlanguage == syslanguage)) {
290 *output <<
"\\begin{" << modlanguage <<
"}\n";
296 *output <<
"<html><head><meta http-equiv=\"content-type\" content=\"text/html\" charset=\"UTF-8\""
297 " lang=\"" << locale <<
"\" xml:lang=\"" << locale <<
"\"/>\n"
298 "<style type=\"text/css\">" << target->getRenderHeader() <<
"</style></head><body>";
302 for (listkey =
TOP; !listkey.popError() && maxverses; listkey++) {
303 target->setKey(listkey);
307 SWBuf text = target->renderText();
312 if (vk->getVerse() == 1) {
313 if (vk->getChapter() == 1) {
314 if (vk->getBook() == 1) {
315 if (vk->getTestament() == 1) {
318 { *output <<
"\\swordmodule\n";
325 *output <<
"\\swordtestament\n";
331 *output <<
"\\swordbook\n";
336 *output <<
"\n\\swordchapter{"
337 << vk->getOSISRef() <<
"}{"
338 << vk->getText() <<
"}{"
339 << vk->getChapter() <<
"}";
344 header = target->getEntryAttributes()[
"Heading"][
"Preverse"][
"0"];
345 *output << target->renderText(header);
349 *output <<
"\\swordverse{"
350 << vk->getOSISRef() <<
"}{"
351 << vk->getText() <<
"}{"
352 << vk->getVerse() <<
"} ";
356 *output << target->getKeyText();
361 *output << target->getKeyText();
366 *output <<
": <span ";
367 *output <<
"style=\"font:" << font <<
";\" ";
368 if (strcmp(modlocale,locale) !=0 ) { *output <<
"lang=\"" << modlocale <<
"\"";}
371 else if (outputformat ==
FMT_RTF) {
372 *output <<
": {\\f1 ";
385 *output <<
"</span>";
387 else if (outputformat ==
FMT_RTF) {
394 *output <<
"<milestone type=\"line\"/>";
395 else if (outputformat ==
FMT_RTF)
397 else if (outputformat ==
FMT_GBF)
405 if ((outputformat ==
FMT_LATEX) && (!(modlanguage == syslanguage))) {
406 *output <<
"\\end{" << modlanguage <<
"}\n";
411 *output << target->getName();
415 *output << target->getConfigEntry(
"DistributionLicense");
425 *output <<
"\\end{document}\n";
428 *output <<
"</body></html>\n";
virtual void setDefaultLocaleName(const char *name)
static const char * MODTYPE_GENBOOKS
static const char * MODTYPE_LEXDICTS
int stricmp(const char *s1, const char *s2)
static const char * MODTYPE_BIBLES
static LocaleMgr * getSystemLocaleMgr()
static const char * MODTYPE_COMMENTARIES
void systemquery(const char *key, ostream *output)
virtual const char * translate(const char *text, const char *localeName=0)
#define SWDYNAMIC_CAST(className, object)
#define OP_REDLETTERWORDS
static const char * MODTYPE_DAILYDEVOS
virtual StringList getAvailableLocales()
int strnicmp(const char *s1, const char *s2, int len)
void doquery(unsigned long maxverses=-1, unsigned char outputformat=FMT_PLAIN, unsigned char outputencoding=ENC_UTF8, unsigned long optionfilters=0, unsigned char searchtype=ST_NONE, const char *range=0, const char *text=0, const char *locale=0, const char *ref=0, ostream *output=&cout, const char *script=0, signed char variants=0)
#define OP_TRANSLITERATOR