summaryrefslogtreecommitdiff
path: root/src/modules/filters
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:54:01 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:54:01 -0400
commit71a39f4652cd51df814c930dd268f3c9ad2aee86 (patch)
tree5994350a603908c4e4d660bc9d72c4ec43dd648e /src/modules/filters
parent03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (diff)
Imported Upstream version 1.6.0+dfsg
Diffstat (limited to 'src/modules/filters')
-rw-r--r--src/modules/filters/Makefile.am3
-rw-r--r--src/modules/filters/cipherfil.cpp15
-rw-r--r--src/modules/filters/gbffootnotes.cpp28
-rw-r--r--src/modules/filters/gbfheadings.cpp16
-rw-r--r--src/modules/filters/gbfhtml.cpp34
-rw-r--r--src/modules/filters/gbfhtmlhref.cpp37
-rw-r--r--src/modules/filters/gbfmorph.cpp17
-rw-r--r--src/modules/filters/gbfosis.cpp58
-rw-r--r--src/modules/filters/gbfplain.cpp17
-rw-r--r--src/modules/filters/gbfredletterwords.cpp17
-rw-r--r--src/modules/filters/gbfrtf.cpp17
-rw-r--r--src/modules/filters/gbfstrongs.cpp17
-rw-r--r--src/modules/filters/gbfthml.cpp34
-rw-r--r--src/modules/filters/gbfwebif.cpp35
-rw-r--r--src/modules/filters/gbfwordjs.cpp17
-rw-r--r--src/modules/filters/greeklexattribs.cpp17
-rw-r--r--src/modules/filters/latin1utf16.cpp19
-rw-r--r--src/modules/filters/latin1utf8.cpp17
-rw-r--r--src/modules/filters/osisfootnotes.cpp46
-rw-r--r--src/modules/filters/osisheadings.cpp57
-rw-r--r--src/modules/filters/osishtmlhref.cpp165
-rw-r--r--src/modules/filters/osislemma.cpp17
-rw-r--r--src/modules/filters/osismorph.cpp17
-rw-r--r--src/modules/filters/osismorphsegmentation.cpp17
-rw-r--r--src/modules/filters/osisosis.cpp68
-rw-r--r--src/modules/filters/osisplain.cpp71
-rw-r--r--src/modules/filters/osisredletterwords.cpp17
-rw-r--r--src/modules/filters/osisrtf.cpp83
-rw-r--r--src/modules/filters/osisruby.cpp93
-rw-r--r--src/modules/filters/osisscripref.cpp17
-rw-r--r--src/modules/filters/osisstrongs.cpp42
-rw-r--r--src/modules/filters/osisvariants.cpp17
-rw-r--r--src/modules/filters/osiswebif.cpp44
-rw-r--r--src/modules/filters/osiswordjs.cpp22
-rw-r--r--src/modules/filters/papyriplain.cpp17
-rw-r--r--src/modules/filters/plainfootnotes.cpp36
-rw-r--r--src/modules/filters/plainhtml.cpp36
-rw-r--r--src/modules/filters/rtfhtml.cpp36
-rw-r--r--src/modules/filters/scsuutf8.cpp226
-rw-r--r--src/modules/filters/swoptfilter.cpp19
-rw-r--r--src/modules/filters/teihtmlhref.cpp100
-rw-r--r--src/modules/filters/teiplain.cpp34
-rw-r--r--src/modules/filters/teirtf.cpp58
-rw-r--r--src/modules/filters/thmlfootnotes.cpp28
-rw-r--r--src/modules/filters/thmlgbf.cpp35
-rw-r--r--src/modules/filters/thmlheadings.cpp17
-rw-r--r--src/modules/filters/thmlhtml.cpp35
-rw-r--r--src/modules/filters/thmlhtmlhref.cpp38
-rw-r--r--src/modules/filters/thmllemma.cpp17
-rw-r--r--src/modules/filters/thmlmorph.cpp17
-rw-r--r--src/modules/filters/thmlosis.cpp48
-rw-r--r--src/modules/filters/thmlplain.cpp213
-rw-r--r--src/modules/filters/thmlrtf.cpp35
-rw-r--r--src/modules/filters/thmlscripref.cpp30
-rw-r--r--src/modules/filters/thmlstrongs.cpp17
-rw-r--r--src/modules/filters/thmlvariants.cpp17
-rw-r--r--src/modules/filters/thmlwebif.cpp35
-rw-r--r--src/modules/filters/thmlwordjs.cpp17
-rw-r--r--src/modules/filters/unicodertf.cpp17
-rw-r--r--src/modules/filters/utf16utf8.cpp17
-rw-r--r--src/modules/filters/utf8arabicpoints.cpp61
-rw-r--r--src/modules/filters/utf8arshaping.cpp24
-rw-r--r--src/modules/filters/utf8bidireorder.cpp24
-rw-r--r--src/modules/filters/utf8cantillation.cpp17
-rw-r--r--src/modules/filters/utf8greekaccents.cpp17
-rw-r--r--src/modules/filters/utf8hebrewpoints.cpp17
-rw-r--r--src/modules/filters/utf8html.cpp17
-rw-r--r--src/modules/filters/utf8latin1.cpp16
-rw-r--r--src/modules/filters/utf8nfc.cpp24
-rw-r--r--src/modules/filters/utf8nfkd.cpp24
-rw-r--r--src/modules/filters/utf8transliterator.cpp158
-rw-r--r--src/modules/filters/utf8utf16.cpp79
72 files changed, 1954 insertions, 927 deletions
diff --git a/src/modules/filters/Makefile.am b/src/modules/filters/Makefile.am
index 7092c73..f212cbf 100644
--- a/src/modules/filters/Makefile.am
+++ b/src/modules/filters/Makefile.am
@@ -53,17 +53,18 @@ OSISFIL += $(filtersdir)/osisscripref.cpp
OSISFIL += $(filtersdir)/osisvariants.cpp
OSISFIL += $(filtersdir)/osiswordjs.cpp
OSISFIL += $(filtersdir)/osismorphsegmentation.cpp
+OSISFIL += $(filtersdir)/osisruby.cpp
libsword_la_SOURCES += $(filtersdir)/latin1utf8.cpp
libsword_la_SOURCES += $(filtersdir)/latin1utf16.cpp
libsword_la_SOURCES += $(filtersdir)/utf8utf16.cpp
libsword_la_SOURCES += $(filtersdir)/utf16utf8.cpp
-libsword_la_SOURCES += $(filtersdir)/scsuutf8.cpp
libsword_la_SOURCES += $(filtersdir)/utf8html.cpp
libsword_la_SOURCES += $(filtersdir)/utf8latin1.cpp
libsword_la_SOURCES += $(filtersdir)/utf8cantillation.cpp
libsword_la_SOURCES += $(filtersdir)/utf8hebrewpoints.cpp
+libsword_la_SOURCES += $(filtersdir)/utf8arabicpoints.cpp
libsword_la_SOURCES += $(filtersdir)/utf8greekaccents.cpp
libsword_la_SOURCES += $(filtersdir)/cipherfil.cpp
diff --git a/src/modules/filters/cipherfil.cpp b/src/modules/filters/cipherfil.cpp
index 24c665e..34d0465 100644
--- a/src/modules/filters/cipherfil.cpp
+++ b/src/modules/filters/cipherfil.cpp
@@ -1,6 +1,21 @@
/******************************************************************************
*
* cipherfil - SWFilter descendant to decipher a module
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
diff --git a/src/modules/filters/gbffootnotes.cpp b/src/modules/filters/gbffootnotes.cpp
index bef29b8..a5384cb 100644
--- a/src/modules/filters/gbffootnotes.cpp
+++ b/src/modules/filters/gbffootnotes.cpp
@@ -2,6 +2,21 @@
*
* gbffootnotes - SWFilter descendant to hide or show footnotes
* in a GBF module.
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
@@ -33,7 +48,7 @@ GBFFootnotes::~GBFFootnotes() {
char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *module)
{
-
+
SWBuf token;
bool intoken = false;
bool hide = false;
@@ -42,11 +57,10 @@ char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *m
SWBuf refs = "";
int footnoteNum = 1;
char buf[254];
- VerseKey parser = key->getText();
SWBuf orig = text;
const char *from = orig.c_str();
-
+
//XMLTag tag;
for (text = ""; *from; from++) {
@@ -61,7 +75,7 @@ char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *m
//XMLTag tag(token);
if (!strncmp(token, "RF",2)) {
// tag = token;
-
+
refs = "";
startTag = token;
hide = true;
@@ -71,7 +85,7 @@ char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *m
else if (!strncmp(token, "Rf",2)) {
if (module->isProcessEntryAttributes()) {
//tag = token;
-
+
if((tagText.length() == 1) || !strcmp(module->Name(), "IGNT")) {
if (option) { // for ASV marks text in verse then put explanation at end of verse
text.append(" <FS>[");
@@ -93,7 +107,7 @@ char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *m
startTag.setAttribute("swordFootnote", buf);
}
hide = false;
- if (option) {
+ if (option) {
text.append(startTag);
text.append(tagText);
}
@@ -120,7 +134,7 @@ char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *m
else tagText.append(*from);
}
return 0;
-
+
/*
if (!option) { // if we don't want footnotes
char token[4096]; // cheese. Fix.
diff --git a/src/modules/filters/gbfheadings.cpp b/src/modules/filters/gbfheadings.cpp
index 81a4d94..122445e 100644
--- a/src/modules/filters/gbfheadings.cpp
+++ b/src/modules/filters/gbfheadings.cpp
@@ -2,9 +2,23 @@
*
* gbfheadings - SWFilter descendant to hide or show headings
* in a GBF module.
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <gbfheadings.h>
diff --git a/src/modules/filters/gbfhtml.cpp b/src/modules/filters/gbfhtml.cpp
index a9d8434..2467e36 100644
--- a/src/modules/filters/gbfhtml.cpp
+++ b/src/modules/filters/gbfhtml.cpp
@@ -1,18 +1,24 @@
/***************************************************************************
- gbfhtml.cpp - GBF to HTML filter
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * gbfhtml.cpp - GBF to HTML filter
+ * -------------------
+ * begin : 2001-09-03
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <gbfhtml.h>
diff --git a/src/modules/filters/gbfhtmlhref.cpp b/src/modules/filters/gbfhtmlhref.cpp
index 7f1c254..b4cdde0 100644
--- a/src/modules/filters/gbfhtmlhref.cpp
+++ b/src/modules/filters/gbfhtmlhref.cpp
@@ -1,20 +1,27 @@
/***************************************************************************
- gbfhtmlhref.cpp - GBF to HTML filter with hrefs
- for strongs and morph tags
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * gbfhtmlhref.cpp - GBF to HTML filter with hrefs
+ * for strongs and morph tags
+ * -------------------
+ * begin : 2001-09-03
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
#include <stdlib.h>
#include <gbfhtmlhref.h>
#include <swmodule.h>
diff --git a/src/modules/filters/gbfmorph.cpp b/src/modules/filters/gbfmorph.cpp
index 5226db7..d7c8ab4 100644
--- a/src/modules/filters/gbfmorph.cpp
+++ b/src/modules/filters/gbfmorph.cpp
@@ -2,9 +2,24 @@
*
* gbfmorph - SWFilter descendant to hide or show morph tags
* in a GBF module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <gbfmorph.h>
diff --git a/src/modules/filters/gbfosis.cpp b/src/modules/filters/gbfosis.cpp
index 00443f9..526167a 100644
--- a/src/modules/filters/gbfosis.cpp
+++ b/src/modules/filters/gbfosis.cpp
@@ -2,9 +2,24 @@
*
* gbfstrongs - SWFilter descendant to hide or show strongs number
* in a GBF module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -317,10 +332,10 @@ char GBFOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module)
newWord = false;
//fix this if required?
- //memset(to, 0, 10);
-
+ //memset(to, 0, 10);
+
}
-
+
if (!suspendTextPassThru) {
text += (*from);
lastspace = (*from == ' ');
@@ -335,29 +350,29 @@ char GBFOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module)
if (vkey->Verse()) {
ref.appendFormatted("\t\t<verse osisID=\"%s\">", vkey->getOSISRef());
}
-
+
if (ref.length() > 0) {
-
+
text = ref + text;
-
+
if (vkey->Verse()) {
- VerseKey tmp;
- tmp = *vkey;
- tmp.AutoNormalize(0);
- tmp.Headings(1);
-
+ VerseKey *tmp = (VerseKey *)vkey->clone();
+ *tmp = *vkey;
+ tmp->AutoNormalize(0);
+ tmp->Headings(1);
+
text += "</verse>";
-
- tmp = MAXVERSE;
- if (*vkey == tmp) {
- tmp.Verse(0);
+
+ *tmp = MAXVERSE;
+ if (*vkey == *tmp) {
+ tmp->Verse(0);
// sprintf(ref, "\t</div>");
// pushString(&to, ref);
- tmp = MAXCHAPTER;
- tmp = MAXVERSE;
- if (*vkey == tmp) {
- tmp.Chapter(0);
- tmp.Verse(0);
+ *tmp = MAXCHAPTER;
+ *tmp = MAXVERSE;
+ if (*vkey == *tmp) {
+ tmp->Chapter(0);
+ tmp->Verse(0);
// sprintf(ref, "\t</div>");
// pushString(&to, ref);
/*
@@ -368,6 +383,7 @@ char GBFOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module)
*/
}
}
+ delete tmp;
}
// else if (vkey->Chapter()) {
// sprintf(ref, "\t<div type=\"chapter\" osisID=\"%s\">", vkey->getOSISRef());
diff --git a/src/modules/filters/gbfplain.cpp b/src/modules/filters/gbfplain.cpp
index 5657e20..e90bf94 100644
--- a/src/modules/filters/gbfplain.cpp
+++ b/src/modules/filters/gbfplain.cpp
@@ -2,9 +2,24 @@
*
* gbfplain - SWFilter descendant to strip out all GBF tags or convert to
* ASCII rendered symbols.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <gbfplain.h>
#include <swbuf.h>
diff --git a/src/modules/filters/gbfredletterwords.cpp b/src/modules/filters/gbfredletterwords.cpp
index a79802d..7397781 100644
--- a/src/modules/filters/gbfredletterwords.cpp
+++ b/src/modules/filters/gbfredletterwords.cpp
@@ -2,9 +2,24 @@
*
* GBFRedLetterWords - SWFilter descendant to toggle red coloring of words of
* Christ in a GBF module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <gbfredletterwords.h>
#include <swmodule.h>
diff --git a/src/modules/filters/gbfrtf.cpp b/src/modules/filters/gbfrtf.cpp
index eb39612..7471d0b 100644
--- a/src/modules/filters/gbfrtf.cpp
+++ b/src/modules/filters/gbfrtf.cpp
@@ -1,9 +1,24 @@
/******************************************************************************
*
* gbfrtf - SWFilter descendant to convert all GBF tags to RTF tags
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <gbfrtf.h>
#include <utilstr.h>
#include <ctype.h>
diff --git a/src/modules/filters/gbfstrongs.cpp b/src/modules/filters/gbfstrongs.cpp
index 610edb5..c7cf6c5 100644
--- a/src/modules/filters/gbfstrongs.cpp
+++ b/src/modules/filters/gbfstrongs.cpp
@@ -2,9 +2,24 @@
*
* gbfstrongs - SWFilter descendant to hide or show strongs number
* in a GBF module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <gbfstrongs.h>
diff --git a/src/modules/filters/gbfthml.cpp b/src/modules/filters/gbfthml.cpp
index 2664f48..4feb1fa 100644
--- a/src/modules/filters/gbfthml.cpp
+++ b/src/modules/filters/gbfthml.cpp
@@ -1,18 +1,24 @@
/***************************************************************************
- gbfthml.cpp - GBF to ThML filter
- -------------------
- begin : 1999-10-27
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * gbfthml.cpp - GBF to ThML filter
+ * -------------------
+ * begin : 1999-10-27
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <gbfthml.h>
diff --git a/src/modules/filters/gbfwebif.cpp b/src/modules/filters/gbfwebif.cpp
index e651db6..b5ff798 100644
--- a/src/modules/filters/gbfwebif.cpp
+++ b/src/modules/filters/gbfwebif.cpp
@@ -1,19 +1,26 @@
/***************************************************************************
- GBFWEBIF.cpp - GBF to HTML filter with hrefs
- for strongs and morph tags
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
+ * GBFWEBIF.cpp - GBF to HTML filter with hrefs
+ * for strongs and morph tags
+ * -------------------
+ * begin : 2001-09-03
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
#include <gbfwebif.h>
#include <ctype.h>
diff --git a/src/modules/filters/gbfwordjs.cpp b/src/modules/filters/gbfwordjs.cpp
index f81ffac..c3ab166 100644
--- a/src/modules/filters/gbfwordjs.cpp
+++ b/src/modules/filters/gbfwordjs.cpp
@@ -2,9 +2,24 @@
*
* gbfstrongs - SWFilter descendant to hide or show strongs number
* in a GBF module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <gbfwordjs.h>
diff --git a/src/modules/filters/greeklexattribs.cpp b/src/modules/filters/greeklexattribs.cpp
index 1e82305..e1a60a2 100644
--- a/src/modules/filters/greeklexattribs.cpp
+++ b/src/modules/filters/greeklexattribs.cpp
@@ -2,9 +2,24 @@
*
* greeklexattribs - SWFilter descendant to set entry attributes for greek
* lexicons
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
diff --git a/src/modules/filters/latin1utf16.cpp b/src/modules/filters/latin1utf16.cpp
index 1392750..bf2f3f8 100644
--- a/src/modules/filters/latin1utf16.cpp
+++ b/src/modules/filters/latin1utf16.cpp
@@ -1,10 +1,25 @@
/******************************************************************************
*
- * Latin1UTF16 - SWFilter descendant to convert a Latin-1 character to UTF-16
+ * Latin1UTF16 - SWFilter descendant to convert a Latin-1 character to UTF-16
+ *
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
*
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <latin1utf16.h>
diff --git a/src/modules/filters/latin1utf8.cpp b/src/modules/filters/latin1utf8.cpp
index 6c0d7f1..784aafe 100644
--- a/src/modules/filters/latin1utf8.cpp
+++ b/src/modules/filters/latin1utf8.cpp
@@ -2,9 +2,24 @@
*
* Latin1UTF8 - SWFilter descendant to convert a Latin-1 character to UTF-8
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <latin1utf8.h>
diff --git a/src/modules/filters/osisfootnotes.cpp b/src/modules/filters/osisfootnotes.cpp
index 89c9c40..3d0d2d4 100644
--- a/src/modules/filters/osisfootnotes.cpp
+++ b/src/modules/filters/osisfootnotes.cpp
@@ -2,9 +2,24 @@
*
* osisfootnotes - SWFilter descendant to hide or show footnotes
* in an OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <osisfootnotes.h>
@@ -41,11 +56,17 @@ char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
SWBuf refs = "";
int footnoteNum = 1;
char buf[254];
- VerseKey parser(key->getText());
+ SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey();
+ VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+ if (!parser) {
+ delete p;
+ parser = new VerseKey();
+ }
+ *parser = key->getText();
SWBuf orig = text;
const char *from = orig.c_str();
-
+
XMLTag tag;
bool strongsMarkup = false;
@@ -59,20 +80,20 @@ char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
continue;
}
-
+
if (*from == '<') {
intoken = true;
token = "";
continue;
}
-
-
-
+
+
+
if (*from == '>') { // process tokens
- intoken = false;
+ intoken = false;
if (!strncmp(token, "note", 4) || !strncmp(token.c_str(), "/note", 5)) {
tag = token;
-
+
if (!tag.isEndTag()) {
if (tag.getAttribute("type") && (!strcmp("x-strongsMarkup", tag.getAttribute("type"))
|| !strcmp("strongsMarkup", tag.getAttribute("type"))) // deprecated
@@ -80,7 +101,7 @@ char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
tag.setEmpty(false); // handle bug in KJV2003 module where some note open tags were <note ... />
strongsMarkup = true;
}
-
+
if (!tag.isEmpty()) {
// if ((!tag.isEmpty()) || (SWBuf("strongsMarkup") == tag.getAttribute("type"))) {
refs = "";
@@ -101,7 +122,7 @@ char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
startTag.setAttribute("swordFootnote", buf);
if ((startTag.getAttribute("type")) && (!strcmp(startTag.getAttribute("type"), "crossReference"))) {
if (!refs.length())
- refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText();
+ refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText();
module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
}
}
@@ -122,7 +143,7 @@ char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
if (refs.length()) {
refs.append("; ");
}
-
+
const char* attr = strstr(token.c_str() + 9, "osisRef=\"");
const char* end = attr ? strchr(attr+9, '"') : 0;
@@ -150,6 +171,7 @@ char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
}
else tagText.append(*from);
}
+ delete parser;
return 0;
}
diff --git a/src/modules/filters/osisheadings.cpp b/src/modules/filters/osisheadings.cpp
index a072335..8872f24 100644
--- a/src/modules/filters/osisheadings.cpp
+++ b/src/modules/filters/osisheadings.cpp
@@ -2,9 +2,24 @@
*
*osisheadings - SWFilter descendant to hide or show headings
* in an OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <osisheadings.h>
@@ -35,6 +50,9 @@ char OSISHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo
bool hide = false;
bool preverse = false;
bool withinTitle = false;
+ bool withinPreverseDiv = false;
+ SWBuf preverseDivID = "";
+ const char *pvDID = 0;
bool canonical = false;
SWBuf header;
int headerNum = 0;
@@ -56,27 +74,41 @@ char OSISHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo
}
if (*from == '>') { // process tokens
intoken = false;
-
- if (!strncmp(token.c_str(), "title", 5) || !strncmp(token.c_str(), "/title", 6)) {
- withinTitle = (!strnicmp(token.c_str(), "title", 5));
- tag = token;
+ tag = token;
+
+ // <title> </title> <div subType="x-preverse"> (</div> ## when in previous)
+ if ( (!withinPreverseDiv && !strcmp(tag.getName(), "title")) ||
+ (!strcmp(tag.getName(), "div") &&
+ ((withinPreverseDiv && (tag.isEndTag(pvDID))) ||
+ (tag.getAttribute("subType") && !strcmp(tag.getAttribute("subType"), "x-preverse")))
+ )) {
+
+ withinTitle = (!tag.isEndTag(pvDID));
+ if (!strcmp(tag.getName(), "div")) {
+ withinPreverseDiv = (!tag.isEndTag(pvDID));
+ if (!pvDID) {
+ preverseDivID = tag.getAttribute("sID");
+ pvDID = (preverseDivID.length())? preverseDivID.c_str() : 0;
+ }
+ }
- if (!tag.isEndTag()) { //start tag
- if (!tag.isEmpty()) {
+ if (!tag.isEndTag(pvDID)) { //start tag
+ if (!tag.isEmpty() || pvDID) {
startTag = tag;
}
}
- if ( (tag.getAttribute("subType") && !stricmp(tag.getAttribute("subType"), "x-preverse"))
- || (tag.getAttribute("subtype") && !stricmp(tag.getAttribute("subtype"), "x-preverse")) // deprecated
- ) {
+ if ( !tag.isEndTag(pvDID) && (withinPreverseDiv
+ || (tag.getAttribute("subType") && !stricmp(tag.getAttribute("subType"), "x-preverse"))
+ || (tag.getAttribute("subtype") && !stricmp(tag.getAttribute("subtype"), "x-preverse")) // deprecated
+ )) {
hide = true;
preverse = true;
header = "";
canonical = (tag.getAttribute("canonical") && (!stricmp(tag.getAttribute("canonical"), "true")));
continue;
}
- if (!tag.isEndTag()) { //start tag
+ if (!tag.isEndTag(pvDID)) { //start tag
hide = true;
header = "";
if (option || canonical) { // we want the tag in the text
@@ -86,7 +118,7 @@ char OSISHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo
}
continue;
}
- if (hide && tag.isEndTag()) {
+ if (hide && tag.isEndTag(pvDID)) {
if (module->isProcessEntryAttributes() && ((option || canonical) || (!preverse))) {
if (preverse) {
sprintf(buf, "%i", pvHeaderNum++);
@@ -112,6 +144,7 @@ char OSISHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo
continue;
}
preverse = false;
+ pvDID = 0;
}
}
diff --git a/src/modules/filters/osishtmlhref.cpp b/src/modules/filters/osishtmlhref.cpp
index fe3e058..6fce987 100644
--- a/src/modules/filters/osishtmlhref.cpp
+++ b/src/modules/filters/osishtmlhref.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
- osishtmlhref.cpp - OSIS to HTML with hrefs filter
- -------------------
- begin : 2003-06-24
- copyright : 2003 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation version 2 of the License. *
- * *
- ***************************************************************************/
+ * osishtmlhref.cpp - OSIS to HTML with hrefs filter
+ * -------------------
+ * begin : 2003-06-24
+ * copyright : 2003 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <ctype.h>
@@ -111,7 +119,7 @@ void processLemma(bool suspendTextPassThru, XMLTag &tag, SWBuf &buf) {
if (!suspendTextPassThru) {
buf.appendFormatted("<small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\">%s</a>&gt;</em></small>",
(gh.length()) ? gh.c_str() : "",
- URL::encode(val2).c_str(),
+ URL::encode(val2).c_str(),
val2);
}
//}
@@ -188,8 +196,9 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if ((attrib = tag.getAttribute("gloss"))) {
val = strchr(attrib, ':');
val = (val) ? (val + 1) : attrib;
- outText(" ", buf, u);
+ outText("(", buf, u);
outText(val, buf, u);
+ outText(")", buf, u);
}
if (!morphFirst) {
processLemma(u->suspendTextPassThru, tag, buf);
@@ -278,49 +287,71 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
}
}
+ // Milestoned paragraphs, created by osis2mod
+ // <div type="paragraph" sID.../>
+ // <div type="paragraph" eID.../>
+ else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "paragraph")) {
+ // <div type="paragraph" sID... />
+ if (tag.getAttribute("sID")) { // non-empty start tag
+ outText("<!P><br />", buf, u);
+ }
+ // <div type="paragraph" eID... />
+ else if (tag.getAttribute("eID")) {
+ outText("<!/P><br />", buf, u);
+ userData->supressAdjacentWhitespace = true;
+ }
+ }
+
// <reference> tag
else if (!strcmp(tag.getName(), "reference")) {
if (!u->inXRefNote) { // only show these if we're not in an xref note
- if ((!tag.isEndTag()) && (!tag.isEmpty())) {
- u->suspendTextPassThru = (++u->suspendLevel);
- }
- if (tag.isEndTag()) {
- if (!u->BiblicalText) {
- SWBuf refList = tag.getAttribute("passage");
- if (!refList.length())
- refList = u->lastTextNode;
- SWBuf version = tag.getAttribute("version");
-
- buf.appendFormatted("&nbsp;<a href=\"passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">",
- (refList.length()) ? URL::encode(refList.c_str()).c_str() : "",
- (version.length()) ? URL::encode(version.c_str()).c_str() : "");
- buf += u->lastTextNode.c_str();
- buf += "</a>&nbsp;";
+ if (!tag.isEndTag()) {
+ SWBuf target;
+ SWBuf work;
+ SWBuf ref;
+ bool is_scripRef = false;
+
+ target = tag.getAttribute("osisRef");
+ const char* the_ref = strchr(target, ':');
+
+ if(!the_ref) {
+ // No work
+ ref = target;
+ is_scripRef = true;
}
else {
- SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
- VerseKey *vkey = NULL;
- // see if we have a VerseKey * or descendant
- SWTRY {
- vkey = SWDYNAMIC_CAST(VerseKey, u->key);
- }
- SWCATCH ( ... ) {}
- if (vkey) {
- // leave this special osis type in for crossReference notes types? Might thml use this some day? Doesn't hurt.
- //buf.appendFormatted("<a href=\"noteID=%s.x.%s\"><small><sup>*x</sup></small></a> ", vkey->getText(), footnoteNumber.c_str());
- buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=x&value=%s&module=%s&passage=%s\"><small><sup>*x</sup></small></a>",
- URL::encode(footnoteNumber.c_str()).c_str(),
- URL::encode(u->version.c_str()).c_str(),
- URL::encode(vkey->getText()).c_str());
-
- }
+ // Compensate for starting :
+ ref = the_ref + 1;
+
+ int size = target.size() - ref.size() - 1;
+ work.setSize(size);
+ strncpy(work.getRawData(), target, size);
+
+ // For Bible:Gen.3.15 or Bible.vulgate:Gen.3.15
+ if(!strncmp(work, "Bible", 5))
+ is_scripRef = true;
+ }
+
+ if(is_scripRef)
+ {
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=\">",
+ URL::encode(ref.c_str()).c_str()
+// (work.size()) ? URL::encode(work.c_str()).c_str() : "")
+ );
+ }
+ else
+ {
+ // Dictionary link, or something
+ buf.appendFormatted("<a href=\"sword://%s/%s\">",
+ URL::encode(work.c_str()).c_str(),
+ URL::encode(ref.c_str()).c_str()
+ );
}
- u->suspendTextPassThru = (--u->suspendLevel);
}
- }/*
- if (tag.isEndTag()) {
- u->suspendTextPassThru = false;
- }*/
+ else {
+ outText("</a>", buf, u);
+ }
+ }
}
// <l> poetry, etc
@@ -383,7 +414,26 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
outText("</b><br />", buf, u);
}
}
+
+ // <list>
+ else if (!strcmp(tag.getName(), "list")) {
+ if((!tag.isEndTag()) && (!tag.isEmpty())) {
+ outText("<ul>", buf, u);
+ }
+ else if (tag.isEndTag()) {
+ outText("</ul>", buf, u);
+ }
+ }
+ // <item>
+ else if (!strcmp(tag.getName(), "item")) {
+ if((!tag.isEndTag()) && (!tag.isEmpty())) {
+ outText("<li>", buf, u);
+ }
+ else if (tag.isEndTag()) {
+ outText("</li>", buf, u);
+ }
+ }
// <catchWord> & <rdg> tags (italicize)
else if (!strcmp(tag.getName(), "rdg") || !strcmp(tag.getName(), "catchWord")) {
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
@@ -405,6 +455,16 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if (lastText.size()) {
toupperstr(lastText);
scratch.setFormatted("%c<font size=\"-1\">%s</font>", lastText[0], lastText.c_str()+1);
+
+ const unsigned char *tmpBuf = (const unsigned char *)lastText.c_str();
+ getUniCharFromUTF8(&tmpBuf);
+ int char_length = (tmpBuf - (const unsigned char *)lastText.c_str());
+ scratch.setFormatted("%.*s<font size=\"-1\">%s</font>",
+ char_length,
+ lastText.c_str(),
+ lastText.c_str() + char_length
+ );
+
outText(scratch.c_str(), buf, u);
}
}
@@ -542,8 +602,7 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
outText(URL::encode(u->version.c_str()).c_str(), buf, u);
outText("\">", buf, u);
-// we do this because BibleCS looks for this EXACT format for an image tag
- outText("<image border=0 src=\"", buf, u);
+ outText("<img border=\"0\" src=\"", buf, u);
outText(filepath, buf, u);
outText("\" />", buf, u);
diff --git a/src/modules/filters/osislemma.cpp b/src/modules/filters/osislemma.cpp
index f5e6ff6..7b56024 100644
--- a/src/modules/filters/osislemma.cpp
+++ b/src/modules/filters/osislemma.cpp
@@ -2,9 +2,24 @@
*
* osislemma - SWFilter descendant to hide or show lemmata
* in a OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <osislemma.h>
#include <utilxml.h>
diff --git a/src/modules/filters/osismorph.cpp b/src/modules/filters/osismorph.cpp
index 69d44d5..7ceec79 100644
--- a/src/modules/filters/osismorph.cpp
+++ b/src/modules/filters/osismorph.cpp
@@ -2,9 +2,24 @@
*
* osismorph - SWFilter descendant to hide or show morph tags
* in a OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <osismorph.h>
diff --git a/src/modules/filters/osismorphsegmentation.cpp b/src/modules/filters/osismorphsegmentation.cpp
index bf32581..fef7af7 100644
--- a/src/modules/filters/osismorphsegmentation.cpp
+++ b/src/modules/filters/osismorphsegmentation.cpp
@@ -2,9 +2,24 @@
*
* osismorphsegmentation - SWFilter descendant to toggle splitting of morphemes
* (for morpheme segmented Hebrew in the WLC)
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <osismorphsegmentation.h>
#include <stdlib.h>
#include <utilxml.h>
diff --git a/src/modules/filters/osisosis.cpp b/src/modules/filters/osisosis.cpp
index 7da6089..82a6bfc 100644
--- a/src/modules/filters/osisosis.cpp
+++ b/src/modules/filters/osisosis.cpp
@@ -1,17 +1,24 @@
/***************************************************************************
- osisosis.cpp - internal OSIS to public OSIS filter
- -------------------
- begin : 2004-03-13
- copyright : 2003 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation version 2 of the License.
- * *
- ***************************************************************************/
+ * osisosis.cpp - internal OSIS to public OSIS filter
+ * -------------------
+ * begin : 2004-03-13
+ * copyright : 2003 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <osisosis.h>
@@ -55,33 +62,34 @@ char OSISOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module
if (vkey->Verse()) {
ref.appendFormatted("\t\t<verse osisID=\"%s\">", vkey->getOSISRef());
}
-
+
if (ref.length() > 0) {
-
+
text = ref + text;
-
+
if (vkey->Verse()) {
- VerseKey tmp;
- tmp = *vkey;
- tmp.AutoNormalize(0);
- tmp.Headings(1);
-
+ VerseKey *tmp = (VerseKey *)vkey->clone();
+ *tmp = *vkey;
+ tmp->AutoNormalize(0);
+ tmp->Headings(1);
+
text += "</verse>";
-
- tmp = MAXVERSE;
- if (*vkey == tmp) {
- tmp.Verse(0);
+
+ *tmp = MAXVERSE;
+ if (*vkey == *tmp) {
+ tmp->Verse(0);
// sprintf(ref, "\t</div>");
// pushString(&to, ref);
- tmp = MAXCHAPTER;
- tmp = MAXVERSE;
- if (*vkey == tmp) {
- tmp.Chapter(0);
- tmp.Verse(0);
+ *tmp = MAXCHAPTER;
+ *tmp = MAXVERSE;
+ if (*vkey == *tmp) {
+ tmp->Chapter(0);
+ tmp->Verse(0);
// sprintf(ref, "\t</div>");
// pushString(&to, ref);
}
}
+ delete tmp;
}
//
diff --git a/src/modules/filters/osisplain.cpp b/src/modules/filters/osisplain.cpp
index 62841a6..57105f0 100644
--- a/src/modules/filters/osisplain.cpp
+++ b/src/modules/filters/osisplain.cpp
@@ -1,18 +1,24 @@
-/***************************************************************************
- osisplain.cpp - OSIS to Plaintext filter
- -------------------
- begin : 2003-02-15
- copyright : 2003 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+/******************************************************************************
+ * osisplain.cpp - An SWFilter
+ * impl that provides stripping of OSIS tags
+ *
+ * $Id: osisplain.cpp 2334 2009-04-24 00:14:12Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <osisplain.h>
@@ -22,6 +28,17 @@
SWORD_NAMESPACE_START
+namespace {
+class MyUserData : public BasicFilterUserData {
+public:
+ SWBuf w;
+ XMLTag tag;
+ VerseKey *vk;
+ char testament;
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+};
+}
+
OSISPlain::OSISPlain() {
setTokenStart("<");
setTokenEnd(">");
@@ -45,13 +62,18 @@ OSISPlain::OSISPlain() {
addTokenSubstitute("/lg", "\n");
}
+BasicFilterUserData *OSISPlain::createUserData(const SWModule *module, const SWKey *key) {
+ MyUserData *u = new MyUserData(module, key);
+ u->vk = SWDYNAMIC_CAST(VerseKey, u->key);
+ u->testament = (u->vk) ? u->vk->Testament() : 2; // default to NT
+ return u;
+}
+
bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
// manually process if it wasn't a simple substitution
if (!substituteToken(buf, token)) {
MyUserData *u = (MyUserData *)userData;
- VerseKey *vk = SWDYNAMIC_CAST(VerseKey, u->key);
- char testament = (vk) ? vk ->Testament() : 2; // default to NT
if (((*token == 'w') && (token[1] == ' ')) ||
((*token == '/') && (token[1] == 'w') && (!token[2]))) {
u->tag = token;
@@ -99,7 +121,7 @@ bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
val++;
}
else {
- gh = (testament>1) ? 'G' : 'H';
+ gh = (u->testament>1) ? 'G' : 'H';
}
if ((!strcmp(val, "3588")) && (lastText.length() < 1))
show = false;
@@ -139,13 +161,13 @@ bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
// <note> tag
else if (!strncmp(token, "note", 4)) {
if (!strstr(token, "strongsMarkup")) { // leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off
- buf.append(" (");
+ buf.append(" [");
}
else u->suspendTextPassThru = true;
}
else if (!strncmp(token, "/note", 5)) {
if (!u->suspendTextPassThru)
- buf.append(')');
+ buf.append("] ");
else u->suspendTextPassThru = false;
}
@@ -156,6 +178,15 @@ bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
buf.append('\n');
}
+ // Milestoned paragraph, created by osis2mod
+ // <div type="paragraph" sID... />
+ // <div type="paragraph" eID... />
+ else if (!strcmp(u->tag.getName(), "div") && u->tag.getAttribute("type") && !strcmp(u->tag.getAttribute("type"), "paragraph") &&
+ (u->tag.isEmpty() && (u->tag.getAttribute("sID") || u->tag.getAttribute("eID")))) {
+ userData->supressAdjacentWhitespace = true;
+ buf.append('\n');
+ }
+
// <lb .../>
else if (!strncmp(token, "lb", 2)) {
userData->supressAdjacentWhitespace = true;
diff --git a/src/modules/filters/osisredletterwords.cpp b/src/modules/filters/osisredletterwords.cpp
index 727332d..9075fd8 100644
--- a/src/modules/filters/osisredletterwords.cpp
+++ b/src/modules/filters/osisredletterwords.cpp
@@ -2,9 +2,24 @@
*
* OSISRedLetterWords - SWFilter descendant to toggle red coloring for words
* of Christ in an OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <osisredletterwords.h>
#include <swmodule.h>
diff --git a/src/modules/filters/osisrtf.cpp b/src/modules/filters/osisrtf.cpp
index 0352335..84801e3 100644
--- a/src/modules/filters/osisrtf.cpp
+++ b/src/modules/filters/osisrtf.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
- osisrtf.cpp - OSIS to RTF filter
- -------------------
- begin : 2003-02-15
- copyright : 2003 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation version 2 of the License. *
- * *
- ***************************************************************************/
+ * osisrtf.cpp - OSIS to RTF filter
+ * -------------------
+ * begin : 2003-02-15
+ * copyright : 2003 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <ctype.h>
@@ -272,6 +280,21 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us
}
}
+ // Milestoned paragraphs, created by osis2mod
+ // <div type="paragraph" sID.../>
+ // <div type="paragraph" eID.../>
+ else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "paragraph")) {
+ // <div type="paragraph" sID... />
+ if (tag.getAttribute("sID")) { // non-empty start tag
+ outText("{\\fi200\\par}", buf, u);
+ }
+ // <div type="paragraph" eID... />
+ else if (tag.getAttribute("eID")) {
+ outText("{\\par}", buf, u);
+ userData->supressAdjacentWhitespace = true;
+ }
+ }
+
// <reference> tag
else if (!strcmp(tag.getName(), "reference")) {
if (!u->inXRefNote) { // only show these if we're not in an xref note
@@ -316,6 +339,25 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us
outText("\\par}", buf, u);
}
}
+ // <list> - how do we support these better in RTF?
+ else if (!strcmp(tag.getName(), "list")) {
+ if((!tag.isEndTag()) && (!tag.isEmpty())) {
+ outText("\\par\\pard", buf, u);
+ }
+ else if (tag.isEndTag()) {
+ outText("\\par\\pard", buf, u);
+ }
+ }
+
+ // <item> - support better
+ else if (!strcmp(tag.getName(), "item")) {
+ if((!tag.isEndTag()) && (!tag.isEmpty())) {
+ outText("* ", buf, u);
+ }
+ else if (tag.isEndTag()) {
+ outText("\\par", buf, u);
+ }
+ }
// <catchWord> & <rdg> tags (italicize)
else if (!strcmp(tag.getName(), "rdg") || !strcmp(tag.getName(), "catchWord")) {
@@ -445,16 +487,10 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us
else if (!strcmp(tag.getName(), "divineName")) {
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
- u->suspendTextPassThru = (++u->suspendLevel);
+ outText("{\\scaps ", buf, u);
}
else if (tag.isEndTag()) {
- SWBuf lastText = u->lastSuspendSegment.c_str();
- u->suspendTextPassThru = (--u->suspendLevel);
- if (lastText.size()) {
- toupperstr(lastText);
- scratch.setFormatted("{\\fs19%c\\fs16%s}", lastText[0], lastText.c_str()+1);
- outText(scratch.c_str(), buf, u);
- }
+ outText("}", buf, u);
}
}
@@ -462,10 +498,11 @@ bool OSISRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *us
else if (!strcmp(tag.getName(), "div")) {
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
- outText("\\par\\par\\pard ", buf, u);
+ outText("\\pard ", buf, u);
}
else if (tag.isEndTag()) {
- }
+ outText("\\par ", buf, u);
+ }
}
// image
diff --git a/src/modules/filters/osisruby.cpp b/src/modules/filters/osisruby.cpp
new file mode 100644
index 0000000..c17ea43
--- /dev/null
+++ b/src/modules/filters/osisruby.cpp
@@ -0,0 +1,93 @@
+/******************************************************************************
+ *
+ * osisruby - SWFilter descendant to hide or show ruby
+ * in a OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <stdlib.h>
+#include <osisruby.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+const char oName[] = "Ruby";
+const char oTip[] = "Toggles Ruby On and Off if they exist";
+
+const SWBuf choices[3] = {"Off", "On", ""};
+const StringList oValues(&choices[0], &choices[2]);
+
+OSISRuby::OSISRuby() : SWOptionFilter(oName, oTip, &oValues) {
+ setOptionValue("Off");
+}
+
+
+OSISRuby::~OSISRuby() {
+}
+
+
+char OSISRuby::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+ SWBuf token;
+ bool intoken = false;
+ bool lastspace = false;
+
+ const SWBuf orig = text;
+ const char * from = orig.c_str();
+
+ if (!option) {
+ for (text = ""; *from; ++from) {
+ if (*from == '<') {
+ intoken = true;
+ token = "";
+ continue;
+ }
+ if (*from == '>') { // process tokens
+ intoken = false;
+ if (token.startsWith("w ")) { // Word
+ XMLTag wtag(token);
+ const char *l = wtag.getAttribute("gloss");
+ if (l) {
+ wtag.setAttribute("gloss", 0);
+ token = wtag;
+ token.trim();
+ // drop <>
+ token << 1;
+ token--;
+ }
+ }
+
+ // keep token in text
+ text.append('<');
+ text.append(token);
+ text.append('>');
+
+ continue;
+ }
+ if (intoken) {
+ token += *from;
+ }
+ else {
+ text.append(*from);
+ lastspace = (*from == ' ');
+ }
+ }
+ }
+ return 0;
+}
+
+SWORD_NAMESPACE_END
diff --git a/src/modules/filters/osisscripref.cpp b/src/modules/filters/osisscripref.cpp
index 437f5f5..73c7309 100644
--- a/src/modules/filters/osisscripref.cpp
+++ b/src/modules/filters/osisscripref.cpp
@@ -2,9 +2,24 @@
*
* OSISScripref - SWFilter descendant to hide or show scripture references
* in an OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <osisscripref.h>
#include <swmodule.h>
diff --git a/src/modules/filters/osisstrongs.cpp b/src/modules/filters/osisstrongs.cpp
index 922f7fd..8c06b07 100644
--- a/src/modules/filters/osisstrongs.cpp
+++ b/src/modules/filters/osisstrongs.cpp
@@ -2,9 +2,24 @@
*
* osisstrongs - SWFilter descendant to hide or show strongs number
* in a OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
@@ -38,6 +53,7 @@ char OSISStrongs::processText(SWBuf &text, const SWKey *key, const SWModule *mod
int wordNum = 1;
char wordstr[5];
const char *wordStart = 0;
+ SWBuf page = ""; // some modules include <seg> page info, so we add these to the words
const SWBuf orig = text;
const char * from = orig.c_str();
@@ -50,6 +66,20 @@ char OSISStrongs::processText(SWBuf &text, const SWKey *key, const SWModule *mod
}
if (*from == '>') { // process tokens
intoken = false;
+
+ // possible page seg --------------------------------
+ if (token.startsWith("seg ")) {
+ XMLTag stag(token);
+ SWBuf type = stag.getAttribute("type");
+ if (type == "page") {
+ SWBuf number = stag.getAttribute("subtype");
+ if (number.length()) {
+ page = number;
+ }
+ }
+ }
+ // ---------------------------------------------------
+
if (token.startsWith("w ")) { // Word
XMLTag wtag(token);
if (module->isProcessEntryAttributes()) {
@@ -167,15 +197,17 @@ char OSISStrongs::processText(SWBuf &text, const SWKey *key, const SWModule *mod
if (lemma.length())
- module->getEntryAttributes()["Word"][wordstr]["Lemma"] = lemma;
+ module->getEntryAttributes()["Word"][wordstr]["Lemma"] = lemma;
if (lemmaClass.length())
- module->getEntryAttributes()["Word"][wordstr]["LemmaClass"] = lemmaClass;
+ module->getEntryAttributes()["Word"][wordstr]["LemmaClass"] = lemmaClass;
if (morph.length())
- module->getEntryAttributes()["Word"][wordstr]["Morph"] = morph;
+ module->getEntryAttributes()["Word"][wordstr]["Morph"] = morph;
if (morphClass.length())
- module->getEntryAttributes()["Word"][wordstr]["MorphClass"] = morphClass;
+ module->getEntryAttributes()["Word"][wordstr]["MorphClass"] = morphClass;
if (src.length())
module->getEntryAttributes()["Word"][wordstr]["Src"] = src;
+ if (page.length())
+ module->getEntryAttributes()["Word"][wordstr]["Page"] = page;
if (wtag.isEmpty()) {
int j;
diff --git a/src/modules/filters/osisvariants.cpp b/src/modules/filters/osisvariants.cpp
index 91d700c..16e0cfb 100644
--- a/src/modules/filters/osisvariants.cpp
+++ b/src/modules/filters/osisvariants.cpp
@@ -2,9 +2,24 @@
*
* osisvariants - SWFilter descendant to hide or show textual variants
* in an OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <osisvariants.h>
#include <utilstr.h>
diff --git a/src/modules/filters/osiswebif.cpp b/src/modules/filters/osiswebif.cpp
index ecc58f7..e313836 100644
--- a/src/modules/filters/osiswebif.cpp
+++ b/src/modules/filters/osiswebif.cpp
@@ -1,19 +1,25 @@
/***************************************************************************
- OSISWEBIF.cpp - OSIS to HTML filter with hrefs
- for strongs and morph tags
- -------------------
- begin : 2003-10-23
- copyright : 2003 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * OSISWEBIF.cpp - OSIS to HTML filter with hrefs
+ * for strongs and morph tags
+ * -------------------
+ * begin : 2003-10-23
+ * copyright : 2003 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <osiswebif.h>
@@ -169,6 +175,14 @@ bool OSISWEBIF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
}
}
+ // Milestoned paragraphs, created by osis2mod
+ // <div type="paragraph" sID.../>
+ // <div type="paragraph" eID.../>
+ else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "paragraph")) {
+ // This is properly handled by base class.
+ return OSISHTMLHREF::handleToken(buf, token, userData);
+ }
+
// ok to leave these in
else if (!strcmp(tag.getName(), "div")) {
buf += tag;
diff --git a/src/modules/filters/osiswordjs.cpp b/src/modules/filters/osiswordjs.cpp
index dc805b4..da573d3 100644
--- a/src/modules/filters/osiswordjs.cpp
+++ b/src/modules/filters/osiswordjs.cpp
@@ -2,9 +2,24 @@
*
* osisstrongs - SWFilter descendant to hide or show strongs number
* in a OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <osiswordjs.h>
@@ -76,8 +91,11 @@ char OSISWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
SWBuf lemmaClass;
SWBuf lemma;
SWBuf morph;
+ SWBuf page;
SWBuf src;
char gh = 0;
+ page = module->getEntryAttributes()["Word"][wordstr]["Page"].c_str();
+ if (page.length()) page = (SWBuf)"p:" + page;
int count = atoi(module->getEntryAttributes()["Word"][wordstr]["PartCount"].c_str());
for (int i = 0; i < count; i++) {
@@ -146,7 +164,7 @@ char OSISWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
}
}
// 'p' = 'fillpop' to save bandwidth
- text.appendFormatted("<span class=\"clk\" onclick=\"p('%s','%s','%s','%s','','%s');\" >", lexName.c_str(), lemma.c_str(), wordID.c_str(), morph.c_str(), modName.c_str());
+ text.appendFormatted("<span class=\"clk\" onclick=\"p('%s','%s','%s','%s','%s','%s');\" >", lexName.c_str(), lemma.c_str(), wordID.c_str(), morph.c_str(), page.c_str(), modName.c_str());
wordNum++;
}
if ((*token == '/') && (token[1] == 'w') && option) { // Word
diff --git a/src/modules/filters/papyriplain.cpp b/src/modules/filters/papyriplain.cpp
index 423bfda..782b52a 100644
--- a/src/modules/filters/papyriplain.cpp
+++ b/src/modules/filters/papyriplain.cpp
@@ -1,9 +1,24 @@
/******************************************************************************
*
* papyriplain - SWFilter descendant to strip out all Papyri tags
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <papyriplain.h>
diff --git a/src/modules/filters/plainfootnotes.cpp b/src/modules/filters/plainfootnotes.cpp
index 0baf313..449f7da 100644
--- a/src/modules/filters/plainfootnotes.cpp
+++ b/src/modules/filters/plainfootnotes.cpp
@@ -1,19 +1,25 @@
/***************************************************************************
- plainfootnotes.cpp - description
- -------------------
- begin : Wed Oct 13 1999
- copyright : (C) 1999 by The team of BibleTime
- email : info@bibletime.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * plainfootnotes.cpp - description
+ * -------------------
+ * begin : Wed Oct 13 1999
+ * copyright : (C) 1999 by The team of BibleTime
+ * email : info@bibletime.de
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <plainfootnotes.h>
#include <swkey.h>
diff --git a/src/modules/filters/plainhtml.cpp b/src/modules/filters/plainhtml.cpp
index f5f2a5c..3f989fa 100644
--- a/src/modules/filters/plainhtml.cpp
+++ b/src/modules/filters/plainhtml.cpp
@@ -1,19 +1,25 @@
/***************************************************************************
- plainhtml.cpp - description
- -------------------
- begin : Thu Jun 24 1999
- copyright : (C) 1999 by Torsten Uhlmann
- email : TUhlmann@gmx.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * plainhtml.cpp - description
+ * -------------------
+ * begin : Thu Jun 24 1999
+ * copyright : (C) 1999 by Torsten Uhlmann
+ * email : TUhlmann@gmx.de
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <plainhtml.h>
#include <swbuf.h>
diff --git a/src/modules/filters/rtfhtml.cpp b/src/modules/filters/rtfhtml.cpp
index cac5068..7b55721 100644
--- a/src/modules/filters/rtfhtml.cpp
+++ b/src/modules/filters/rtfhtml.cpp
@@ -1,19 +1,25 @@
/***************************************************************************
- rtfhtml.cpp - description
- -------------------
- begin : Wed Oct 13 1999
- copyright : (C) 1999 by The team of BibleTime
- email : info@bibletime.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * rtfhtml.cpp - description
+ * -------------------
+ * begin : Wed Oct 13 1999
+ * copyright : (C) 1999 by The team of BibleTime
+ * email : info@bibletime.de
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <rtfhtml.h>
diff --git a/src/modules/filters/scsuutf8.cpp b/src/modules/filters/scsuutf8.cpp
deleted file mode 100644
index 0daff4a..0000000
--- a/src/modules/filters/scsuutf8.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/******************************************************************************
- *
- * SCSUUTF8 - SWFilter descendant to convert a SCSU character to UTF-8
- *
- */
-
-
-/* This class is based on:
- * http://czyborra.com/scsu/scsu.c written by Roman Czyborra@dds.nl
- * on Andrea's balcony in North Amsterdam on 1998-08-04
- * Thanks to Richard Verhoeven <rcb5@win.tue.nl> for his suggestion
- * to correct the haphazard "if" after UQU to "else if" on 1998-10-01
- *
- * This is a deflator to UTF-8 output for input compressed in SCSU,
- * the (Reuters) Standard Compression Scheme for Unicode as described
- * in http://www.unicode.org/unicode/reports/tr6.html
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <swmodule.h>
-
-#include <scsuutf8.h>
-
-SWORD_NAMESPACE_START
-
-SCSUUTF8::SCSUUTF8() {
-}
-
-
-unsigned char* SCSUUTF8::UTF8Output(unsigned long uchar, unsigned char* text)
-{
- /* join UTF-16 surrogates without any pairing sanity checks */
-
- static int d;
-
- if (uchar >= 0xd800 && uchar <= 0xdbff) { d = uchar & 0x3f; return text; }
- if (uchar >= 0xdc00 && uchar <= 0xdfff) { uchar = uchar + 0x2400 + d * 0x400; }
-
- /* output one character as UTF-8 multibyte sequence */
-
- if (uchar < 0x80) {
- *text++ = c;
- }
- else if (uchar < 0x800) {
- *text++ = 0xc0 | uchar >> 6;
- *text++ = 0x80 | (uchar & 0x3f);
- }
- else if (uchar < 0x10000) {
- *text++ = 0xe0 | uchar >> 12;
- *text++ = 0x80 | (uchar >> 6 & 0x3f);
- *text++ = 0x80 | (uchar & 0x3f);
- }
- else if (uchar < 0x200000) {
- *text++ = 0xf0 | uchar >> 18;
- *text++ = 0x80 | (uchar >> 12 & 0x3f);
- *text++ = 0x80 | (uchar >> 6 & 0x3f);
- *text++ = 0x80 | (uchar & 0x3f);
- }
-
- return text;
-}
-
-char SCSUUTF8::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
-/*
- unsigned char *to, *from;
- unsigned long buflen = len * FILTERPAD;
- char active = 0, mode = 0;
- if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
- return -1;
-
- static unsigned short start[8] = {0x0000,0x0080,0x0100,0x0300,0x2000,0x2080,0x2100,0x3000};
- static unsigned short slide[8] = {0x0080,0x00C0,0x0400,0x0600,0x0900,0x3040,0x30A0,0xFF00};
- static unsigned short win[256] = {
- 0x0000, 0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
- 0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
- 0x0800, 0x0880, 0x0900, 0x0980, 0x0A00, 0x0A80, 0x0B00, 0x0B80,
- 0x0C00, 0x0C80, 0x0D00, 0x0D80, 0x0E00, 0x0E80, 0x0F00, 0x0F80,
- 0x1000, 0x1080, 0x1100, 0x1180, 0x1200, 0x1280, 0x1300, 0x1380,
- 0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780,
- 0x1800, 0x1880, 0x1900, 0x1980, 0x1A00, 0x1A80, 0x1B00, 0x1B80,
- 0x1C00, 0x1C80, 0x1D00, 0x1D80, 0x1E00, 0x1E80, 0x1F00, 0x1F80,
- 0x2000, 0x2080, 0x2100, 0x2180, 0x2200, 0x2280, 0x2300, 0x2380,
- 0x2400, 0x2480, 0x2500, 0x2580, 0x2600, 0x2680, 0x2700, 0x2780,
- 0x2800, 0x2880, 0x2900, 0x2980, 0x2A00, 0x2A80, 0x2B00, 0x2B80,
- 0x2C00, 0x2C80, 0x2D00, 0x2D80, 0x2E00, 0x2E80, 0x2F00, 0x2F80,
- 0x3000, 0x3080, 0x3100, 0x3180, 0x3200, 0x3280, 0x3300, 0x3800,
- 0xE000, 0xE080, 0xE100, 0xE180, 0xE200, 0xE280, 0xE300, 0xE380,
- 0xE400, 0xE480, 0xE500, 0xE580, 0xE600, 0xE680, 0xE700, 0xE780,
- 0xE800, 0xE880, 0xE900, 0xE980, 0xEA00, 0xEA80, 0xEB00, 0xEB80,
- 0xEC00, 0xEC80, 0xED00, 0xED80, 0xEE00, 0xEE80, 0xEF00, 0xEF80,
- 0xF000, 0xF080, 0xF100, 0xF180, 0xF200, 0xF280, 0xF300, 0xF380,
- 0xF400, 0xF480, 0xF500, 0xF580, 0xF600, 0xF680, 0xF700, 0xF780,
- 0xF800, 0xF880, 0xF900, 0xF980, 0xFA00, 0xFA80, 0xFB00, 0xFB80,
- 0xFC00, 0xFC80, 0xFD00, 0xFD80, 0xFE00, 0xFE80, 0xFF00, 0xFF80,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x00C0, 0x0250, 0x0370, 0x0530, 0x3040, 0x30A0, 0xFF60
- };
-
- if (!len)
- return 0;
-
- memmove(&text[buflen - len], text, len);
- from = (unsigned char*)&text[buflen - len];
- to = (unsigned char *)text;
-
- // -------------------------------
-
- for (int i = 0; i < len;) {
-
-
- if (i >= len) break;
- c = from[i++];
-
- if (c >= 0x80)
- {
- to = UTF8Output (c - 0x80 + slide[active], to);
- }
- else if (c >= 0x20 && c <= 0x7F)
- {
- to = UTF8Output (c, to);
- }
- else if (c == 0x0 || c == 0x9 || c == 0xA || c == 0xC || c == 0xD)
- {
- to = UTF8Output (c, to);
- }
- else if (c >= 0x1 && c <= 0x8) // SQn
- {
- if (i >= len) break;
- d = from[i++]; // single quote
-
- to = UTF8Output (d < 0x80 ? d + start [c - 0x1] :
- d - 0x80 + slide [c - 0x1], to);
- }
- else if (c >= 0x10 && c <= 0x17) // SCn
- {
- active = c - 0x10; // change window
- }
- else if (c >= 0x18 && c <= 0x1F) // SDn
- {
- active = c - 0x18; // define window
- if (i >= len) break;
- slide [active] = win [from[i++]];
- }
- else if (c == 0xB) // SDX
- {
- if (i >= len) break;
- c = from[i++];
-
- if (i >= len) break;
- d = from[i++];
-
- slide [active = c>>5] = 0x10000 + (((c & 0x1F) << 8 | d) << 7);
- }
- else if (c == 0xE) // SQU
- {
- if (i >= len) break;
- c = from[i++]; // SQU
-
- if (i >= len) break;
- to = UTF8Output (c << 8 | from[i++], to);
- }
- else if (c == 0xF) // SCU
- {
- mode = 1; // change to Unicode mode
-
- while (mode)
- {
- if (i >= len) break;
- c = from[i++];
-
- if (c <= 0xDF || c >= 0xF3)
- {
- if (i >= len) break;
- to = UTF8Output (c << 8 | from[i++], to);
- }
- else if (c == 0xF0) // UQU
- {
- if (i >= len) break;
- c = from[i++];
-
- if (i >= len) break;
- to = UTF8Output (c << 8 | from[i++], to);
- }
- else if (c >= 0xE0 && c <= 0xE7) // UCn
- {
- active = c - 0xE0; mode = 0;
- }
- else if (c >= 0xE8 && c <= 0xEF) // UDn
- {
- if (i >= len) break;
- slide [active=c-0xE8] = win [from[i++]]; mode = 0;
- }
- else if (c == 0xF1) // UDX
- {
- if (i >= len) break;
- c = from[i++];
-
- if (i >= len) break;
- d = from[i++];
-
- slide [active = c>>5] =
- 0x10000 + (((c & 0x1F) << 8 | d) << 7); mode = 0;
- }
- }
- }
-
-
- }
-
- *to++ = 0;
- *to = 0;
-*/
- return 0;
-}
-
-SWORD_NAMESPACE_END
diff --git a/src/modules/filters/swoptfilter.cpp b/src/modules/filters/swoptfilter.cpp
index 6921190..9d6dac4 100644
--- a/src/modules/filters/swoptfilter.cpp
+++ b/src/modules/filters/swoptfilter.cpp
@@ -1,9 +1,24 @@
/******************************************************************************
*
- * swoptfilter - SWFilter descendant and base class for all option filters
+ * swoptfilter - SWFilter descendant and base class for all option filters
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <swoptfilter.h>
#include <utilstr.h>
diff --git a/src/modules/filters/teihtmlhref.cpp b/src/modules/filters/teihtmlhref.cpp
index 1d213f4..7e27667 100644
--- a/src/modules/filters/teihtmlhref.cpp
+++ b/src/modules/filters/teihtmlhref.cpp
@@ -1,18 +1,24 @@
/***************************************************************************
- teirtf.cpp - TEI to HTMLHREF filter
- -------------------
- begin : 2006-07-03
- copyright : 2006 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * teirtf.cpp - TEI to HTMLHREF filter
+ * -------------------
+ * begin : 2006-07-03
+ * copyright : 2006 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <ctype.h>
@@ -20,6 +26,7 @@
#include <utilxml.h>
#include <swmodule.h>
#include <url.h>
+#include <iostream>
SWORD_NAMESPACE_START
@@ -137,8 +144,8 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
!strcmp(tag.getName(), "case") ||
!strcmp(tag.getName(), "gram") ||
!strcmp(tag.getName(), "number") ||
- !strcmp(tag.getName(), "pron") ||
- !strcmp(tag.getName(), "def")) {
+ !strcmp(tag.getName(), "pron") /*||
+ !strcmp(tag.getName(), "def")*/) {
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
buf += "<i>";
}
@@ -172,6 +179,67 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
!strcmp(tag.getName(), "usg")) {
// do nothing here
}
+ else if (!strcmp(tag.getName(), "ref")) {
+ if (!tag.isEndTag()) {
+ u->suspendTextPassThru = true;
+ SWBuf target;
+ SWBuf work;
+ SWBuf ref;
+
+ int was_osisref = false;
+ if(tag.getAttribute("osisRef"))
+ {
+ target += tag.getAttribute("osisRef");
+ was_osisref=true;
+ }
+ else if(tag.getAttribute("target"))
+ target += tag.getAttribute("target");
+
+ if(target.size())
+ {
+ const char* the_ref = strchr(target, ':');
+
+ if(!the_ref) {
+ // No work
+ ref = target;
+ }
+ else {
+ // Compensate for starting :
+ ref = the_ref + 1;
+
+ int size = target.size() - ref.size() - 1;
+ work.setSize(size);
+ strncpy(work.getRawData(), target, size);
+ }
+
+ if(was_osisref)
+ {
+ buf.appendFormatted("<a href=\"passagestudy.jsp?action=showRef&type=scripRef&value=%s&module=%s\">",
+ (ref) ? URL::encode(ref.c_str()).c_str() : "",
+ (work.size()) ? URL::encode(work.c_str()).c_str() : "");
+ }
+ else
+ {
+ // Dictionary link, or something
+ buf.appendFormatted("<a href=\"sword://%s/%s\">",
+ (work.size()) ? URL::encode(work.c_str()).c_str() : u->version.c_str(),
+ (ref) ? URL::encode(ref.c_str()).c_str() : ""
+ );
+ }
+ }
+ else
+ {
+ //std::cout << "TARGET WASN'T\n";
+ }
+
+ }
+ else {
+ buf += u->lastTextNode.c_str();
+ buf += "</a>";
+
+ u->suspendTextPassThru = false;
+ }
+ }
// <note> tag
else if (!strcmp(tag.getName(), "note")) {
diff --git a/src/modules/filters/teiplain.cpp b/src/modules/filters/teiplain.cpp
index c721d84..90b7c7c 100644
--- a/src/modules/filters/teiplain.cpp
+++ b/src/modules/filters/teiplain.cpp
@@ -1,18 +1,24 @@
/***************************************************************************
- teiplain.cpp - TEI to Plaintext filter
- -------------------
- begin : 2006-07-05
- copyright : 2006 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * teiplain.cpp - TEI to Plaintext filter
+ * -------------------
+ * begin : 2006-07-05
+ * copyright : 2006 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <teiplain.h>
diff --git a/src/modules/filters/teirtf.cpp b/src/modules/filters/teirtf.cpp
index 006f099..8560f5c 100644
--- a/src/modules/filters/teirtf.cpp
+++ b/src/modules/filters/teirtf.cpp
@@ -1,18 +1,24 @@
/***************************************************************************
- teirtf.cpp - TEI to RTF filter
- -------------------
- begin : 2006-07-03
- copyright : 2006 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * teirtf.cpp - TEI to RTF filter
+ * -------------------
+ * begin : 2006-07-03
+ * copyright : 2006 by CrossWire Bible Society
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <ctype.h>
@@ -26,6 +32,7 @@ SWORD_NAMESPACE_START
TEIRTF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
BiblicalText = false;
+ inOsisRef = false;
if (module) {
version = module->Name();
BiblicalText = (!strcmp(module->Type(), "Biblical Texts"));
@@ -66,10 +73,10 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use
}
// <hi>
- else if (!strcmp(tag.getName(), "hi")) {
+ else if (!strcmp(tag.getName(), "hi") || !strcmp(tag.getName(), "emph")) {
SWBuf rend = tag.getAttribute("rend");
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
- if (rend == "ital")
+ if (rend == "ital" || rend == "italic")
buf += "{\\i1 ";
else if (rend == "bold")
buf += "{\\b1 ";
@@ -169,6 +176,25 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use
}
}
+ // <lb/> tag
+ else if (!strcmp(tag.getName(), "lb")) {
+ buf += "{\\par}";
+ userData->supressAdjacentWhitespace = true;
+ }
+
+ // <ref> tag
+ else if (!strcmp(tag.getName(), "ref")) {
+ if (!tag.isEndTag() && tag.getAttribute("osisRef")) {
+ buf += "{<a href=\"\">";
+ u->inOsisRef = true;
+ }
+ else if (tag.isEndTag() && u->inOsisRef) {
+ buf += "</a>}";
+ u->inOsisRef = false;
+ }
+ }
+
+
else {
return false; // we still didn't handle token
}
diff --git a/src/modules/filters/thmlfootnotes.cpp b/src/modules/filters/thmlfootnotes.cpp
index 23c43b4..e75311a 100644
--- a/src/modules/filters/thmlfootnotes.cpp
+++ b/src/modules/filters/thmlfootnotes.cpp
@@ -2,9 +2,26 @@
*
* thmlfootnotes - SWFilter descendant to hide or show footnotes
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
+
#include <stdlib.h>
#include <stdio.h>
#include <thmlfootnotes.h>
@@ -39,7 +56,13 @@ char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
SWBuf refs = "";
int footnoteNum = 1;
char buf[254];
- VerseKey parser = key->getText();
+ SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey();
+ VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+ if (!parser) {
+ delete p;
+ parser = new VerseKey();
+ }
+ *parser = key->getText();
SWBuf orig = text;
const char *from = orig.c_str();
@@ -78,7 +101,7 @@ char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
startTag.setAttribute("swordFootnote", buf);
if ((startTag.getAttribute("type")) && (!strcmp(startTag.getAttribute("type"), "crossReference"))) {
if (!refs.length())
- refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText();
+ refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText();
module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
}
}
@@ -118,6 +141,7 @@ char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m
}
else tagText += *from;
}
+ delete parser;
return 0;
}
diff --git a/src/modules/filters/thmlgbf.cpp b/src/modules/filters/thmlgbf.cpp
index f8703b1..e2e8e1c 100644
--- a/src/modules/filters/thmlgbf.cpp
+++ b/src/modules/filters/thmlgbf.cpp
@@ -1,18 +1,25 @@
/***************************************************************************
- thmlgbf.cpp - ThML to GBF filter
- -------------------
- begin : 1999-10-28
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * thmlgbf.cpp - ThML to GBF filter
+ * -------------------
+ * begin : 1999-10-28
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <thmlgbf.h>
diff --git a/src/modules/filters/thmlheadings.cpp b/src/modules/filters/thmlheadings.cpp
index 4d6134f..e2b7c97 100644
--- a/src/modules/filters/thmlheadings.cpp
+++ b/src/modules/filters/thmlheadings.cpp
@@ -2,9 +2,24 @@
*
* thmlheadings - SWFilter descendant to hide or show headings
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <thmlheadings.h>
diff --git a/src/modules/filters/thmlhtml.cpp b/src/modules/filters/thmlhtml.cpp
index efb09cd..4c66b87 100644
--- a/src/modules/filters/thmlhtml.cpp
+++ b/src/modules/filters/thmlhtml.cpp
@@ -1,18 +1,25 @@
/***************************************************************************
- thmlhtml.cpp - ThML to HTML filter
- -------------------
- begin : 1999-10-27
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * thmlhtml.cpp - ThML to HTML filter
+ * -------------------
+ * begin : 1999-10-27
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <thmlhtml.h>
diff --git a/src/modules/filters/thmlhtmlhref.cpp b/src/modules/filters/thmlhtmlhref.cpp
index 0596f75..83f5a80 100644
--- a/src/modules/filters/thmlhtmlhref.cpp
+++ b/src/modules/filters/thmlhtmlhref.cpp
@@ -1,18 +1,26 @@
/***************************************************************************
- thmlhtmlhref.cpp - ThML to HTML filter with hrefs
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
+ * thmlhtmlhref.cpp - ThML to HTML filter with hrefs
+ * -------------------
+ * begin : 2001-09-03
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
#include <stdlib.h>
#include <thmlhtmlhref.h>
#include <swmodule.h>
@@ -320,8 +328,8 @@ bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
URL::encode(u->version.c_str()).c_str());
for (c = token; *c; c++) {
- if ((*c == '/') && (*(c+1) == '\0'))
- continue;
+ if ((*c == '/') && (*(c+1) == '\0'))
+ continue;
if (c == src) {
for (;((*c) && (*c != '"')); c++)
buf += *c;
diff --git a/src/modules/filters/thmllemma.cpp b/src/modules/filters/thmllemma.cpp
index 3e5761d..53eec58 100644
--- a/src/modules/filters/thmllemma.cpp
+++ b/src/modules/filters/thmllemma.cpp
@@ -2,9 +2,24 @@
*
* thmllemma - SWFilter descendant to hide or show lemmas
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <thmllemma.h>
diff --git a/src/modules/filters/thmlmorph.cpp b/src/modules/filters/thmlmorph.cpp
index 0fbef56..d3cf597 100644
--- a/src/modules/filters/thmlmorph.cpp
+++ b/src/modules/filters/thmlmorph.cpp
@@ -2,9 +2,24 @@
*
* thmlmorph - SWFilter descendant to hide or show morph tags
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <thmlmorph.h>
diff --git a/src/modules/filters/thmlosis.cpp b/src/modules/filters/thmlosis.cpp
index 939be82..25fdf23 100644
--- a/src/modules/filters/thmlosis.cpp
+++ b/src/modules/filters/thmlosis.cpp
@@ -2,9 +2,24 @@
*
* thmlstrongs - SWFilter descendant to hide or show strongs number
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -326,7 +341,7 @@ char ThMLOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module
}
// Footnote
- if (!strcmp(token, "note")) {
+ if (!strncmp(token, "note", 4)) {
//pushString(&to, "<note>");
text.append("<note>");
newText = true;
@@ -534,23 +549,23 @@ char ThMLOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module
text = ref + text;
if (vkey->Verse()) {
- VerseKey tmp;
- tmp = *vkey;
- tmp.AutoNormalize(0);
- tmp.Headings(1);
-
+ VerseKey *tmp = (VerseKey *)vkey->clone();
+ *tmp = *vkey;
+ tmp->AutoNormalize(0);
+ tmp->Headings(1);
+
text += "</verse>";
-
- tmp = MAXVERSE;
- if (*vkey == tmp) {
- tmp.Verse(0);
+
+ *tmp = MAXVERSE;
+ if (*vkey == *tmp) {
+ tmp->Verse(0);
// sprintf(ref, "\t</div>");
// pushString(&to, ref);
- tmp = MAXCHAPTER;
- tmp = MAXVERSE;
- if (*vkey == tmp) {
- tmp.Chapter(0);
- tmp.Verse(0);
+ *tmp = MAXCHAPTER;
+ *tmp = MAXVERSE;
+ if (*vkey == *tmp) {
+ tmp->Chapter(0);
+ tmp->Verse(0);
// sprintf(ref, "\t</div>");
// pushString(&to, ref);
/*
@@ -561,6 +576,7 @@ char ThMLOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module
*/
}
}
+ delete tmp;
}
// else if (vkey->Chapter()) {
// sprintf(ref, "\t<div type=\"chapter\" osisID=\"%s\">", vkey->getOSISRef());
diff --git a/src/modules/filters/thmlplain.cpp b/src/modules/filters/thmlplain.cpp
index 8f8379a..8c9358f 100644
--- a/src/modules/filters/thmlplain.cpp
+++ b/src/modules/filters/thmlplain.cpp
@@ -2,9 +2,24 @@
*
* thmlplain - SWFilter descendant to strip out all ThML tags or convert to
* ASCII rendered symbols.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <thmlplain.h>
#include <swbuf.h>
@@ -55,104 +70,104 @@ char ThMLPlain::processText(SWBuf &text, const SWKey *key, const SWModule *modul
else if (!strncmp("amp", token, 3)) text += '&';
else if (!strncmp("lt", token, 2)) text += '<';
else if (!strncmp("gt", token, 2)) text += '>';
- else if (!strncmp("brvbar", token, 6)) text += '';
- else if (!strncmp("sect", token, 4)) text += '';
- else if (!strncmp("copy", token, 4)) text += '';
- else if (!strncmp("laquo", token, 5)) text += '';
- else if (!strncmp("reg", token, 3)) text += '';
- else if (!strncmp("acute", token, 5)) text += '';
- else if (!strncmp("para", token, 4)) text += '';
- else if (!strncmp("raquo", token, 5)) text += '';
+ else if (!strncmp("brvbar", token, 6)) text += "¦";
+ else if (!strncmp("sect", token, 4)) text += "§";
+ else if (!strncmp("copy", token, 4)) text += "©";
+ else if (!strncmp("laquo", token, 5)) text += "«";
+ else if (!strncmp("reg", token, 3)) text += "®";
+ else if (!strncmp("acute", token, 5)) text += "´";
+ else if (!strncmp("para", token, 4)) text += "¶";
+ else if (!strncmp("raquo", token, 5)) text += "»";
- else if (!strncmp("Aacute", token, 6)) text += '';
- else if (!strncmp("Agrave", token, 6)) text += '';
- else if (!strncmp("Acirc", token, 5)) text += '';
- else if (!strncmp("Auml", token, 4)) text += '';
- else if (!strncmp("Atilde", token, 6)) text += '';
- else if (!strncmp("Aring", token, 5)) text += '';
- else if (!strncmp("aacute", token, 6)) text += '';
- else if (!strncmp("agrave", token, 6)) text += '';
- else if (!strncmp("acirc", token, 5)) text += '';
- else if (!strncmp("auml", token, 4)) text += '';
- else if (!strncmp("atilde", token, 6)) text += '';
- else if (!strncmp("aring", token, 5)) text += '';
- else if (!strncmp("Eacute", token, 6)) text += '';
- else if (!strncmp("Egrave", token, 6)) text += '';
- else if (!strncmp("Ecirc", token, 5)) text += '';
- else if (!strncmp("Euml", token, 4)) text += '';
- else if (!strncmp("eacute", token, 6)) text += '';
- else if (!strncmp("egrave", token, 6)) text += '';
- else if (!strncmp("ecirc", token, 5)) text += '';
- else if (!strncmp("euml", token, 4)) text += '';
- else if (!strncmp("Iacute", token, 6)) text += '';
- else if (!strncmp("Igrave", token, 6)) text += '';
- else if (!strncmp("Icirc", token, 5)) text += '';
- else if (!strncmp("Iuml", token, 4)) text += '';
- else if (!strncmp("iacute", token, 6)) text += '';
- else if (!strncmp("igrave", token, 6)) text += '';
- else if (!strncmp("icirc", token, 5)) text += '';
- else if (!strncmp("iuml", token, 4)) text += '';
- else if (!strncmp("Oacute", token, 6)) text += '';
- else if (!strncmp("Ograve", token, 6)) text += '';
- else if (!strncmp("Ocirc", token, 5)) text += '';
- else if (!strncmp("Ouml", token, 4)) text += '';
- else if (!strncmp("Otilde", token, 6)) text += '';
- else if (!strncmp("oacute", token, 6)) text += '';
- else if (!strncmp("ograve", token, 6)) text += '';
- else if (!strncmp("ocirc", token, 5)) text += '';
- else if (!strncmp("ouml", token, 4)) text += '';
- else if (!strncmp("otilde", token, 6)) text += '';
- else if (!strncmp("Uacute", token, 6)) text += '';
- else if (!strncmp("Ugrave", token, 6)) text += '';
- else if (!strncmp("Ucirc", token, 5)) text += '';
- else if (!strncmp("Uuml", token, 4)) text += '';
- else if (!strncmp("uacute", token, 6)) text += '';
- else if (!strncmp("ugrave", token, 6)) text += '';
- else if (!strncmp("ucirc", token, 5)) text += '';
- else if (!strncmp("uuml", token, 4)) text += '';
- else if (!strncmp("Yacute", token, 6)) text += '';
- else if (!strncmp("yacute", token, 6)) text += '';
- else if (!strncmp("yuml", token, 4)) text += '';
+ else if (!strncmp("Aacute", token, 6)) text += "Á";
+ else if (!strncmp("Agrave", token, 6)) text += "À";
+ else if (!strncmp("Acirc", token, 5)) text += "Â";
+ else if (!strncmp("Auml", token, 4)) text += "Ä";
+ else if (!strncmp("Atilde", token, 6)) text += "Ã";
+ else if (!strncmp("Aring", token, 5)) text += "Å";
+ else if (!strncmp("aacute", token, 6)) text += "á";
+ else if (!strncmp("agrave", token, 6)) text += "à";
+ else if (!strncmp("acirc", token, 5)) text += "â";
+ else if (!strncmp("auml", token, 4)) text += "ä";
+ else if (!strncmp("atilde", token, 6)) text += "ã";
+ else if (!strncmp("aring", token, 5)) text += "å";
+ else if (!strncmp("Eacute", token, 6)) text += "É";
+ else if (!strncmp("Egrave", token, 6)) text += "È";
+ else if (!strncmp("Ecirc", token, 5)) text += "Ê";
+ else if (!strncmp("Euml", token, 4)) text += "Ë";
+ else if (!strncmp("eacute", token, 6)) text += "é";
+ else if (!strncmp("egrave", token, 6)) text += "è";
+ else if (!strncmp("ecirc", token, 5)) text += "ê";
+ else if (!strncmp("euml", token, 4)) text += "ë";
+ else if (!strncmp("Iacute", token, 6)) text += "Í";
+ else if (!strncmp("Igrave", token, 6)) text += "Ì";
+ else if (!strncmp("Icirc", token, 5)) text += "Î";
+ else if (!strncmp("Iuml", token, 4)) text += "Ï";
+ else if (!strncmp("iacute", token, 6)) text += "í";
+ else if (!strncmp("igrave", token, 6)) text += "ì";
+ else if (!strncmp("icirc", token, 5)) text += "î";
+ else if (!strncmp("iuml", token, 4)) text += "ï";
+ else if (!strncmp("Oacute", token, 6)) text += "Ó";
+ else if (!strncmp("Ograve", token, 6)) text += "Ò";
+ else if (!strncmp("Ocirc", token, 5)) text += "Ô";
+ else if (!strncmp("Ouml", token, 4)) text += "Ö";
+ else if (!strncmp("Otilde", token, 6)) text += "Õ";
+ else if (!strncmp("oacute", token, 6)) text += "ó";
+ else if (!strncmp("ograve", token, 6)) text += "ò";
+ else if (!strncmp("ocirc", token, 5)) text += "ô";
+ else if (!strncmp("ouml", token, 4)) text += "ö";
+ else if (!strncmp("otilde", token, 6)) text += "õ";
+ else if (!strncmp("Uacute", token, 6)) text += "Ú";
+ else if (!strncmp("Ugrave", token, 6)) text += "Ù";
+ else if (!strncmp("Ucirc", token, 5)) text += "Û";
+ else if (!strncmp("Uuml", token, 4)) text += "Ü";
+ else if (!strncmp("uacute", token, 6)) text += "ú";
+ else if (!strncmp("ugrave", token, 6)) text += "ù";
+ else if (!strncmp("ucirc", token, 5)) text += "û";
+ else if (!strncmp("uuml", token, 4)) text += "ü";
+ else if (!strncmp("Yacute", token, 6)) text += "Ý";
+ else if (!strncmp("yacute", token, 6)) text += "ý";
+ else if (!strncmp("yuml", token, 4)) text += "ÿ";
- else if (!strncmp("deg", token, 3)) text += '';
- else if (!strncmp("plusmn", token, 6)) text += '';
- else if (!strncmp("sup2", token, 4)) text += '';
- else if (!strncmp("sup3", token, 4)) text += '';
- else if (!strncmp("sup1", token, 4)) text += '';
- else if (!strncmp("nbsp", token, 4)) text += '';
- else if (!strncmp("pound", token, 5)) text += '';
- else if (!strncmp("cent", token, 4)) text += '';
- else if (!strncmp("frac14", token, 6)) text += '';
- else if (!strncmp("frac12", token, 6)) text += '';
- else if (!strncmp("frac34", token, 6)) text += '';
- else if (!strncmp("iquest", token, 6)) text += '';
- else if (!strncmp("iexcl", token, 5)) text += '';
- else if (!strncmp("ETH", token, 3)) text += '';
- else if (!strncmp("eth", token, 3)) text += '';
- else if (!strncmp("THORN", token, 5)) text += '';
- else if (!strncmp("thorn", token, 5)) text += '';
- else if (!strncmp("AElig", token, 5)) text += '';
- else if (!strncmp("aelig", token, 5)) text += '';
- else if (!strncmp("Oslash", token, 6)) text += '';
- else if (!strncmp("curren", token, 6)) text += '';
- else if (!strncmp("Ccedil", token, 6)) text += '';
- else if (!strncmp("ccedil", token, 6)) text += '';
- else if (!strncmp("szlig", token, 5)) text += '';
- else if (!strncmp("Ntilde", token, 6)) text += '';
- else if (!strncmp("ntilde", token, 6)) text += '';
- else if (!strncmp("yen", token, 3)) text += '';
- else if (!strncmp("not", token, 3)) text += '';
- else if (!strncmp("ordf", token, 4)) text += '';
- else if (!strncmp("uml", token, 3)) text += '';
- else if (!strncmp("shy", token, 3)) text += '';
- else if (!strncmp("macr", token, 4)) text += '';
- else if (!strncmp("micro", token, 5)) text += "";
- else if (!strncmp("middot", token, 6)) text +="";
- else if (!strncmp("cedil", token, 5)) text += "";
- else if (!strncmp("ordm", token, 4)) text += "";
- else if (!strncmp("times", token, 5)) text += "";
- else if (!strncmp("divide", token, 6)) text +="";
- else if (!strncmp("oslash", token, 6)) text +="";
+ else if (!strncmp("deg", token, 3)) text += "°";
+ else if (!strncmp("plusmn", token, 6)) text += "±";
+ else if (!strncmp("sup2", token, 4)) text += "²";
+ else if (!strncmp("sup3", token, 4)) text += "³";
+ else if (!strncmp("sup1", token, 4)) text += "¹";
+ else if (!strncmp("nbsp", token, 4)) text += "º";
+ else if (!strncmp("pound", token, 5)) text += "£";
+ else if (!strncmp("cent", token, 4)) text += "¢";
+ else if (!strncmp("frac14", token, 6)) text += "¼";
+ else if (!strncmp("frac12", token, 6)) text += "½";
+ else if (!strncmp("frac34", token, 6)) text += "¾";
+ else if (!strncmp("iquest", token, 6)) text += "¿";
+ else if (!strncmp("iexcl", token, 5)) text += "¡";
+ else if (!strncmp("ETH", token, 3)) text += "Ð";
+ else if (!strncmp("eth", token, 3)) text += "ð";
+ else if (!strncmp("THORN", token, 5)) text += "Þ";
+ else if (!strncmp("thorn", token, 5)) text += "þ";
+ else if (!strncmp("AElig", token, 5)) text += "Æ";
+ else if (!strncmp("aelig", token, 5)) text += "æ";
+ else if (!strncmp("Oslash", token, 6)) text += "Ø";
+ else if (!strncmp("curren", token, 6)) text += "¤";
+ else if (!strncmp("Ccedil", token, 6)) text += "Ç";
+ else if (!strncmp("ccedil", token, 6)) text += "ç";
+ else if (!strncmp("szlig", token, 5)) text += "ß";
+ else if (!strncmp("Ntilde", token, 6)) text += "Ñ";
+ else if (!strncmp("ntilde", token, 6)) text += "ñ";
+ else if (!strncmp("yen", token, 3)) text += "¥";
+ else if (!strncmp("not", token, 3)) text += "¬";
+ else if (!strncmp("ordf", token, 4)) text += "ª";
+ else if (!strncmp("uml", token, 3)) text += "¨";
+ else if (!strncmp("shy", token, 3)) text += "­";
+ else if (!strncmp("macr", token, 4)) text += "¯";
+ else if (!strncmp("micro", token, 5)) text += "µ";
+ else if (!strncmp("middot", token, 6)) text += "·";
+ else if (!strncmp("cedil", token, 5)) text += "¸";
+ else if (!strncmp("ordm", token, 4)) text += "º";
+ else if (!strncmp("times", token, 5)) text += "×";
+ else if (!strncmp("divide", token, 6)) text += "÷";
+ else if (!strncmp("oslash", token, 6)) text += "ø";
continue;
}
@@ -177,14 +192,14 @@ char ThMLPlain::processText(SWBuf &text, const SWKey *key, const SWModule *modul
}
if (!strncmp("note", token, 4)) {
text += ' ';
- text += '(';
+ text += '[';
}
else if (!strncmp("br", token, 2))
text += '\n';
else if (!strncmp("/p", token, 2))
text += '\n';
else if (!strncmp("/note", token, 5)) {
- text += ')';
+ text += ']';
text += ' ';
}
continue;
diff --git a/src/modules/filters/thmlrtf.cpp b/src/modules/filters/thmlrtf.cpp
index 23e4a90..fdb41df 100644
--- a/src/modules/filters/thmlrtf.cpp
+++ b/src/modules/filters/thmlrtf.cpp
@@ -1,18 +1,25 @@
/***************************************************************************
- thmlrtf.cpp - ThML to RTF filter
- -------------------
- begin : 1999-10-27
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * thmlrtf.cpp - ThML to RTF filter
+ * -------------------
+ * begin : 1999-10-27
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <thmlrtf.h>
diff --git a/src/modules/filters/thmlscripref.cpp b/src/modules/filters/thmlscripref.cpp
index df2b3d2..e46d679 100644
--- a/src/modules/filters/thmlscripref.cpp
+++ b/src/modules/filters/thmlscripref.cpp
@@ -2,9 +2,24 @@
*
* thmlscripref - SWFilter descendant to hide or show scripture
* referebces in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <thmlscripref.h>
@@ -38,7 +53,13 @@ char ThMLScripref::processText(SWBuf &text, const SWKey *key, const SWModule *mo
SWBuf refs = "";
int footnoteNum = 1;
char buf[254];
- VerseKey parser = key->getText();
+ SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey();
+ VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+ if (!parser) {
+ delete p;
+ parser = new VerseKey();
+ }
+ *parser = key->getText();
SWBuf orig = text;
const char *from = orig.c_str();
@@ -77,8 +98,8 @@ char ThMLScripref::processText(SWBuf &text, const SWKey *key, const SWModule *mo
startTag.setAttribute("swordFootnote", buf);
SWBuf passage = startTag.getAttribute("passage");
if (passage.length())
- refs = parser.ParseVerseList(passage.c_str(), parser, true).getRangeText();
- else refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText();
+ refs = parser->ParseVerseList(passage.c_str(), *parser, true).getRangeText();
+ else refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText();
module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
}
hide = false;
@@ -117,6 +138,7 @@ char ThMLScripref::processText(SWBuf &text, const SWKey *key, const SWModule *mo
}
else tagText += *from;
}
+ delete parser;
return 0;
}
diff --git a/src/modules/filters/thmlstrongs.cpp b/src/modules/filters/thmlstrongs.cpp
index c1ab08c..457e28b 100644
--- a/src/modules/filters/thmlstrongs.cpp
+++ b/src/modules/filters/thmlstrongs.cpp
@@ -2,9 +2,24 @@
*
* thmlstrongs - SWFilter descendant to hide or show strongs number
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <thmlstrongs.h>
diff --git a/src/modules/filters/thmlvariants.cpp b/src/modules/filters/thmlvariants.cpp
index 49f9b65..4f28dbe 100644
--- a/src/modules/filters/thmlvariants.cpp
+++ b/src/modules/filters/thmlvariants.cpp
@@ -2,9 +2,24 @@
*
* thmlvariants - SWFilter descendant to hide or show textual variants
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <thmlvariants.h>
#include <utilstr.h>
diff --git a/src/modules/filters/thmlwebif.cpp b/src/modules/filters/thmlwebif.cpp
index 7428754..0192703 100644
--- a/src/modules/filters/thmlwebif.cpp
+++ b/src/modules/filters/thmlwebif.cpp
@@ -1,18 +1,25 @@
/***************************************************************************
- ThMLWEBIF.cpp - ThML to HTML filter with hrefs
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ * ThMLWEBIF.cpp - ThML to HTML filter with hrefs
+ * -------------------
+ * begin : 2001-09-03
+ * copyright : 2001 by CrossWire Bible Society
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#include <stdlib.h>
#include <thmlwebif.h>
diff --git a/src/modules/filters/thmlwordjs.cpp b/src/modules/filters/thmlwordjs.cpp
index ad8eef0..12fbeb1 100644
--- a/src/modules/filters/thmlwordjs.cpp
+++ b/src/modules/filters/thmlwordjs.cpp
@@ -2,9 +2,24 @@
*
* thmlstrongs - SWFilter descendant to hide or show strongs number
* in a ThML module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <thmlwordjs.h>
diff --git a/src/modules/filters/unicodertf.cpp b/src/modules/filters/unicodertf.cpp
index 8c2a1f6..768aecc 100644
--- a/src/modules/filters/unicodertf.cpp
+++ b/src/modules/filters/unicodertf.cpp
@@ -2,9 +2,24 @@
*
* unicodertf - SWFilter descendant to convert a double byte unicode file
* to RTF tags
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <unicodertf.h>
diff --git a/src/modules/filters/utf16utf8.cpp b/src/modules/filters/utf16utf8.cpp
index ae0845f..a488e18 100644
--- a/src/modules/filters/utf16utf8.cpp
+++ b/src/modules/filters/utf16utf8.cpp
@@ -2,8 +2,25 @@
*
* UTF16UTF8 - SWFilter descendant to convert UTF-16 to UTF-8
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
+
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/modules/filters/utf8arabicpoints.cpp b/src/modules/filters/utf8arabicpoints.cpp
new file mode 100644
index 0000000..bd3169b
--- /dev/null
+++ b/src/modules/filters/utf8arabicpoints.cpp
@@ -0,0 +1,61 @@
+/******************************************************************************
+ *
+ * UTF8ArabicPoints - SWFilter descendant to remove UTF-8 Arabic vowel points
+ *
+ * $Id: utf8arabicpoints.h 1688 2008-11-30 04:42:26Z refdoc $
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <utf8arabicpoints.h>
+
+SWORD_NAMESPACE_START
+
+const char oName[] = "Arabic Vowel Points";
+const char oTip[] = "Toggles Arabic Vowel Points";
+
+const SWBuf choices[3] = {"On", "Off", ""};
+const StringList oValues(&choices[0], &choices[2]);
+
+UTF8ArabicPoints::UTF8ArabicPoints() : SWOptionFilter(oName, oTip, &oValues) {
+ setOptionValue("On");
+}
+
+UTF8ArabicPoints::~UTF8ArabicPoints(){};
+
+
+char UTF8ArabicPoints::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+ if (!option) {
+ //The UTF-8 range 0xFC 0xE5 to 0xFC 0x63 consist of Arabic vowel marks so block those out.
+ // Also ranges 0xFE70 til OxFE7F and 0x064b-0x0655
+ SWBuf orig = text;
+ const unsigned char* from = (unsigned char*)orig.c_str();
+ for (text = ""; *from; from++) {
+ if (((*from == 0xFC) && (*(from + 1) >= 0xE5 && *(from + 1) <= 0x63)) || ((*from == 0xFE) && (*(from + 1) >= 0x70 && *(from + 1) <= 0x7F)) || ((*from == 0x06) && (*(from + 1) >= 0x4B && *(from + 1) <= 0x55))){
+ from++;
+ }
+ else {
+ text += *from;
+ }
+ }
+ }
+ return 0;
+}
+
+SWORD_NAMESPACE_END
diff --git a/src/modules/filters/utf8arshaping.cpp b/src/modules/filters/utf8arshaping.cpp
index 702fb62..09d8973 100644
--- a/src/modules/filters/utf8arshaping.cpp
+++ b/src/modules/filters/utf8arshaping.cpp
@@ -1,8 +1,24 @@
/******************************************************************************
-*
-* utf8arshaping - SWFilter descendant to perform Arabic shaping on
-* UTF-8 text
-*/
+ *
+ * utf8arshaping - SWFilter descendant to perform Arabic shaping on
+ * UTF-8 text
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifdef _ICU_
diff --git a/src/modules/filters/utf8bidireorder.cpp b/src/modules/filters/utf8bidireorder.cpp
index 783602c..71dc804 100644
--- a/src/modules/filters/utf8bidireorder.cpp
+++ b/src/modules/filters/utf8bidireorder.cpp
@@ -1,8 +1,24 @@
/******************************************************************************
-*
-* utf8cnormalizer - SWFilter descendant to perform reordering of UTF-8
-* text to visual order according to Unicode BiDi
-*/
+ *
+ * utf8bidireorder - SWFilter descendant to perform reordering of UTF-8
+ * text to visual order according to Unicode BiDi
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifdef _ICU_
diff --git a/src/modules/filters/utf8cantillation.cpp b/src/modules/filters/utf8cantillation.cpp
index 6213620..73785b4 100644
--- a/src/modules/filters/utf8cantillation.cpp
+++ b/src/modules/filters/utf8cantillation.cpp
@@ -2,9 +2,24 @@
*
* UTF8Cantillation - SWFilter descendant to remove UTF-8 Hebrew cantillation
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <utf8cantillation.h>
diff --git a/src/modules/filters/utf8greekaccents.cpp b/src/modules/filters/utf8greekaccents.cpp
index df85968..5fdb047 100644
--- a/src/modules/filters/utf8greekaccents.cpp
+++ b/src/modules/filters/utf8greekaccents.cpp
@@ -2,9 +2,24 @@
*
* UTF8GreekAccents - SWFilter descendant to remove UTF-8 Greek accents
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <utf8greekaccents.h>
diff --git a/src/modules/filters/utf8hebrewpoints.cpp b/src/modules/filters/utf8hebrewpoints.cpp
index 0476db8..ba7c746 100644
--- a/src/modules/filters/utf8hebrewpoints.cpp
+++ b/src/modules/filters/utf8hebrewpoints.cpp
@@ -2,9 +2,24 @@
*
* UTF8HebrewPoints - SWFilter descendant to remove UTF-8 Hebrew vowel points
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <utf8hebrewpoints.h>
diff --git a/src/modules/filters/utf8html.cpp b/src/modules/filters/utf8html.cpp
index 088f669..0d1dce3 100644
--- a/src/modules/filters/utf8html.cpp
+++ b/src/modules/filters/utf8html.cpp
@@ -2,9 +2,24 @@
*
* utf8html - SWFilter descendant to convert a UTF-8 stream to HTML escapes
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <utf8html.h>
diff --git a/src/modules/filters/utf8latin1.cpp b/src/modules/filters/utf8latin1.cpp
index 08b288d..25df0c1 100644
--- a/src/modules/filters/utf8latin1.cpp
+++ b/src/modules/filters/utf8latin1.cpp
@@ -2,6 +2,22 @@
*
* UTF8Latin1 - SWFilter descendant to convert UTF-8 to Latin-1
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
#include <stdlib.h>
diff --git a/src/modules/filters/utf8nfc.cpp b/src/modules/filters/utf8nfc.cpp
index 15b76b5..82d404e 100644
--- a/src/modules/filters/utf8nfc.cpp
+++ b/src/modules/filters/utf8nfc.cpp
@@ -1,8 +1,24 @@
/******************************************************************************
-*
-* utf8nfc - SWFilter descendant to perform NFC (canonical composition
-* normalization) on UTF-8 text
-*/
+ *
+ * utf8nfc - SWFilter descendant to perform NFC (canonical composition
+ * normalization) on UTF-8 text
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifdef _ICU_
diff --git a/src/modules/filters/utf8nfkd.cpp b/src/modules/filters/utf8nfkd.cpp
index a19d36b..1d6acf3 100644
--- a/src/modules/filters/utf8nfkd.cpp
+++ b/src/modules/filters/utf8nfkd.cpp
@@ -1,8 +1,24 @@
/******************************************************************************
-*
-* utf8nfkd - SWFilter descendant to perform NFKD (compatability decomposition
-* normalization) on UTF-8 text
-*/
+ *
+ * utf8nfkd - SWFilter descendant to perform NFKD (compatability decomposition
+ * normalization) on UTF-8 text
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifdef _ICU_
diff --git a/src/modules/filters/utf8transliterator.cpp b/src/modules/filters/utf8transliterator.cpp
index d99741b..552ec3e 100644
--- a/src/modules/filters/utf8transliterator.cpp
+++ b/src/modules/filters/utf8transliterator.cpp
@@ -1,8 +1,24 @@
/******************************************************************************
-*
-* utf8transliterators - SWFilter descendant to transliterate between
-* ICU-supported scripts.
-*/
+ *
+ * utf8transliterators - SWFilter descendant to transliterate between
+ * ICU-supported scripts.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifdef _ICU_
@@ -25,51 +41,48 @@ SWORD_NAMESPACE_START
const char UTF8Transliterator::optionstring[NUMTARGETSCRIPTS][16] = {
"Off",
"Latin",
- "IPA",
- "Basic Latin",
- "SBL",
- "TC",
- "Beta",
- "BGreek",
- "SERA",
- "Hugoye",
- "UNGEGN",
- "ISO",
- "ALA-LC",
- "BGN-PCGN",
- "Greek",
- "Hebrew",
- "Cyrillic",
- "Arabic",
- "Syriac",
- "Katakana",
- "Hiragana",
- "Hangul",
- "Devanagari",
- "Tamil",
- "Bengali",
- "Gurmukhi",
- "Gujarati",
- "Oriya",
- "Telugu",
- "Kannada",
- "Malayalam",
- "Thai",
- "Georgian",
- "Armenian",
- "Ethiopic",
- "Gothic",
- "Ugaritic",
- "Coptic",
- "Meroitic",
- "Linear B",
- "Cypriot",
- "Runic",
- "Ogham",
- "Thaana",
- "Glagolitic",
-// "Tengwar",
-// "Cirth"
+ // "IPA",
+ // "Basic Latin",
+ // "SBL",
+ // "TC",
+ // "Beta",
+ // "BGreek",
+ // "SERA",
+ // "Hugoye",
+ // "UNGEGN",
+ // "ISO",
+ // "ALA-LC",
+ // "BGN",
+ // "Greek",
+ // "Hebrew",
+ // "Cyrillic",
+ // "Arabic",
+ // "Syriac",
+ // "Katakana",
+ // "Hiragana",
+ // "Hangul",
+ // "Devanagari",
+ // "Tamil",
+ // "Bengali",
+ // "Gurmukhi",
+ // "Gujarati",
+ // "Oriya",
+ // "Telugu",
+ // "Kannada",
+ // "Malayalam",
+ // "Thai",
+ // "Georgian",
+ // "Armenian",
+ // "Ethiopic",
+ // "Gothic",
+ // "Ugaritic",
+ // "Coptic",
+ // "Linear B",
+ // "Cypriot",
+ // "Runic",
+ // "Ogham",
+ // "Thaana",
+ // "Glagolitic",
};
const char UTF8Transliterator::optName[] = "Transliteration";
@@ -128,6 +141,11 @@ UTF8Transliterator::UTF8Transliterator() {
#endif
}
+
+UTF8Transliterator::~UTF8Transliterator() {
+}
+
+
void UTF8Transliterator::Load(UErrorCode &status)
{
#ifndef _ICUSWORD_
@@ -374,19 +392,19 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu
case UBLOCK_MALAYALAM: scripts[SE_MALAYALAM] = true; break;
case UBLOCK_THAI: scripts[SE_THAI] = true; break;
case UBLOCK_GEORGIAN: scripts[SE_GEORGIAN] = true; break;
- case UBLOCK_ARMENIAN: scripts[SE_ARMENIAN] = true; break;
- case UBLOCK_ETHIOPIC: scripts[SE_ETHIOPIC] = true; break;
- case UBLOCK_GOTHIC: scripts[SE_GOTHIC] = true; break;
- case UBLOCK_UGARITIC: scripts[SE_UGARITIC] = true; break;
-// case UBLOCK_MEROITIC: scripts[SE_MEROITIC] = true; break;
-// case UBLOCK_LINEARB: scripts[SE_LINEARB] = true; break;
-// case UBLOCK_CYPRIOT: scripts[SE_CYPRIOT] = true; break;
- case UBLOCK_RUNIC: scripts[SE_RUNIC] = true; break;
- case UBLOCK_OGHAM: scripts[SE_OGHAM] = true; break;
- case UBLOCK_THAANA: scripts[SE_THAANA] = true; break;
-// case UBLOCK_GLAGOLITIC: scripts[SE_GLAGOLITIC] = true; break;
-// case UBLOCK_TENGWAR: scripts[SE_TENGWAR] = true; break;
-// case UBLOCK_CIRTH: scripts[SE_CIRTH] = true; break;
+ case UBLOCK_ARMENIAN: scripts[SE_ARMENIAN] = true; break;
+ case UBLOCK_ETHIOPIC: scripts[SE_ETHIOPIC] = true; break;
+ case UBLOCK_GOTHIC: scripts[SE_GOTHIC] = true; break;
+ case UBLOCK_UGARITIC: scripts[SE_UGARITIC] = true; break;
+// case UBLOCK_MEROITIC: scripts[SE_MEROITIC] = true; break;
+ case UBLOCK_LINEAR_B_SYLLABARY: scripts[SE_LINEARB] = true; break;
+ case UBLOCK_CYPRIOT_SYLLABARY: scripts[SE_CYPRIOT] = true; break;
+ case UBLOCK_RUNIC: scripts[SE_RUNIC] = true; break;
+ case UBLOCK_OGHAM: scripts[SE_OGHAM] = true; break;
+ case UBLOCK_THAANA: scripts[SE_THAANA] = true; break;
+ case UBLOCK_GLAGOLITIC: scripts[SE_GLAGOLITIC] = true; break;
+// case UBLOCK_TENGWAR: scripts[SE_TENGWAR] = true; break;
+// case UBLOCK_CIRTH: scripts[SE_CIRTH] = true; break;
case UBLOCK_CJK_RADICALS_SUPPLEMENT:
case UBLOCK_KANGXI_RADICALS:
case UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS:
@@ -445,8 +463,8 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu
addTrans("Greek-Latin/ISO", &ID);
else if (option == SE_ALALC)
addTrans("Greek-Latin/ALALC", &ID);
- else if (option == SE_BGNPCGN)
- addTrans("Greek-Latin/BGNPCGN", &ID);
+ else if (option == SE_BGN)
+ addTrans("Greek-Latin/BGN", &ID);
else if (option == SE_IPA)
addTrans("Greek-IPA/Ancient", &ID);
else {
@@ -522,8 +540,8 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu
addTrans("Georgian-Latin/ISO", &ID);
else if (option == SE_ALALC)
addTrans("Georgian-Latin/ALALC", &ID);
- else if (option == SE_BGNPCGN)
- addTrans("Georgian-Latin/BGNPCGN", &ID);
+ else if (option == SE_BGN)
+ addTrans("Georgian-Latin/BGN", &ID);
else if (option == SE_IPA)
addTrans("Georgian-IPA", &ID);
else {
@@ -536,8 +554,8 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu
addTrans("Armenian-Latin/ISO", &ID);
else if (option == SE_ALALC)
addTrans("Armenian-Latin/ALALC", &ID);
- else if (option == SE_BGNPCGN)
- addTrans("Armenian-Latin/BGNPCGN", &ID);
+ else if (option == SE_BGN)
+ addTrans("Armenian-Latin/BGN", &ID);
else if (option == SE_IPA)
addTrans("Armenian-IPA", &ID);
else {
@@ -600,8 +618,8 @@ char UTF8Transliterator::processText(SWBuf &text, const SWKey *key, const SWModu
if (scripts[SE_THAANA]) {
if (option == SE_ALALC)
addTrans("Thaana-Latin/ALALC", &ID);
- else if (option == SE_BGNPCGN)
- addTrans("Thaana-Latin/BGNPCGN", &ID);
+ else if (option == SE_BGN)
+ addTrans("Thaana-Latin/BGN", &ID);
else {
addTrans("Thaana-Latin", &ID);
scripts[SE_LATIN] = true;
diff --git a/src/modules/filters/utf8utf16.cpp b/src/modules/filters/utf8utf16.cpp
index 5c1614c..a770d5f 100644
--- a/src/modules/filters/utf8utf16.cpp
+++ b/src/modules/filters/utf8utf16.cpp
@@ -2,12 +2,30 @@
*
* UTF8UTF16 - SWFilter descendant to convert UTF-8 to UTF-16
*
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
*/
#include <stdlib.h>
#include <stdio.h>
+#include <sysdata.h>
#include <utf8utf16.h>
+#include <utilstr.h>
#include <swbuf.h>
SWORD_NAMESPACE_START
@@ -15,61 +33,36 @@ SWORD_NAMESPACE_START
UTF8UTF16::UTF8UTF16() {
}
+
char UTF8UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
const unsigned char *from;
- unsigned long ch;
- signed short utf16;
- unsigned char from2[7];
-
SWBuf orig = text;
from = (const unsigned char *)orig.c_str();
// -------------------------------
- for (text = ""; *from; from++) {
- ch = 0;
- //case: ANSI
- if ((*from & 128) != 128) {
+ text = "";
+ while (*from) {
+
+ __u32 ch = getUniCharFromUTF8(&from);
+
+ if (!ch) continue; // invalid char
+
+ if (ch < 0x10000) {
text.setSize(text.size()+2);
- *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)*from;
- continue;
- }
- //case: Invalid UTF-8 (illegal continuing byte in initial position)
- if ((*from & 128) && ((*from & 64) != 64)) {
- continue;
+ *((__u16 *)(text.getRawData()+(text.size()-2))) = (__u16)ch;
}
- //case: 2+ byte codepoint
- from2[0] = *from;
- from2[0] <<= 1;
- int subsequent;
- for (subsequent = 1; (from2[0] & 128) && (subsequent < 7); subsequent++) {
- from2[0] <<= 1;
- from2[subsequent] = from[subsequent];
- from2[subsequent] &= 63;
- ch <<= 6;
- ch |= from2[subsequent];
+ else {
+ __u16 utf16;
+ utf16 = (__s16)((ch - 0x10000) / 0x400 + 0xD800);
+ text.setSize(text.size()+4);
+ *((__u16 *)(text.getRawData()+(text.size()-4))) = utf16;
+ utf16 = (__s16)((ch - 0x10000) % 0x400 + 0xDC00);
+ *((__u16 *)(text.getRawData()+(text.size()-2))) = utf16;
}
- subsequent--;
- from2[0] <<= 1;
- char significantFirstBits = 8 - (2+subsequent);
-
- ch |= (((short)from2[0]) << (((6*subsequent)+significantFirstBits)-8));
- from += subsequent;
- if (ch < 0x10000) {
- text.setSize(text.size()+2);
- *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)ch;
- }
- else {
- utf16 = (signed short)((ch - 0x10000) / 0x400 + 0xD800);
- text.setSize(text.size()+2);
- *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)utf16;
- utf16 = (signed short)((ch - 0x10000) % 0x400 + 0xDC00);
- text.setSize(text.size()+2);
- *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)utf16;
- }
}
text.setSize(text.size()+2);
- *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short)0;
+ *((__u16 *)(text.getRawData()+(text.size()-2))) = (__u16)0;
return 0;