[sword-svn] r3109 - trunk/utilities/diatheke

chrislit at crosswire.org chrislit at crosswire.org
Wed Mar 12 03:24:27 MST 2014


Author: chrislit
Date: 2014-03-12 03:24:27 -0700 (Wed, 12 Mar 2014)
New Revision: 3109

Modified:
   trunk/utilities/diatheke/diafiltmgr.cpp
   trunk/utilities/diatheke/diafiltmgr.h
   trunk/utilities/diatheke/diatheke.cpp
Log:
updated diatheke encoding & markup filters--many of the markup options had been broken


Modified: trunk/utilities/diatheke/diafiltmgr.cpp
===================================================================
--- trunk/utilities/diatheke/diafiltmgr.cpp	2014-03-12 08:35:50 UTC (rev 3108)
+++ trunk/utilities/diatheke/diafiltmgr.cpp	2014-03-12 10:24:27 UTC (rev 3109)
@@ -20,27 +20,42 @@
  *
  */
 
+#include <swmgr.h>
+#include <swmodule.h>
+
 #include <thmlplain.h>
+#include <thmlgbf.h>
+#include <thmlosis.h>
+#include <thmlhtml.h>
+#include <thmlhtmlhref.h>
+#include <thmlxhtml.h>
+#include <thmllatex.h>
+#include <thmlrtf.h>
+#include <thmlwebif.h>
+
 #include <gbfplain.h>
-#include <thmlgbf.h>
 #include <gbfthml.h>
-#include <thmlhtml.h>
+#include <gbfosis.h>
 #include <gbfhtml.h>
-#include <thmlhtmlhref.h>
 #include <gbfhtmlhref.h>
-#include <thmlrtf.h>
+#include <gbfxhtml.h>
+#include <gbflatex.h>
 #include <gbfrtf.h>
+#include <gbfwebif.h>
+
+#include <osisplain.h>
+#include <osisosis.h>
 #include <osisrtf.h>
 #include <osishtmlhref.h>
+#include <osisxhtml.h>
 #include <osislatex.h>
-#include <gbflatex.h>
-#include <thmllatex.h>
-#include <swmodule.h>
-#include <osisplain.h>
-#include <thmlosis.h>
-#include <gbfosis.h>
+#include <osiswebif.h>
 
-#include <swmgr.h>
+#include <teiplain.h>
+#include <teirtf.h>
+#include <teihtmlhref.h>
+#include <teixhtml.h>
+#include <teilatex.h>
 
 #include "diafiltmgr.h"
 #include "thmlcgi.h"
@@ -64,6 +79,8 @@
                 delete (fromplain);
         if (fromosis)
                 delete (fromosis);
+        if (fromtei)
+                delete (fromtei);
 }
 
 void DiathekeFilterMgr::AddRenderFilters(SWModule *module, ConfigEntMap &section) {
@@ -84,6 +101,10 @@
                 if (fromosis)
                         module->addRenderFilter(fromosis);
                 break;
+        case FMT_TEI:
+                if (fromtei)
+                        module->addRenderFilter(fromtei);
+                break;
         }
 	EncodingFilterMgr::AddRenderFilters(module, section);
 }
@@ -98,6 +119,7 @@
                 SWFilter * oldthml = fromthml;
                 SWFilter * oldgbf = fromgbf;
                 SWFilter * oldosis = fromosis;
+                SWFilter * oldtei = fromtei;
 
                 CreateFilters(markup);
 
@@ -163,6 +185,21 @@
                                         }
                                         break;
                                 }
+                        case FMT_TEI:
+                                if (oldtei != fromtei) {
+                                        if (oldtei) {
+                                                if (!fromtei) {
+                                                        module->second->removeRenderFilter(oldtei);
+                                                }
+                                                else {
+                                                        module->second->replaceRenderFilter(oldtei, fromtei);
+                                                }
+                                        }
+                                        else if (fromtei) {
+                                                module->second->addRenderFilter(fromtei);
+                                        }
+                                        break;
+                                }
                         }
 
                 if (oldthml)
@@ -173,6 +210,8 @@
                         delete oldplain;
                 if (oldosis)
                         delete oldosis;
+                if (oldtei)
+                        delete oldtei;
         }
         return markup;
 }
