[sword-cvs] sword/src/modules/filters plainfootnotes.cpp,1.9,1.10 plainhtml.cpp,1.7,1.8 rtfhtml.cpp,1.5,1.6 thmlheadings.cpp,1.6,1.7 thmlvariants.cpp,1.5,1.6 utf8html.cpp,1.6,1.7 utf8latin1.cpp,1.6,1.7
sword@www.crosswire.org
sword@www.crosswire.org
Sat, 8 Mar 2003 16:58:26 -0700
- Previous message: [sword-cvs] sword/src/modules/filters thmlfootnotes.cpp,1.6,1.7 thmlhtmlhref.cpp,1.25,1.26 thmllemma.cpp,1.5,1.6 thmlmorph.cpp,1.6,1.7 utf8greekaccents.cpp,1.7,1.8
- Next message: [sword-cvs] sword/locales.d cs.conf,1.3,1.4 ro.conf,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv31235
Modified Files:
plainfootnotes.cpp plainhtml.cpp rtfhtml.cpp thmlheadings.cpp
thmlvariants.cpp utf8html.cpp utf8latin1.cpp
Log Message:
fixd some filter stuff, esp. fixed char token[2048] cheese ;)
Index: plainfootnotes.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/plainfootnotes.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** plainfootnotes.cpp 20 Feb 2003 12:31:54 -0000 1.9
--- plainfootnotes.cpp 8 Mar 2003 23:58:24 -0000 1.10
***************
*** 56,92 ****
char PLAINFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
- char token[2048];
- int tokpos = 0;
- bool intoken = false;
- bool lastspace = false;
-
if (!option) { // if we don't want footnotes
bool hide = false;
- const char *from;
SWBuf orig = text;
! from = orig.c_str();
for (text = ""; *from; from++) {
! if (*from == '{') // Footnote start
{
hide = true;
continue;
}
! if (*from == '}') // Footnote end
{
! hide=false;
continue;
}
! if (intoken) {
! if (tokpos < 2045)
! token[tokpos++] = *from;
! token[tokpos+2] = 0;
! }
! else {
if (!hide) {
text = *from;
! lastspace = (*from == ' ');
}
! }
}
}
--- 56,93 ----
char PLAINFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
if (!option) { // if we don't want footnotes
+ //char token[2048];
+ //SWBuf token;
+ //int tokpos = 0;
+ //bool intoken = false;
+ //bool lastspace = false;
+
bool hide = false;
SWBuf orig = text;
! const char *from = orig.c_str();
for (text = ""; *from; from++) {
! if (*from == '{') // Footnote start
{
hide = true;
continue;
}
! else if (*from == '}') // Footnote end
{
! hide = false;
continue;
}
!
! //if (intoken) {
! //if (tokpos < 2045)
! // token += *from;
! // token[tokpos+2] = 0;
! //}
! //else {
if (!hide) {
text = *from;
! //lastspace = (*from == ' ');
}
! //}
}
}
Index: plainhtml.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/plainhtml.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** plainhtml.cpp 20 Feb 2003 12:31:54 -0000 1.7
--- plainhtml.cpp 8 Mar 2003 23:58:24 -0000 1.8
***************
*** 29,38 ****
int count = 0;
- const char *from;
SWBuf orig = text;
! from = orig.c_str();
! for (text = ""; *from; from++)
{
! if ((*from == '\n') && (from[1] == '\n')) // paragraph
{
text += "<P>";
--- 29,37 ----
int count = 0;
SWBuf orig = text;
! const char *from = orig.c_str();
! for (text = ""; *from; from++)
{
! if ((*from == '\n') && (from[1] == '\n')) // two newlinea are a paragraph
{
text += "<P>";
***************
*** 40,44 ****
continue;
} else {
! if ((*from == '\n')) // && (from[1] != '\n')) // new line
{
text += "<BR>";
--- 39,43 ----
continue;
} else {
! if ((*from == '\n')) // && (from[1] != '\n')) // only one new line
{
text += "<BR>";
***************
*** 47,62 ****
}
! if (*from == '{') {
! text += "<FONT COLOR=#80000><SMALL> (";
continue;
}
!
! if (*from == '}')
{
text += ") </SMALL></FONT>";
continue;
}
!
! if ((*from == ' ') && (count > 5000))
{
text += "<WBR>";
--- 46,59 ----
}
! if (*from == '{') { //footnote start
! text += "<FONT COLOR=\"#80000\"><SMALL> (";
continue;
}
! else if (*from == '}') //footnote end
{
text += ") </SMALL></FONT>";
continue;
}
! else if ((*from == ' ') && (count > 5000))
{
text += "<WBR>";
Index: rtfhtml.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/rtfhtml.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rtfhtml.cpp 21 Feb 2003 10:30:43 -0000 1.5
--- rtfhtml.cpp 8 Mar 2003 23:58:24 -0000 1.6
***************
*** 38,43 ****
if (*from == '\\') // a RTF command
{
! if ((from[1] == 'p') && (from[2] == 'a') && (from[3] == 'r') && (from[4] == 'd'))
! { // switch all modifier off
if (center)
{
--- 38,44 ----
if (*from == '\\') // a RTF command
{
! if ( !strncmp(from+1, "pard", 4) )
! //(from[1] == 'p') && (from[2] == 'a') && (from[3] == 'r') && (from[4] == 'd'))
! { // switch all modifiers off
if (center)
{
***************
*** 48,52 ****
continue;
}
! if ((from[1] == 'p') && (from[2] == 'a') && (from[3] == 'r'))
{
text += "<P>\n";
--- 49,54 ----
continue;
}
! if ( !strncmp(from+1, "par", 3) )
! //(from[1] == 'p') && (from[2] == 'a') && (from[3] == 'r'))
{
text += "<P>\n";
***************
*** 59,63 ****
continue;
}
! if ((from[1] == 'q') && (from[2] == 'c')) // center on
{
if (!center)
--- 61,66 ----
continue;
}
! if ( !strncmp(from+1, "qc", 2) )
! //(from[1] == 'q') && (from[2] == 'c')) // center on
{
if (!center)
Index: thmlheadings.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlheadings.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** thmlheadings.cpp 26 Feb 2003 05:44:29 -0000 1.6
--- thmlheadings.cpp 8 Mar 2003 23:58:24 -0000 1.7
***************
*** 45,64 ****
{
if (!option) { // if we don't want headings
! const char *from;
! char token[2048]; // cheese. Fix.
! int tokpos = 0;
bool intoken = false;
bool hide = false;
SWBuf orig = text;
! from = orig.c_str();
for (text = ""; *from; from++) {
if (*from == '<') {
intoken = true;
! tokpos = 0;
! token[0] = 0;
! token[1] = 0;
! token[2] = 0;
continue;
}
--- 45,59 ----
{
if (!option) { // if we don't want headings
! 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;
}
***************
*** 66,79 ****
intoken = false;
if (!strnicmp(token, "div class=\"sechead\"", 19)) {
! hide = true;
! continue;
}
if (!strnicmp(token, "div class=\"title\"", 17)) {
! hide = true;
! continue;
}
else if (hide && !strnicmp(token, "/div", 4)) {
! hide = false;
! continue;
}
--- 61,75 ----
intoken = false;
if (!strnicmp(token, "div class=\"sechead\"", 19)) {
! hide = true;
! continue;
}
+
if (!strnicmp(token, "div class=\"title\"", 17)) {
! hide = true;
! continue;
}
else if (hide && !strnicmp(token, "/div", 4)) {
! hide = false;
! continue;
}
***************
*** 81,98 ****
if (!hide) {
text += '<';
! text += token;
text += '>';
}
continue;
}
! if (intoken) {
! if (tokpos < 2045)
! token[tokpos++] = *from;
! token[tokpos+2] = 0;
}
! else {
! if (!hide) {
! text += *from;
! }
}
}
--- 77,90 ----
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;
}
}
Index: thmlvariants.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlvariants.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** thmlvariants.cpp 23 Feb 2003 11:54:20 -0000 1.5
--- thmlvariants.cpp 8 Mar 2003 23:58:24 -0000 1.6
***************
*** 103,106 ****
--- 103,109 ----
}
+
+ //the above code should work, it combines this part in it. (jansorg)
+
/* else if (option == 1) { //we want variant only
bool intoken = false;
Index: utf8html.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/utf8html.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** utf8html.cpp 26 Feb 2003 19:54:04 -0000 1.6
--- utf8html.cpp 8 Mar 2003 23:58:24 -0000 1.7
***************
*** 28,32 ****
SWBuf orig = text;
! from = (unsigned char *)orig.c_str();
// -------------------------------
--- 28,32 ----
SWBuf orig = text;
! from = (unsigned char *)orig.c_str();
// -------------------------------
Index: utf8latin1.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/utf8latin1.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** utf8latin1.cpp 26 Feb 2003 19:54:04 -0000 1.6
--- utf8latin1.cpp 8 Mar 2003 23:58:24 -0000 1.7
***************
*** 24,32 ****
unsigned char significantFirstBits, subsequent;
! if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
! return -1;
len = strlen(text.c_str()) + 1; // shift string to right of buffer
! SWBuf orig = text;
from = (unsigned char*)orig.c_str();
--- 24,33 ----
unsigned char significantFirstBits, subsequent;
! if ((unsigned long)key < 2) {// hack, we're en(1)/de(0)ciphering
! return -1;
! }
len = strlen(text.c_str()) + 1; // shift string to right of buffer
! SWBuf orig = text;
from = (unsigned char*)orig.c_str();
***************
*** 71,72 ****
--- 72,74 ----
SWORD_NAMESPACE_END
+
- Previous message: [sword-cvs] sword/src/modules/filters thmlfootnotes.cpp,1.6,1.7 thmlhtmlhref.cpp,1.25,1.26 thmllemma.cpp,1.5,1.6 thmlmorph.cpp,1.6,1.7 utf8greekaccents.cpp,1.7,1.8
- Next message: [sword-cvs] sword/locales.d cs.conf,1.3,1.4 ro.conf,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]