[sword-cvs] sword/src/modules/filters osisheadings.cpp,1.1,1.2 osismorph.cpp,1.3,1.4
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 27 May 2003 18:53:02 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv20826/src/modules/filters
Modified Files:
osisheadings.cpp osismorph.cpp
Log Message:
Index: osisheadings.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisheadings.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** osisheadings.cpp 30 Apr 2003 08:20:03 -0000 1.1
--- osisheadings.cpp 28 May 2003 01:53:00 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
#include <osisheadings.h>
#include <swmodule.h>
+ #include <utilxml.h>
#ifndef __GNUC__
#else
***************
*** 66,107 ****
intoken = false;
! if (!strnicmp(token, "title type=\"section\" subtype=\"x-preverse\"", 39)) {
! hide = true;
! preverse = true;
! header = "";
! continue;
! }
!
! if (!strnicmp(token, "title type=\"section\"", 20)) {
! hide = true;
! header = "";
! if (option) { // we want the tag in the text
! text += '<';
! text.append(token);
! text += '>';
! }
! continue;
! }
!
! else if (hide && !strnicmp(token, "/title", 6)) {
!
! if (module->isProcessEntryAttributes() && option) {
! if (preverse) {
! sprintf(buf, "%i", pvHeaderNum++);
! module->getEntryAttributes()["Heading"]["Preverse"][buf] = header;
}
else {
! sprintf(buf, "%i", headerNum++);
! module->getEntryAttributes()["Heading"]["Interverse"][buf] = header;
}
}
!
! hide = false;
! if ((!option) || (preverse)) { // we don't want the tag in the text anymore
preverse = false;
- continue;
}
- preverse = false;
}
--- 67,109 ----
intoken = false;
! XMLTag tag(token);
! if (!stricmp(tag.getName(), "title")) {
! if (!stricmp(tag.getAttribute("type"), "section")) {
! if (!stricmp(tag.getAttribute("subtype"), "x-preverse")) {
! hide = true;
! preverse = true;
! header = "";
! continue;
}
else {
! hide = true;
! header = "";
! if (option) { // we want the tag in the text
! text += '<';
! text.append(token);
! text += '>';
! }
! continue;
}
}
+ if (hide && tag.isEndTag()) {
! if (module->isProcessEntryAttributes() && option) {
! if (preverse) {
! sprintf(buf, "%i", pvHeaderNum++);
! module->getEntryAttributes()["Heading"]["Preverse"][buf] = header;
! }
! else {
! sprintf(buf, "%i", headerNum++);
! module->getEntryAttributes()["Heading"]["Interverse"][buf] = header;
! }
! }
! hide = false;
! if ((!option) || (preverse)) { // we don't want the tag in the text anymore
! preverse = false;
! continue;
! }
preverse = false;
}
}
Index: osismorph.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osismorph.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** osismorph.cpp 27 Feb 2003 00:56:31 -0000 1.3
--- osismorph.cpp 28 May 2003 01:53:00 -0000 1.4
***************
*** 9,12 ****
--- 9,13 ----
#include <string.h>
#include <osismorph.h>
+ #include <utilxml.h>
#ifndef __GNUC__
#else
***************
*** 46,50 ****
if (!option) { // if we don't want morph tags
const char *from;
! char token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
--- 47,51 ----
if (!option) { // if we don't want morph tags
const char *from;
! char token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
***************
*** 64,82 ****
if (*from == '>') { // process tokens
intoken = false;
! if (*token == 'w' && token[1] == ' ') { // Morph
! char *num = strstr(token, "morph=\"x-Robinson:");
! if (num) {
! for (int i = 0; i < 18; i++)
! *num++ = ' ';
! for (; ((*num) && (*num!='\"')); num++)
! *num = ' ';
! if (*num)
! *num = ' ';
! }
}
! // if not a morph tag token, keep token in text
! text += '<';
! text += token;
! text += '>';
continue;
}
--- 65,75 ----
if (*from == '>') { // process tokens
intoken = false;
! XMLTag tag(token);
! if ((!strcmp(tag.getName(), "w")) && (!tag.isEndTag())) { // Morph
! if (tag.getAttribute("morph"))
! tag.setAttribute("morph", 0);
}
! // keep tag, possibly with the morph removed
! text += tag;
continue;
}