@@ -180,60 +219,101 @@
 void DiathekeFilterMgr::CreateFilters(char markup) {
 
                 switch (markup) {
-				case FMT_CGI:
-						fromplain = NULL;
-						fromthml = new ThMLCGI();
-						fromgbf = new GBFCGI();
-						fromosis = new OSISCGI();
-						break;
-                case FMT_PLAIN:
-                        fromplain = NULL;
-                        fromthml = new ThMLPlain();
-                        fromgbf = new GBFPlain();
-                        fromosis = new OSISPlain();
-                        break;
-                case FMT_THML:
-                        fromplain = NULL;
-                        fromthml = NULL;
-                        fromgbf = new GBFThML();
-                        fromosis = NULL;
-                        break;
-                case FMT_GBF:
-                        fromplain = NULL;
-                        fromthml = new ThMLGBF();
-                        fromgbf = NULL;
-                        fromosis = NULL;
-                        break;
-                case FMT_HTML:
-                        fromplain = NULL;
-                        fromthml = new ThMLHTML();
-                        fromgbf = new GBFHTML();
-                        fromosis = NULL;
-                        break;
-                case FMT_HTMLHREF:
-                        fromplain = NULL;
-                        fromthml = new ThMLHTMLHREF();
-                        fromgbf = new GBFHTMLHREF();
-                        fromosis = new OSISHTMLHREF();
-                        break;
-                case FMT_LATEX:
-                        fromplain = NULL;
-                        fromthml = new ThMLLaTeX();
-                        fromgbf = new GBFLaTeX();
-                        fromosis = new OSISLaTeX();
-                        break;
-                case FMT_RTF:
-                        fromplain = NULL;
-                        fromthml = new ThMLRTF();
-                        fromgbf = new GBFRTF();
-                        fromosis = new OSISRTF();
-                        break;
-                case FMT_OSIS:
-                        fromplain = NULL;
-                        fromthml = new ThMLOSIS();
-                        fromgbf = new GBFOSIS();
-                        fromosis = NULL;
-                        break;
+		case FMT_CGI:
+			fromplain = NULL;
+			fromthml = new ThMLCGI();
+			fromgbf = new GBFCGI();
+			fromosis = new OSISCGI();
+			fromtei = NULL; // TODO: write TEICGI()
+			break;
+
+		case FMT_PLAIN:
+			fromplain = NULL;
+			fromthml  = new ThMLPlain();
+			fromgbf   = new GBFPlain();
+			fromosis  = new OSISPlain();
+			fromtei   = new TEIPlain();
+			break;
+			
+		case FMT_THML:
+			fromplain = NULL;
+			fromthml  = NULL;
+			fromgbf   = new GBFThML();
+			fromosis  = NULL;
+			fromtei   = NULL;
+			break;
+			
+		case FMT_GBF:
+			fromplain = NULL;
+			fromthml  = new ThMLGBF();
+			fromgbf   = NULL;
+			fromosis  = NULL;
+			fromtei   = NULL;
+			break;
+			
+		case FMT_HTML:
+			fromplain = NULL;
+			fromthml  = new ThMLHTML();
+			fromgbf   = new GBFHTML();
+			fromosis  = NULL;
+			fromtei   = NULL;
+			break;
+			
+		case FMT_HTMLHREF:
+			fromplain = NULL;
+			fromthml  = new ThMLHTMLHREF();
+			fromgbf   = new GBFHTMLHREF();
+			fromosis  = new OSISHTMLHREF();
+			fromtei   = new TEIHTMLHREF();
+			break;
+			
+		case FMT_RTF:
+			fromplain = NULL;
+			fromthml  = new ThMLRTF();
+			fromgbf   = new GBFRTF();
+			fromosis  = new OSISRTF();
+			fromtei   = new TEIRTF();
+			break;
+			
+		case FMT_LATEX:
+			fromplain = NULL;
+			fromthml  = new ThMLLaTeX();
+			fromgbf   = new GBFLaTeX();
+			fromosis  = new OSISLaTeX();
+			fromtei   = new TEILaTeX();
+			break;
+			
+		case FMT_OSIS:
+			fromplain = NULL;
+			fromthml  = new ThMLOSIS();
+			fromgbf   = new GBFOSIS();
+			fromosis  = new OSISOSIS();
+			fromtei   = NULL;
+			break;
+			
+		case FMT_WEBIF:
+			fromplain = NULL;
+			fromthml  = new ThMLWEBIF();
+			fromgbf   = new GBFWEBIF();
+			fromosis  = new OSISWEBIF();
+			fromtei   = NULL;
+			break;
+			
+		case FMT_TEI:
+			fromplain = NULL;
+			fromthml  = NULL;
+			fromgbf   = NULL;
+			fromosis  = NULL;
+			fromtei   = NULL;
+			break;
+			
+		case FMT_XHTML:
+			fromplain = NULL;
+			fromthml  = new ThMLXHTML();
+			fromgbf   = new GBFXHTML();
+			fromosis  = new OSISXHTML();
+			fromtei   = new TEIXHTML();
+			break;
                 }
 
 }

