summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/nasb/cutil/nasbosis.cpp86
1 files changed, 68 insertions, 18 deletions
diff --git a/modules/nasb/cutil/nasbosis.cpp b/modules/nasb/cutil/nasbosis.cpp
index 0d408c4..c72e48d 100644
--- a/modules/nasb/cutil/nasbosis.cpp
+++ b/modules/nasb/cutil/nasbosis.cpp
@@ -572,10 +572,16 @@ int main(int argc, char **argv) {
if ((intag)&&(!strncmp(lastToken.c_str(), "transChange", 11))) {
transChangeStart = i+1;
}
+/*
+ if (!strncmp(lastToken.c_str(), "seg", 3)) {
+ strongsFound = false;
+ strongsStart = i+1;
+ }
if (!strncmp(lastToken.c_str(), "divineName", 10)) {
strongsFound = false;
strongsStart = i+1;
}
+*/
if (!strncmp(lastToken.c_str(), "/divineName", 10)) {
strongsFound = false;
strongsStart = i+1;
@@ -610,16 +616,19 @@ int main(int argc, char **argv) {
strongsFound = false;
strongsStart = i+1;
}
- if ((!strncmp(lastToken.c_str(), "seg", 3)) ||
- (!strncmp(lastToken.c_str(), "verse", 5))) {
+ if ((!strncmp(lastToken.c_str(), "verse", 5))) {
intag = false;
}
- // fix tenseChange to be inside <w> so we can include a subset of the <w> content.
- if ((!strncmp(lastToken.c_str(), "MG", 2)) ||
+ if ( (!strncmp(lastToken.c_str(), "MG", 2)) ||
(!strncmp(lastToken.c_str(), "MH", 2))) {
+
+ // insert </w>
+ // fix tenseChange to be inside <w> so we can include a subset of the <w> content.
outstring.replace(tokenStart-1, lastToken.length()+2, ((tenseChange > -1) ? "</w></transChange>":"</w>"));
i = (tokenStart-1) + ((tenseChange > -1) ? 18:4);
+
+ // build <w ... > tag
char lang = lastToken[1]; // H or G
lastToken.replace(0, 1, "<w lemma=\"strong:");
while ((start = lastToken.find(", ")) > -1) {
@@ -627,6 +636,8 @@ int main(int argc, char **argv) {
}
lastToken += "\">";
intag = false;
+
+
if (tenseChange > -1) {
lastToken.insert(0, "<transChange type=\"tenseChange\">");
}
@@ -635,11 +646,13 @@ int main(int argc, char **argv) {
intag = true;
i += lastToken.length() - 1; // (-1 because we're about to i++)
}
+
+ // insert our token
else {
outstring.insert(strongsStart, lastToken);
i += lastToken.length() - 1; // (-1 because we're about to i++)
}
- strongsStart = i;
+ strongsStart = i+1;
strongsFound = false;
if (tenseChange > -1) {
// relocate because position may have changed from all the token inserts
@@ -653,6 +666,27 @@ int main(int argc, char **argv) {
}
+ // clean up stuff that didn't work quite right
+ while (1) {
+
+ // divineName strongs tags misorderings
+ string target = "</w></divineName></seg>";
+ size_t s = outstring.find(target);
+ if (s != string::npos) {
+ outstring.replace(s, target.length(), "</divineName></seg></w>");
+ continue;
+ }
+ target = "</w>,</divineName></seg>";
+ s = outstring.find(target);
+ if (s != string::npos) {
+ outstring.replace(s, target.length(), "</divineName></seg></w>,");
+ continue;
+ }
+
+ break;
+ }
+
+
std::cout << outstring;
if (!result) std::cout << "\n";
}
@@ -718,7 +752,7 @@ void unicodeTicks(string &outstring) {
const char *found = strstr(outstr, "L\\{ORD'S}/");
int start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 10, "<divineName>Lord's</divineName>");
+ outstring.replace(start, 10, "<seg><divineName>Lord's</divineName></seg>");
continue;
}
@@ -819,33 +853,49 @@ void prepLine(string &outstring, int currentTestament, bool note) {
continue;
}
+ // ~“
+ string target = "~“";
+ s = outstring.find(target);
+ if (s != string::npos) {
+ outstring.replace(s, target.length(), "<milestone type=\"cQuote\" marker=\"“\"/>");
+ continue;
+ }
+
+ // ~‘
+ target = "~‘";
+ s = outstring.find(target);
+ if (s != string::npos) {
+ outstring.replace(s, target.length(), "<milestone type=\"cQuote\" marker=\"‘\"/>");
+ continue;
+ }
+
const char *outstr = outstring.c_str();
const char *found = strstr(outstr, "L\\{ORD}/'\\{S}/");
int start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 14, "<divineName>Lord's</divineName>");
+ outstring.replace(start, 14, "<seg><divineName>Lord's</divineName></seg>");
continue;
}
outstr = outstring.c_str();
found = strstr(outstr, "L\\{ORD}/");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 8, "<divineName>Lord</divineName>,");
+ outstring.replace(start, 8, "<seg><divineName>Lord</divineName></seg>,");
continue;
}
outstr = outstring.c_str();
found = strstr(outstr, "Y\\{AH,}/");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 8, "<divineName>Yah</divineName>,");
+ outstring.replace(start, 8, "<seg><divineName>Yah</divineName></seg>,");
continue;
}
outstr = outstring.c_str();
found = strstr(outstr, "Y\\{AH}/");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 7, "<divineName>Yah</divineName>");
+ outstring.replace(start, 7, "<seg><divineName>Yah</divineName></seg>");
continue;
}
// is this really valid markup? should 'also be' be in small
@@ -854,28 +904,28 @@ void prepLine(string &outstring, int currentTestament, bool note) {
found = strstr(outstr, "L\\{ORD {also be}/}");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 18, "<divineName>Lord</divineName> also be}");
+ outstring.replace(start, 18, "<seg><divineName>Lord</divineName></seg> also be}");
continue;
}
outstr = outstring.c_str();
found = strstr(outstr, "L\\{ORD {give}/}");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 15, "<divineName>Lord</divineName> give}");
+ outstring.replace(start, 15, "<seg><divineName>Lord</divineName></seg> give}");
continue;
}
outstr = outstring.c_str();
found = strstr(outstr, "L\\{ORD {bless}/}");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 16, "<divineName>Lord</divineName> bless}");
+ outstring.replace(start, 16, "<seg><divineName>Lord</divineName></seg> bless}");
continue;
}
outstr = outstring.c_str();
found = strstr(outstr, "L\\{ORD {are my Refuge; You have made the Most High your dwelling place}/}");
start = (found) ? (found - outstr) : -1;
if (start > -1) {
- outstring.replace(start, 73, "<divineName>Lord</divineName> are my Refuge; You have made the Most High your dwelling place}");
+ outstring.replace(start, 73, "<seg><divineName>Lord</divineName></seg> are my Refuge; You have made the Most High your dwelling place}");
continue;
}
// LB ??? Don't have info on this. Assuming '-'
@@ -903,8 +953,8 @@ void prepLine(string &outstring, int currentTestament, bool note) {
start += 22;
}
else {
- outstring.insert(start, "<divineName>");
- start += 12;
+ outstring.insert(start, "<seg><divineName>");
+ start += 17;
const char *b = outstring.c_str();
const char *found = strstr(b, "L\\{ORD}/");
int s = (found) ? (found - b) : -1;
@@ -949,8 +999,8 @@ void prepLine(string &outstring, int currentTestament, bool note) {
end+=6;
}
else {
- outstring.insert(end, "</divineName>");
- end+=13;
+ outstring.insert(end, "</divineName></seg>");
+ end+=19;
}
continue;
}