diff options
Diffstat (limited to 'utilities/diatheke')
-rw-r--r-- | utilities/diatheke/Makefile.in | 1 | ||||
-rw-r--r-- | utilities/diatheke/README | 4 | ||||
-rw-r--r-- | utilities/diatheke/corediatheke.cpp | 90 | ||||
-rw-r--r-- | utilities/diatheke/corediatheke.h | 8 | ||||
-rw-r--r-- | utilities/diatheke/diatheke.cpp | 53 | ||||
-rw-r--r-- | utilities/diatheke/diathekemgr.cpp | 7 |
6 files changed, 114 insertions, 49 deletions
diff --git a/utilities/diatheke/Makefile.in b/utilities/diatheke/Makefile.in index c76a8c5..3971a8a 100644 --- a/utilities/diatheke/Makefile.in +++ b/utilities/diatheke/Makefile.in @@ -216,7 +216,6 @@ GREP = @GREP@ ICU_CONFIG = @ICU_CONFIG@ ICU_IOLIBS = @ICU_IOLIBS@ ICU_LIBS = @ICU_LIBS@ -ICU_VER = @ICU_VER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/utilities/diatheke/README b/utilities/diatheke/README index 7421a6d..df39d86 100644 --- a/utilities/diatheke/README +++ b/utilities/diatheke/README @@ -47,6 +47,8 @@ default page to create a custom index.html for your users. ---------------------------------------------------------------------- VERSION HISTORY +4.7 + 4.6 July 16, 2013 Updated for Sword 1.7.0. @@ -75,7 +77,7 @@ VERSION HISTORY COPYRIGHT The Diatheke Suite and its components, Diatheke, Diatheke/CGI, and -Diatheke/Tcl are Copyright 1999-2013 by CrossWire Bible Society. +Diatheke/Tcl are Copyright 1999-2014 by CrossWire Bible Society. HANDiatheke is Copyright 2000-2001 by CrossWire Bible Society. The Diatheke Suite and all of its components are licensed through the GNU General Public License and are intended for free distribution. diff --git a/utilities/diatheke/corediatheke.cpp b/utilities/diatheke/corediatheke.cpp index 37f9448..6e05e7c 100644 --- a/utilities/diatheke/corediatheke.cpp +++ b/utilities/diatheke/corediatheke.cpp @@ -2,9 +2,9 @@ * * corediatheke.cpp - * - * $Id: corediatheke.cpp 2931 2013-07-31 13:07:26Z scribe $ + * $Id: corediatheke.cpp 3207 2014-05-01 02:48:10Z greg.hellings $ * - * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 2001-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -120,17 +120,28 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI ListKey listkey; SectionMap::iterator sit; ConfigEntMap::iterator eit; - SWModule *target; + char *font = 0; + SWBuf modlanguage; + SWBuf modlocale; + SWBuf syslanguage; + SWBuf syslocale; char inputformat = 0; SWBuf encoding; char querytype = 0; - if (locale) { - LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale); + if (!locale) { locale = "en"; } + + syslocale = SWBuf(locale); + syslocale.append(".en"); + LocaleMgr *lom = LocaleMgr::getSystemLocaleMgr(); + lom->setDefaultLocaleName(syslocale); + syslanguage = lom->translate(syslocale, "locales"); + + //deal with queries to "system" if (!::stricmp(text, "system")) { querytype = QT_SYSTEM; @@ -148,6 +159,19 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI target = (*it).second; SWKey *p = target->createKey(); VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p); + + + if (target->getLanguage()) { + modlocale = target->getLanguage(); + LocaleMgr *lm = LocaleMgr::getSystemLocaleMgr(); + modlanguage = lm->translate(modlocale.append(".en"), "locales"); + modlocale -= 3; + } + else { + modlocale = "en"; + modlanguage = "English"; + } + if (!parser) { delete p; parser = new VerseKey(); @@ -314,15 +338,17 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *output << ";}}"; } else if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML) { - *output << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">"; + *output << "<meta http-equiv=\"content-type\" content=\"text/html\" charset=\"UTF-8\"" + " lang=\"" << locale << "\" xml:lang=\"" << locale << "\"/>"; } + if (text.length()) { *output << (char*)target->getKeyText(); + *output << (char*)target->getKeyText(); if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) { - *output << ": <font face=\""; - *output << font; - *output << "\">"; + *output << ": <span style=\"font:\"" << font << ";\"" + << " lang=\"" << modlocale << "\">"; } else if (outputformat == FMT_RTF) { *output << ": {\\f1 "; @@ -331,16 +357,14 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *output << ": "; } *output << text; - if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) { - *output << "</font>"; + if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) { + *output << "</span>"; } else if (outputformat == FMT_RTF) { *output << "}"; } - *output << "("; - *output << target->getName(); - *output << ")\n"; + *output << "(" << target->getName() << ")\n"; } if (outputformat == FMT_RTF) { @@ -371,7 +395,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *output << ";}{\\f7\\froman\\fcharset2\\fprq2 Symbol;}}"; } else if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML) { - *output << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">"; + *output << "<meta http-equiv=\"content-type\" content=\"text/html\" charset=\"UTF-8\"" + " lang=\"" << locale << "\" xml:lang=\"" << locale << "\"/>"; } for (i = 0; i < listkey.getCount() && maxverses; i++) { @@ -381,10 +406,14 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *parser = element->getUpperBound(); while (maxverses && *target->getKey() <= *parser) { *output << (char*)target->getKeyText(); + if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) { + *output << ": <span "; + if (font) { *output << "style=\"font:\"" << font << ";\" " ;} + if (strcmp(modlocale,locale) !=0 ) { *output << "lang=\"" << modlocale << "\"";} + *output << ">"; + } if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) { - *output << ": <font face=\""; - *output << font; - *output << "\">"; + *output << ": <span style=\"font:\"" << font << ";\"" << " lang=\"" << modlocale << "\">"; } else if (outputformat == FMT_RTF) { *output << ": {\\f1 "; @@ -393,8 +422,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *output << ": "; } *output << target->renderText(); - if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) { - *output << "</font>"; + if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) { + *output << "</span>"; } else if (outputformat == FMT_RTF) { *output << "}"; @@ -420,10 +449,16 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI else { target->setKey(*listkey.getElement(i)); *output << (char*)target->getKeyText(); + if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) { + *output << ": <span "; + if (font) { *output << "style=\"font:\"" << font << ";\" " ;} + if (strcmp(modlocale,locale) !=0 ) { *output << "lang=\"" << modlocale << "\"";} + *output << ">"; + } + } + if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) { - *output << ": <font face=\""; - *output << font; - *output << "\">"; + *output << ": <font face=\"" << font << "\">"; } else if (outputformat == FMT_RTF) { *output << ": {\\f1 "; @@ -432,8 +467,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *output << ": "; } *output << target->renderText(); - if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) { - *output << "</font>"; + if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI) { + *output << "</span>"; } else if (outputformat == FMT_RTF) { *output << "}"; @@ -452,7 +487,8 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI maxverses--; } } - + + *output << "("; *output << target->getName(); *output << ")\n"; @@ -462,6 +498,4 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI } } - delete parser; -} diff --git a/utilities/diatheke/corediatheke.h b/utilities/diatheke/corediatheke.h index 833825e..cac0845 100644 --- a/utilities/diatheke/corediatheke.h +++ b/utilities/diatheke/corediatheke.h @@ -2,7 +2,7 @@ * * corediatheke.h - * - * $Id: corediatheke.h 2900 2013-07-16 07:48:52Z chrislit $ + * $Id: corediatheke.h 3189 2014-04-17 05:00:28Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -30,6 +30,7 @@ #include "diathekemgr.h" #include <localemgr.h> +#include <swlocale.h> #define QT_BIBLE 1 #define QT_COMM 2 @@ -62,6 +63,11 @@ #define ST_REGEX 1 // 0 #define ST_PHRASE 2 // -1 #define ST_MULTIWORD 3 // -2 +#define ST_ENTRYATTRIB 4 // -3 +#define ST_CLUCENE 5 // -4 +#define ST_MULTILEMMA 6 // -5 + + using namespace std; diff --git a/utilities/diatheke/diatheke.cpp b/utilities/diatheke/diatheke.cpp index 159e3a5..1649169 100644 --- a/utilities/diatheke/diatheke.cpp +++ b/utilities/diatheke/diatheke.cpp @@ -2,9 +2,9 @@ * * diatheke.cpp - * - * $Id: diatheke.cpp 2903 2013-07-16 11:11:18Z chrislit $ + * $Id: diatheke.cpp 3170 2014-04-17 04:14:38Z greg.hellings $ * - * Copyright 1999-2013 CrossWire Bible Society (http://www.crosswire.org) + * Copyright 1999-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -21,7 +21,7 @@ */ /****************************************************************************** - * Diatheke 4.6 by Chris Little <chrislit@crosswire.org> + * Diatheke 4.7 by Chris Little <chrislit@crosswire.org> * http://www.crosswire.org/sword/diatheke */ @@ -37,8 +37,8 @@ using std::cout; void printsyntax() { //if we got this far without exiting, something went wrong, so print syntax - fprintf (stderr, "Diatheke command-line SWORD frontend Version 4.6\n"); - fprintf (stderr, "Copyright 1999-2013 by the CrossWire Bible Society\n"); + fprintf (stderr, "Diatheke command-line SWORD frontend Version 4.7\n"); + fprintf (stderr, "Copyright 1999-2014 by the CrossWire Bible Society\n"); fprintf (stderr, "http://www.crosswire.org/sword/diatheke/\n"); fprintf (stderr, "\n"); fprintf (stderr, "usage: diatheke <-b module_name> [-s search_type] [-r search_range]\n"); @@ -49,8 +49,9 @@ void printsyntax() { fprintf (stderr, "If <book> is \"system\" you may use these system keys: \"modulelist\",\n"); fprintf (stderr, "\"modulelistnames\", and \"localelist\"."); fprintf (stderr, "\n"); - fprintf (stderr, "Valid search_type values are: regex, multiword, and phrase(def).\n"); - fprintf (stderr, "Valid option_filters values are: n (Strong's numbers),\n"); + fprintf (stderr, "Valid search_type values are: phrase (default), regex, multiword,\n"); + fprintf (stderr, " attribute, lucene, multilemma.\n"); + fprintf (stderr, "Valid (output) option_filters values are: n (Strong's numbers),\n"); fprintf (stderr, " f (Footnotes), m (Morphology), h (Section Headings),\n"); fprintf (stderr, " c (Cantillation), v (Hebrew Vowels), a (Greek Accents), p (Arabic Vowels)\n"); fprintf (stderr, " l (Lemmas), s (Scripture Crossrefs), r (Arabic Shaping),\n"); @@ -70,6 +71,8 @@ void printsyntax() { fprintf (stderr, " diatheke -b KJV -o fmnx -k Jn 3:16\n"); fprintf (stderr, " diatheke -b WHNU -t Latin -o mn -k Mt 24\n"); fprintf (stderr, " diatheke -b KJV -s phrase -r Mt -k love\n"); + + exit(EXIT_FAILURE); } int main(int argc, char **argv) @@ -94,19 +97,30 @@ int main(int argc, char **argv) } else if (!::stricmp("-s", argv[i])) { if (i+1 <= argc) { - if (!::stricmp("phrase", argv[i+1])) { + i++; + if (!::stricmp("phrase", argv[i])) { searchtype = ST_PHRASE; - i++; } - else if (!::stricmp("regex", argv[i+1])) { + else if (!::stricmp("regex", argv[i])) { searchtype = ST_REGEX; - i++; } - else if (!::stricmp("multiword", argv[i+1])) { + else if (!::stricmp("multiword", argv[i])) { searchtype = ST_MULTIWORD; - i++; } - else i++; + else if (!::stricmp("lucene", argv[i])) { + searchtype = ST_CLUCENE; + } + else if (!::stricmp("attribute", argv[i])) { + searchtype = ST_ENTRYATTRIB; + } + else if (!::stricmp("multilemma", argv[i])) { + searchtype = ST_MULTILEMMA; + } + else { + fprintf (stderr, "Unknown search_type: %s\n", argv[i]); + fprintf (stderr, "Try diatheke --help\n"); + return 0; + } } } else if (!::stricmp("-r", argv[i])) { @@ -233,8 +247,11 @@ int main(int argc, char **argv) if (i < argc) { SWBuf key = argv[i]; i++; - for (; i < argc; i++) + for (; i < argc; i++) { + if (!::stricmp("-h", argv[i]) || !::stricmp("--help", argv[i])) + printsyntax(); key = key + " " + argv[i]; + } ref = new char[key.length() + 1]; strcpy (ref, key.c_str()); if (strlen(ref)) @@ -257,12 +274,18 @@ int main(int argc, char **argv) } } */ + else { + // unexpected argument, so print the syntax + // -h, --help, /?, etc. will trigger this + printsyntax(); + } } if (runquery == (RQ_BOOK | RQ_REF)) { doquery(maxverses, outputformat, outputencoding, optionfilters, searchtype, range, text, locale, ref, &cout, script, variants); } + //if we got this far without exiting, something went wrong, so print syntax else printsyntax(); return 0; diff --git a/utilities/diatheke/diathekemgr.cpp b/utilities/diatheke/diathekemgr.cpp index a64b570..aa79fcf 100644 --- a/utilities/diatheke/diathekemgr.cpp +++ b/utilities/diatheke/diathekemgr.cpp @@ -2,7 +2,7 @@ * * diathekemgr.cpp - DiathekeMgr * - * $Id: diathekemgr.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: diathekemgr.cpp 3167 2014-04-17 04:12:12Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -76,13 +76,14 @@ DiathekeMgr::~DiathekeMgr() void DiathekeMgr::AddRenderFilters(SWModule *module, ConfigEntMap §ion) { SWBuf lang; - bool rtl; ConfigEntMap::iterator entry; lang = ((entry = section.find("Lang")) != section.end()) ? (*entry).second : (SWBuf)"en"; - rtl = ((entry = section.find("Direction")) != section.end()) ? ((*entry).second == "RtoL") : false; #ifdef _ICU_ + bool rtl; + rtl = ((entry = section.find("Direction")) != section.end()) ? ((*entry).second == "RtoL") : false; + if (shape) { module->addRenderFilter(arshaping); } |