Modified: trunk/utilities/diatheke/diafiltmgr.h
===================================================================
--- trunk/utilities/diatheke/diafiltmgr.h	2014-03-12 08:35:50 UTC (rev 3108)
+++ trunk/utilities/diatheke/diafiltmgr.h	2014-03-12 10:24:27 UTC (rev 3109)
@@ -37,6 +37,7 @@
         SWFilter* fromgbf;
         SWFilter* fromplain;
         SWFilter* fromosis;
+        SWFilter* fromtei;
 
         char markup;
 

Modified: trunk/utilities/diatheke/diatheke.cpp
===================================================================
--- trunk/utilities/diatheke/diatheke.cpp	2014-03-12 08:35:50 UTC (rev 3108)
+++ trunk/utilities/diatheke/diatheke.cpp	2014-03-12 10:24:27 UTC (rev 3109)
@@ -61,9 +61,10 @@
 
 	fprintf (stderr, "Maximum verses may be any integer value\n");
 	fprintf (stderr, "Valid output_format values are: CGI, GBF, HTML, HTMLHREF, LaTeX, OSIS, RTF,\n");
- 	fprintf (stderr, "  ThML, XHTML, and plain (def)\n");
- 	fprintf (stderr, "The option LaTeX will produce a compilable document, but may well require tweaking to be usable.\n");
-	fprintf (stderr, "Valid output_encoding values are: Latin1, UTF8 (def), UTF16, HTML, and RTF\n");
+ 	fprintf (stderr, "  ThML, WEBIF, XHTML, and plain (def)\n");
+ 	fprintf (stderr, "The option LaTeX will produce a compilable document, but may well require\n");
+	fprintf (stderr, "  tweaking to be usable.\n");
+	fprintf (stderr, "Valid output_encoding values are: Latin1, UTF8 (def), UTF16, HTML, RTF, and SCSU\n");
 	fprintf (stderr, "Valid locale values depend on installed locales. en is default.\n");
 	fprintf (stderr, "The query_key must be the last argument because all following\n");
 	fprintf (stderr, "  arguments are added to the key.\n");
@@ -183,66 +184,61 @@
 			if (i+1 <= argc) {
 				if (!::stricmp("thml", argv[i+1])) {
 					outputformat = FMT_THML;
-					i++;
 				}
 				else if (!::stricmp("cgi", argv[i+1])) {
 					outputformat = FMT_CGI;
-					i++;
 				}
 				else if (!::stricmp("gbf", argv[i+1])) {
 					outputformat = FMT_GBF;
-					i++;
 				}
 				else if (!::stricmp("htmlhref", argv[i+1])) {
 					outputformat = FMT_HTMLHREF;
-					i++;
 				}
 				else if (!::stricmp("html", argv[i+1])) {
 					outputformat = FMT_HTML;
-					i++;
 				}
 				else if (!::stricmp("xhtml", argv[i+1])) {
 					outputformat = FMT_XHTML;
-					i++;
 				}
 				else if (!::stricmp("rtf", argv[i+1])) {
 					outputformat = FMT_RTF;
-					i++;
 				}
 				else if (!::stricmp("osis", argv[i+1])) {
 					outputformat = FMT_OSIS;
-					i++;
 				}
 				else if (!::stricmp("latex", argv[i+1])) {
 					outputformat = FMT_LATEX;
-					i++;
 				}
-				else i++;
+				else if (!::stricmp("plain", argv[i+1])) {
+					outputformat = FMT_PLAIN;
+				}
+				else if (!::stricmp("webif", argv[i+1])) {
+					outputformat = FMT_WEBIF;
+				}
+				i++;
 			}
 		}
 		else if (!::stricmp("-e", argv[i])) {
 			if (i+1 <= argc) {
 				if (!::stricmp("utf8", argv[i+1])) {
 					outputencoding = ENC_UTF8;
-					i++;
 				}
 				else if (!::stricmp("rtf", argv[i+1])) {
 					outputencoding = ENC_RTF;
-					i++;
 				}
 				else if (!::stricmp("html", argv[i+1])) {
 					outputencoding = ENC_HTML;
-					i++;
 				}
 				else if (!::stricmp("latin1", argv[i+1])) {
 					outputencoding = ENC_LATIN1;
-					i++;
 				}
 				else if (!::stricmp("utf16", argv[i+1])) {
 					outputencoding = ENC_UTF16;
-					i++;
 				}
-				else i++;
+				else if (!::stricmp("scsu", argv[i+1])) {
+					outputencoding = ENC_SCSU;
+				}
+				i++;
 			}
 		}
 		else if (!::stricmp("-k", argv[i])) {




More information about the sword-cvs mailing list