[sword-cvs] sword/src/modules/filters osisfootnotes.cpp,1.1,1.2
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 18 Jun 2003 02:59:13 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv13989/src/modules/filters
Modified Files:
osisfootnotes.cpp
Log Message:
Working OSISFootnotes filter
Index: osisfootnotes.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisfootnotes.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** osisfootnotes.cpp 17 Jun 2003 22:14:18 -0000 1.1
--- osisfootnotes.cpp 18 Jun 2003 09:59:11 -0000 1.2
***************
*** 8,14 ****
#include <stdlib.h>
#include <string.h>
! #include <osisheadings.h>
#include <swmodule.h>
! #include <utilxml.h>
#ifndef __GNUC__
#else
--- 8,14 ----
#include <stdlib.h>
#include <string.h>
! #include <osisfootnotes.h>
#include <swmodule.h>
! #include <swbuf.h>
#ifndef __GNUC__
#else
***************
*** 44,83 ****
}
! char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *module)
! {
! SWBuf token;
! bool intoken = false;
! bool hide = false;
!
! SWBuf orig = text;
! const char *from = orig.c_str();
!
! /*for (text = ""; *from; from++) {
! if (*from == '<') {
! intoken = true;
! token = "";
! continue;
! }
! if (*from == '>') { // process tokens
! intoken = false;
! hide = (!option && !strincmp(token, "note"));
! // if not a footnote token, keep token in text
! if (!hide) {
! text += '<';
! text.append(token);
! text += '>';
}
- continue;
- }
- if (intoken) { //copy token
- token += *from;
- }
- else if (!hide) { //copy text which is not inside a token
- text += *from;
}
! else header += *from;
! }*/
return 0;
}
--- 44,88 ----
}
! char OSISFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! if (!option) { // if we don't want footnotes
! bool intoken = false;
! bool hide = false;
! SWBuf token;
! SWBuf orig = text;
! const char *from = orig.c_str();
! for (text = ""; *from; from++) {
! if (*from == '<') {
! intoken = true;
! token = "";
! continue;
! }
! else if (*from == '>') { // process tokens
! intoken = false;
! if (!strncmp(token.c_str(), "note", 4)) {
! hide = true;
! continue;
! }
! else if (!strncmp(token.c_str(), "/note", 5)) {
! hide = false;
! continue;
! }
! // if not a footnote token, keep token in text
! if (!hide) {
! text += '<';
! text += token;
! text += '>';
! }
! continue;
! }
! if (intoken) {
! token += *from; //copy chars of found token
! }
! else if (!hide) {
! text += *from;
}
}
! }
return 0;
}