summaryrefslogtreecommitdiff
path: root/src/modules/filters
diff options
context:
space:
mode:
authorDaniel Glassey <wdg@debian.org>2015-09-07 11:14:57 +0100
committerDaniel Glassey <wdg@debian.org>2015-09-07 11:14:57 +0100
commit7b6c8b08e9d29332dcd0a1029e7421334bfb6f61 (patch)
treedc263ee8b6c923716a8e0fed64756b7af1238dc7 /src/modules/filters
parent7a00574163029c0c2b649878c95d5acbd083564a (diff)
Imported Upstream version 1.7.3+dfsg
Diffstat (limited to 'src/modules/filters')
-rw-r--r--src/modules/filters/osisheadings.cpp18
-rw-r--r--src/modules/filters/osishtmlhref.cpp24
-rw-r--r--src/modules/filters/osismorphsegmentation.cpp8
-rw-r--r--src/modules/filters/osisplain.cpp4
-rw-r--r--src/modules/filters/osisrtf.cpp6
-rw-r--r--src/modules/filters/osisscripref.cpp6
-rw-r--r--src/modules/filters/osisxhtml.cpp36
-rw-r--r--src/modules/filters/teihtmlhref.cpp27
-rw-r--r--src/modules/filters/teirtf.cpp19
-rw-r--r--src/modules/filters/teixhtml.cpp22
-rw-r--r--src/modules/filters/thmlheadings.cpp26
-rw-r--r--src/modules/filters/thmlscripref.cpp6
-rw-r--r--src/modules/filters/thmlxhtml.cpp20
-rw-r--r--src/modules/filters/unicodertf.cpp3
-rw-r--r--src/modules/filters/utf16utf8.cpp5
-rw-r--r--src/modules/filters/utf8html.cpp3
-rw-r--r--src/modules/filters/utf8latin1.cpp5
-rw-r--r--src/modules/filters/utf8nfc.cpp17
-rw-r--r--src/modules/filters/utf8nfkd.cpp6
-rw-r--r--src/modules/filters/utf8utf16.cpp6
20 files changed, 158 insertions, 109 deletions
diff --git a/src/modules/filters/osisheadings.cpp b/src/modules/filters/osisheadings.cpp
index 783fa81..7a5f525 100644
--- a/src/modules/filters/osisheadings.cpp
+++ b/src/modules/filters/osisheadings.cpp
@@ -3,7 +3,7 @@
* osisheadings.cpp - SWFilter descendant to hide or show headings
* in an OSIS module
*
- * $Id: osisheadings.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: osisheadings.cpp 3194 2014-04-24 03:02:47Z greg.hellings $
*
* Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -91,6 +91,7 @@ bool OSISHeadings::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if (name == u->currentHeadingName) {
if (tag.isEndTag(u->sID)) {
if (!u->depth-- || u->sID) {
+ // see comment below about preverse div changed and needing to preserve the <title> container tag for old school pre-verse titles
// we've just finished a heading. It's all stored up in u->heading
bool canonical = (SWBuf("true") == u->currentHeadingTag.getAttribute("canonical"));
bool preverse = (SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subType") || SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subtype"));
@@ -98,7 +99,20 @@ bool OSISHeadings::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
// do we want to put anything in EntryAttributes?
if (u->module->isProcessEntryAttributes() && (option || canonical || !preverse)) {
SWBuf buf; buf.appendFormatted("%i", u->headerNum++);
- u->module->getEntryAttributes()["Heading"][(preverse)?"Preverse":"Interverse"][buf] = u->heading;
+ // leave the actual <title...> wrapper in if we're part of an old school preverse title
+ // because now frontend have to deal with preverse as a div which may or may not include <title> elements
+ // and they can't simply wrap all preverse material in <h1>, like they probably did previously
+ SWBuf heading;
+ if (u->currentHeadingName == "title") {
+ XMLTag wrapper = u->currentHeadingTag;
+ if (SWBuf("x-preverse") == wrapper.getAttribute("subType")) wrapper.setAttribute("subType", 0);
+ else if (SWBuf("x-preverse") == wrapper.getAttribute("subtype")) wrapper.setAttribute("subtype", 0);
+ heading = wrapper;
+ heading += u->heading;
+ heading += tag;
+ }
+ else heading = u->heading;
+ u->module->getEntryAttributes()["Heading"][(preverse)?"Preverse":"Interverse"][buf] = heading;
StringList attributes = u->currentHeadingTag.getAttributeNames();
for (StringList::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
diff --git a/src/modules/filters/osishtmlhref.cpp b/src/modules/filters/osishtmlhref.cpp
index 74b2da7..9cda9ab 100644
--- a/src/modules/filters/osishtmlhref.cpp
+++ b/src/modules/filters/osishtmlhref.cpp
@@ -2,9 +2,9 @@
*
* osishtmlhref.cpp - OSIS to HTML with hrefs filter
*
- * $Id: osishtmlhref.cpp 3005 2014-01-09 04:06:11Z greg.hellings $
+ * $Id: osishtmlhref.cpp 3173 2014-04-17 04:20:33Z greg.hellings $
*
- * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2003-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -289,7 +289,7 @@ 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")) {
+ else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && (!strcmp(tag.getAttribute("type"), "x-p") || !strcmp(tag.getAttribute("type"), "paragraph"))) {
// <div type="paragraph" sID... />
if (tag.getAttribute("sID")) { // non-empty start tag
outText("<!P><br />", buf, u);
@@ -481,9 +481,15 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
if (type == "bold" || type == "b" || type == "x-b") {
outText("<b>", buf, u);
}
- else if (type == "ol") {
+ else if (type == "ol" || type == "overline" || type == "x-overline") {
outText("<span style=\"text-decoration:overline\">", buf, u);
}
+ else if (type == "super") {
+ outText("<sup>", buf, u);
+ }
+ else if (type == "sub") {
+ outText("<sub>", buf, u);
+ }
else { // all other types
outText("<i>", buf, u);
}
@@ -503,7 +509,15 @@ bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserDat
else if (type == "ol") {
outText("</span>", buf, u);
}
- else outText("</i>", buf, u);
+ else if (type == "sup") {
+ outText("</sup>", buf, u);
+ }
+ else if (type == "sub") {
+ outText("</sub>", buf, u);
+ }
+ else {
+ outText("</i>", buf, u);
+ }
}
}
diff --git a/src/modules/filters/osismorphsegmentation.cpp b/src/modules/filters/osismorphsegmentation.cpp
index 9afc0a1..1d91428 100644
--- a/src/modules/filters/osismorphsegmentation.cpp
+++ b/src/modules/filters/osismorphsegmentation.cpp
@@ -4,7 +4,7 @@
* morphemes (for morpheme segmented Hebrew in
* the WLC)
*
- * $Id: osismorphsegmentation.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: osismorphsegmentation.cpp 3186 2014-04-17 04:33:19Z greg.hellings $
*
* Copyright 2006-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -78,13 +78,15 @@ char OSISMorphSegmentation::processText(SWBuf &text, const SWKey * /*key*/, cons
if (!strncmp(token.c_str(), "seg ", 4) || !strncmp(token.c_str(), "/seg", 4)) {
tag = token;
- if (!tag.isEndTag() && tag.getAttribute("type") && !strcmp("morph", tag.getAttribute("type"))) { //<seg type="morph"> start tag
+ if (!tag.isEndTag() && tag.getAttribute("type") &&
+ ( !strcmp("morph", tag.getAttribute("type"))
+ || !strcmp("x-morph", tag.getAttribute("type")))) { //<seg type="morph"> start tag
hide = !option; //only hide if option is Off
tagText = "";
inMorpheme = true;
}
- if (tag.isEndTag()) {
+ if (tag.isEndTag() && inMorpheme) {
buf.setFormatted("%.3d", morphemeNum++);
module->getEntryAttributes()["Morpheme"][buf]["body"] = tagText;
inMorpheme = false;
diff --git a/src/modules/filters/osisplain.cpp b/src/modules/filters/osisplain.cpp
index 6e583a4..24f5518 100644
--- a/src/modules/filters/osisplain.cpp
+++ b/src/modules/filters/osisplain.cpp
@@ -2,7 +2,7 @@
*
* osisplain.cpp - An SWFilter that provides stripping of OSIS tags
*
- * $Id: osisplain.cpp 2984 2013-09-20 12:18:45Z scribe $
+ * $Id: osisplain.cpp 3156 2014-04-17 03:50:37Z greg.hellings $
*
* Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -185,7 +185,7 @@ bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
// 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") &&
+ else if (!strcmp(u->tag.getName(), "div") && u->tag.getAttribute("type") && (!strcmp(u->tag.getAttribute("type"), "x-p") || !strcmp(u->tag.getAttribute("type"), "paragraph")) &&
(u->tag.isEmpty() && (u->tag.getAttribute("sID") || u->tag.getAttribute("eID")))) {
userData->supressAdjacentWhitespace = true;
buf.append('\n');
diff --git a/src/modules/filters/osisrtf.cpp b/src/modules/filters/osisrtf.cpp
index 291aa08..7bc5639 100644
--- a/src/modules/filters/osisrtf.cpp
+++ b/src/modules/filters/osisrtf.cpp
@@ -2,9 +2,9 @@
*
* osisrtf.cpp - OSIS to RTF filter
*
- * $Id: osisrtf.cpp 3005 2014-01-09 04:06:11Z greg.hellings $ *
+ * $Id: osisrtf.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ *
*
- * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2003-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -284,7 +284,7 @@ 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")) {
+ else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && (!strcmp(tag.getAttribute("type"), "x-p") || !strcmp(tag.getAttribute("type"), "paragraph"))) {
// <div type="paragraph" sID... />
if (tag.getAttribute("sID")) { // non-empty start tag
outText("{\\fi200\\par}", buf, u);
diff --git a/src/modules/filters/osisscripref.cpp b/src/modules/filters/osisscripref.cpp
index 2bb7d15..99d6709 100644
--- a/src/modules/filters/osisscripref.cpp
+++ b/src/modules/filters/osisscripref.cpp
@@ -3,9 +3,9 @@
* osisscripref.cpp - SWFilter descendant to hide or show scripture
* references in an OSIS module
*
- * $Id: osisscripref.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: osisscripref.cpp 3156 2014-04-17 03:50:37Z greg.hellings $
*
- * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2003-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -35,7 +35,7 @@ namespace {
static const char oTip[] = "Toggles Scripture Cross-references On and Off if they exist";
static const StringList *oValues() {
- static const SWBuf choices[3] = {"On", "Off", ""};
+ static const SWBuf choices[3] = {"Off", "On", ""};
static const StringList oVals(&choices[0], &choices[2]);
return &oVals;
}
diff --git a/src/modules/filters/osisxhtml.cpp b/src/modules/filters/osisxhtml.cpp
index b1040a9..3f75c4a 100644
--- a/src/modules/filters/osisxhtml.cpp
+++ b/src/modules/filters/osisxhtml.cpp
@@ -2,9 +2,9 @@
*
* osisxhtml.cpp - Render filter for classed XHTML of an OSIS module
*
- * $Id: osisxhtml.cpp 3005 2014-01-09 04:06:11Z greg.hellings $
+ * $Id: osisxhtml.cpp 3205 2014-05-01 02:31:28Z greg.hellings $
*
- * Copyright 2011-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2011-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -38,9 +38,7 @@ const char *OSISXHTML::getHeader() const {
.divineName { font-variant: small-caps; }\n\
.wordsOfJesus { color: red; }\n\
.transChangeSupplied { font-style: italic; }\n\
- .small, .sub, .sup { font-size: .83em }\n\
- .sub { vertical-align: sub }\n\
- .sup { vertical-align: super }\n\
+ .overline { text-decoration: overline; }\n\
.indent1 { margin-left: 10px }\n\
.indent2 { margin-left: 20px }\n\
.indent3 { margin-left: 30px }\n\
@@ -291,7 +289,7 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
URL::encode(vkey->getText()).c_str(),
ch,
ch,
- (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : ""));
+ (renderNoteNumbers ? noteName.c_str() : ""));
}
else {
buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>",
@@ -301,7 +299,7 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
URL::encode(u->key->getText()).c_str(),
ch,
ch,
- (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : ""));
+ (renderNoteNumbers ? noteName.c_str() : ""));
}
}
}
@@ -330,7 +328,7 @@ bool OSISXHTML::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")) {
+ else if (tag.isEmpty() && !strcmp(tag.getName(), "div") && tag.getAttribute("type") && (!strcmp(tag.getAttribute("type"), "x-p") || !strcmp(tag.getAttribute("type"), "paragraph"))) {
// <div type="paragraph" sID... />
if (tag.getAttribute("sID")) { // non-empty start tag
u->outputNewline(buf);
@@ -563,15 +561,15 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
// but we have used "ol" in the past, as well. Once a valid
// OSIS overline attribute is made available, these should all
// eventually be deprecated and never documented that they are supported.
- else if (type == "ol" || type == "overline" || type == "x-overline") {
- outText("<span style=\"text-decoration:overline\">", buf, u);
+ else if (type == "ol" || type == "overline" || type == "x-overline") {
+ outText("<span class=\"overline\">", buf, u);
}
else if (type == "super") {
- outText("<span class=\"sup\">", buf, u);
+ outText("<sup>", buf, u);
}
else if (type == "sub") {
- outText("<span class=\"sub\">", buf, u);
+ outText("<sub>", buf, u);
}
else { // all other types
outText("<i>", buf, u);
@@ -589,12 +587,18 @@ bool OSISXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
if (type == "bold" || type == "b" || type == "x-b") {
outText("</b>", buf, u);
}
- else if ( type == "ol"
- || type == "super"
- || type == "sub") {
+ else if (type == "ol") {
outText("</span>", buf, u);
}
- else outText("</i>", buf, u);
+ else if (type == "sup") {
+ outText("</sup>", buf, u);
+ }
+ else if (type == "sub") {
+ outText("</sub>", buf, u);
+ }
+ else {
+ outText("</i>", buf, u);
+ }
}
}
diff --git a/src/modules/filters/teihtmlhref.cpp b/src/modules/filters/teihtmlhref.cpp
index 43fe584..f08f994 100644
--- a/src/modules/filters/teihtmlhref.cpp
+++ b/src/modules/filters/teihtmlhref.cpp
@@ -2,7 +2,7 @@
*
* teihtmlhref.cpp - TEI to HTML with hrefs filter
*
- * $Id: teihtmlhref.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ * $Id: teihtmlhref.cpp 3160 2014-04-17 04:02:17Z greg.hellings $
*
* Copyright 2008-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -87,26 +87,29 @@ bool TEIHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData
SWBuf rend = tag.getAttribute("rend");
u->lastHi = rend;
- if (rend == "ital")
- buf += "<i>";
- else if (rend == "italic")
+ if (rend == "italic" || rend == "ital")
buf += "<i>";
else if (rend == "bold")
buf += "<b>";
- else if (rend == "sup")
- buf += "<small><sup>";
-
+ else if (rend == "super" || rend == "sup")
+ buf += "<sup>";
+ else if (rend == "sub")
+ buf += "<sub>";
+ else if (rend == "overline")
+ buf += "<span style=\"text-decoration:overline\">";
}
else if (tag.isEndTag()) {
SWBuf rend = u->lastHi;
- if (rend == "ital")
- buf += "</i>";
- else if (rend == "italic")
+ if (rend == "italic" || rend == "ital")
buf += "</i>";
else if (rend == "bold")
buf += "</b>";
- else if (rend == "sup")
- buf += "</sup></small>";
+ else if (rend == "super" || rend == "sup")
+ buf += "</sup>";
+ else if (rend == "sub")
+ buf += "</sub>";
+ else if (rend == "overline")
+ buf += "</span>";
}
}
diff --git a/src/modules/filters/teirtf.cpp b/src/modules/filters/teirtf.cpp
index 979e4a6..1213221 100644
--- a/src/modules/filters/teirtf.cpp
+++ b/src/modules/filters/teirtf.cpp
@@ -2,7 +2,7 @@
*
* teirtf.cpp - TEI to RTF filter
*
- * $Id: teirtf.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ * $Id: teirtf.cpp 3160 2014-04-17 04:02:17Z greg.hellings $
*
* Copyright 2006-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -76,13 +76,14 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use
else if (!strcmp(tag.getName(), "hi") || !strcmp(tag.getName(), "emph")) {
SWBuf rend = tag.getAttribute("rend");
if ((!tag.isEndTag()) && (!tag.isEmpty())) {
- if (rend == "ital" || rend == "italic")
+ if (rend == "italic" || rend == "ital")
buf += "{\\i1 ";
else if (rend == "bold")
buf += "{\\b1 ";
- else if (rend == "sup")
+ else if (rend == "super" || rend == "sup")
buf += "{\\super ";
-
+ else if (rend == "sub")
+ buf += "{\\sub ";
}
else if (tag.isEndTag()) {
buf += "}";
@@ -112,6 +113,16 @@ bool TEIRTF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *use
}
}
+ // <orth>
+ else if (!strcmp(tag.getName(), "orth")) {
+ if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+ buf += "{\\b1 ";
+ }
+ else if (tag.isEndTag()) {
+ buf += "}";
+ }
+ }
+
// <div>
else if (!strcmp(tag.getName(), "div")) {
diff --git a/src/modules/filters/teixhtml.cpp b/src/modules/filters/teixhtml.cpp
index 6a390a1..4ae0d89 100644
--- a/src/modules/filters/teixhtml.cpp
+++ b/src/modules/filters/teixhtml.cpp
@@ -2,7 +2,7 @@
*
* teixhtml.cpp - TEI to XHTML filter
*
- * $Id: teixhtml.cpp 2984 2013-09-20 12:18:45Z scribe $
+ * $Id: teixhtml.cpp 3161 2014-04-17 04:04:03Z greg.hellings $
*
* Copyright 2012-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -87,28 +87,28 @@ bool TEIXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *u
SWBuf rend = tag.getAttribute("rend");
u->lastHi = rend;
- if (rend == "ital")
- buf += "<i>";
- else if (rend == "italic")
+ if (rend == "italic" || rend == "ital")
buf += "<i>";
else if (rend == "bold")
buf += "<b>";
- else if (rend == "sup")
- buf += "<small><sup>";
+ else if (rend == "super" || rend == "sup")
+ buf += "<sup>";
+ else if (rend == "sub")
+ buf += "<sub>";
else if (rend == "overline")
buf += "<span style=\"text-decoration:overline\">";
}
else if (tag.isEndTag()) {
SWBuf rend = u->lastHi;
- if (rend == "ital")
- buf += "</i>";
- else if (rend == "italic")
+ if (rend == "italic" || rend == "ital")
buf += "</i>";
else if (rend == "bold")
buf += "</b>";
- else if (rend == "sup")
- buf += "</sup></small>";
+ else if (rend == "super" || rend == "sup")
+ buf += "</sup>";
+ else if (rend == "sub")
+ buf += "</sub>";
else if (rend == "overline")
buf += "</span>";
}
diff --git a/src/modules/filters/thmlheadings.cpp b/src/modules/filters/thmlheadings.cpp
index 46498d0..99bd12a 100644
--- a/src/modules/filters/thmlheadings.cpp
+++ b/src/modules/filters/thmlheadings.cpp
@@ -3,7 +3,7 @@
* thmlheadings.cpp - SWFilter descendant to hide or show headings
* in a ThML module
*
- * $Id: thmlheadings.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: thmlheadings.cpp 3195 2014-04-24 03:03:26Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -86,13 +86,22 @@ char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo
tag = token;
if (hide && tag.isEndTag()) {
if (module->isProcessEntryAttributes() && (option || (!preverse))) {
+ SWBuf heading;
+ SWBuf cls = startTag.getAttribute("class");
+ if (!cls.startsWith("fromEntryAttributes")) {
+ cls = SWBuf("fromEntryAttributes ") + cls;
+ startTag.setAttribute("class", cls);
+ }
+ heading += startTag;
+ heading += header;
+ heading += tag;
if (preverse) {
sprintf(buf, "%i", pvHeaderNum++);
- module->getEntryAttributes()["Heading"]["Preverse"][buf] = header;
+ module->getEntryAttributes()["Heading"]["Preverse"][buf] = heading;
}
else {
sprintf(buf, "%i", headerNum++);
- module->getEntryAttributes()["Heading"]["Interverse"][buf] = header;
+ module->getEntryAttributes()["Heading"]["Interverse"][buf] = heading;
if (option) { // we want the tag in the text
text.append(header);
}
@@ -143,8 +152,17 @@ char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo
}
*/
}
- else
+ else {
isheader = false;
+ SWBuf cls = tag.getAttribute("class");
+ if (cls.startsWith("fromEntryAttributes ")) {
+ cls << SWBuf("fromEntryAttributes ").size();
+ tag.setAttribute("class", cls);
+ token = tag;
+ token << 1;
+ token.setSize(token.size() - 1);
+ }
+ }
}
if (withinDiv && isheader) {
diff --git a/src/modules/filters/thmlscripref.cpp b/src/modules/filters/thmlscripref.cpp
index 1ea4a40..3a8b12a 100644
--- a/src/modules/filters/thmlscripref.cpp
+++ b/src/modules/filters/thmlscripref.cpp
@@ -3,9 +3,9 @@
* thmlscripref.cpp - SWFilter descendant to hide or show scripture
* referebces in a ThML module
*
- * $Id: thmlscripref.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: thmlscripref.cpp 3156 2014-04-17 03:50:37Z greg.hellings $
*
- * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2001-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -37,7 +37,7 @@ namespace {
static const char oTip[] = "Toggles Scripture Cross-references On and Off if they exist";
static const StringList *oValues() {
- static const SWBuf choices[3] = {"On", "Off", ""};
+ static const SWBuf choices[3] = {"Off", "On", ""};
static const StringList oVals(&choices[0], &choices[2]);
return &oVals;
}
diff --git a/src/modules/filters/thmlxhtml.cpp b/src/modules/filters/thmlxhtml.cpp
index b17eb50..eb9c40a 100644
--- a/src/modules/filters/thmlxhtml.cpp
+++ b/src/modules/filters/thmlxhtml.cpp
@@ -2,7 +2,7 @@
*
* thmlxhtml.cpp - ThML to classed XHTML
*
- * $Id: thmlxhtml.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: thmlxhtml.cpp 3205 2014-05-01 02:31:28Z greg.hellings $
*
* Copyright 2011-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -230,7 +230,7 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
URL::encode(vkey->getText()).c_str(),
ch,
ch,
- (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : ""));
+ (renderNoteNumbers ? noteName.c_str() : ""));
}
else {
char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
@@ -241,7 +241,7 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
URL::encode(u->key->getText()).c_str(),
ch,
ch,
- (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : ""));
+ (renderNoteNumbers ? noteName.c_str() : ""));
}
u->suspendTextPassThru = true;
}
@@ -289,7 +289,7 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
URL::encode(footnoteNumber.c_str()).c_str(),
URL::encode(u->version.c_str()).c_str(),
URL::encode(vkey->getText()).c_str(),
- (renderNoteNumbers ? URL::encode(noteName.c_str()).c_str() : ""));
+ (renderNoteNumbers ? noteName.c_str() : ""));
}
}
@@ -299,17 +299,19 @@ bool ThMLXHTML::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *
}
else if (tag.getName() && !strcmp(tag.getName(), "div")) {
if (tag.isEndTag() && u->SecHead) {
- buf += "</i></b><br />";
+ buf += "</h";
+ buf += u->SecHead;
+ buf += ">";
u->SecHead = false;
}
else if (tag.getAttribute("class")) {
if (!stricmp(tag.getAttribute("class"), "sechead")) {
- u->SecHead = true;
- buf += "<br /><b><i>";
+ u->SecHead = '3';
+ buf += "<h3>";
}
else if (!stricmp(tag.getAttribute("class"), "title")) {
- u->SecHead = true;
- buf += "<br /><b><i>";
+ u->SecHead = '2';
+ buf += "<h2>";
}
else {
buf += tag;
diff --git a/src/modules/filters/unicodertf.cpp b/src/modules/filters/unicodertf.cpp
index 997597b..1cde086 100644
--- a/src/modules/filters/unicodertf.cpp
+++ b/src/modules/filters/unicodertf.cpp
@@ -2,7 +2,7 @@
*
* unicodertf.cpp - SWFilter descendant to convert UTF-8 to RTF tags
*
- * $Id: unicodertf.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ * $Id: unicodertf.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,7 +20,6 @@
*
*/
-#include <stdlib.h>
#include <stdio.h>
#include <unicodertf.h>
#include <swbuf.h>
diff --git a/src/modules/filters/utf16utf8.cpp b/src/modules/filters/utf16utf8.cpp
index 6356284..d224db2 100644
--- a/src/modules/filters/utf16utf8.cpp
+++ b/src/modules/filters/utf16utf8.cpp
@@ -2,7 +2,7 @@
*
* utf16utf8.cpp - SWFilter descendant to convert UTF-16 to UTF-8
*
- * $Id: utf16utf8.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: utf16utf8.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,9 +21,6 @@
*/
-#include <stdlib.h>
-#include <stdio.h>
-
#include <utf16utf8.h>
#include <swbuf.h>
diff --git a/src/modules/filters/utf8html.cpp b/src/modules/filters/utf8html.cpp
index 1f05ac7..d504418 100644
--- a/src/modules/filters/utf8html.cpp
+++ b/src/modules/filters/utf8html.cpp
@@ -3,7 +3,7 @@
* utf8html.cpp - SWFilter descendant to convert a UTF-8 stream to
* HTML escapes
*
- * $Id: utf8html.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: utf8html.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,7 +21,6 @@
*
*/
-#include <stdlib.h>
#include <stdio.h>
#include <utf8html.h>
#include <swbuf.h>
diff --git a/src/modules/filters/utf8latin1.cpp b/src/modules/filters/utf8latin1.cpp
index 1bf8d3b..db5237c 100644
--- a/src/modules/filters/utf8latin1.cpp
+++ b/src/modules/filters/utf8latin1.cpp
@@ -2,7 +2,7 @@
*
* utf8latin1.cpp - SWFilter descendant to convert UTF-8 to Latin-1
*
- * $Id: utf8latin1.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: utf8latin1.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,9 +20,6 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-
#include <utf8latin1.h>
#include <swbuf.h>
diff --git a/src/modules/filters/utf8nfc.cpp b/src/modules/filters/utf8nfc.cpp
index 49f12bb..06bd76f 100644
--- a/src/modules/filters/utf8nfc.cpp
+++ b/src/modules/filters/utf8nfc.cpp
@@ -3,7 +3,7 @@
* utf8nfc.cpp - SWFilter descendant to perform NFC (canonical
* composition normalization) on UTF-8 text
*
- * $Id: utf8nfc.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ * $Id: utf8nfc.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,9 +23,6 @@
#ifdef _ICU_
-#include <stdlib.h>
-
-#include <utilstr.h>
#include <unicode/unistr.h>
#include <unicode/normlzr.h>
#include <unicode/unorm.h>
@@ -48,16 +45,16 @@ char UTF8NFC::processText(SWBuf &text, const SWKey *key, const SWModule *module)
if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
return -1;
- UErrorCode status = U_ZERO_ERROR;
- UnicodeString source(text.getRawData(), text.length(), conv, status);
+ err = U_ZERO_ERROR;
+ UnicodeString source(text.getRawData(), text.length(), conv, err);
UnicodeString target;
- status = U_ZERO_ERROR;
- Normalizer::normalize(source, UNORM_NFC, 0, target, status);
+ err = U_ZERO_ERROR;
+ Normalizer::normalize(source, UNORM_NFC, 0, target, err);
- status = U_ZERO_ERROR;
+ err = U_ZERO_ERROR;
text.setSize(text.size()*2); // potentially, it can grow to 2x the original size
- int32_t len = target.extract(text.getRawData(), text.size(), conv, status);
+ int32_t len = target.extract(text.getRawData(), text.size(), conv, err);
text.setSize(len);
return 0;
diff --git a/src/modules/filters/utf8nfkd.cpp b/src/modules/filters/utf8nfkd.cpp
index e4454d2..3a782ab 100644
--- a/src/modules/filters/utf8nfkd.cpp
+++ b/src/modules/filters/utf8nfkd.cpp
@@ -3,7 +3,7 @@
* utf8nfkd.cpp - SWFilter descendant to perform NFKD (compatability
* decomposition normalization) on UTF-8 text
*
- * $Id: utf8nfkd.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: utf8nfkd.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,10 +23,6 @@
#ifdef _ICU_
-#include <stdlib.h>
-
-#include <utilstr.h>
-
#include <utf8nfkd.h>
#include <swbuf.h>
diff --git a/src/modules/filters/utf8utf16.cpp b/src/modules/filters/utf8utf16.cpp
index be8ad4b..958f1d9 100644
--- a/src/modules/filters/utf8utf16.cpp
+++ b/src/modules/filters/utf8utf16.cpp
@@ -2,7 +2,7 @@
*
* utf8utf16.cpp - SWFilter descendant to convert UTF-8 to UTF-16
*
- * $Id: utf8utf16.cpp 2980 2013-09-14 21:51:47Z scribe $
+ * $Id: utf8utf16.cpp 3157 2014-04-17 03:56:12Z greg.hellings $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,10 +20,7 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <sysdata.h>
#include <utf8utf16.h>
#include <utilstr.h>
#include <swbuf.h>
@@ -68,7 +65,6 @@ char UTF8UTF16::processText(SWBuf &text, const SWKey *key, const SWModule *modul
text.setSize(text.size()-2);
return 0;
-
}
SWORD_NAMESPACE_END