Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

GBFHTMLHREF Class Reference

this filter converts GBF text to HTML text with hrefs. More...

#include <gbfhtmlhref.h>

Inheritance diagram for GBFHTMLHREF:

Inheritance graph
[legend]
Collaboration diagram for GBFHTMLHREF:

Collaboration graph
[legend]
List of all members.

Public Methods

 GBFHTMLHREF ()

Protected Methods

virtual bool handleToken (char **buf, const char *token, DualStringMap &userData)
 This function is called for every token encountered in the input text. More...


Detailed Description

this filter converts GBF text to HTML text with hrefs.

Definition at line 26 of file gbfhtmlhref.h.


Member Function Documentation

bool GBFHTMLHREF::handleToken char **    buf,
const char *    token,
DualStringMap &    userData
[protected, virtual]
 

This function is called for every token encountered in the input text.

Parameters:
buf  the output buffer (FIXME: what is its size?)
token  the token (e.g. "p align='left'"
userData  FIXME: document this
Returns:
false if was not handled and should be handled in the default way (by just substituting).

Reimplemented from SWBasicFilter.

Definition at line 60 of file gbfhtmlhref.cpp.

References SWBasicFilter::pushString().

00060                                                                                     {
00061         const char *tok;
00062 
00063         if (!substituteToken(buf, token)) {
00064                 if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
00065                         pushString(buf, " <small><em>&lt;<a href=\"#");
00066                         for (tok = token+1; *tok; tok++)
00067                                 //if(token[i] != '\"')
00068                                         *(*buf)++ = *tok;
00069                         *(*buf)++ = '\"';
00070                         *(*buf)++ = '>';
00071                         for (tok = token + 2; *tok; tok++)
00072                                 //if(token[i] != '\"')
00073                                         *(*buf)++ = *tok;
00074                         pushString(buf, "</a>&gt;</em></small>");
00075                 }
00076 
00077                 else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
00078                         pushString(buf, " <small><em>(<A HREF=\"#");
00079                         for (tok = token + 2; *tok; tok++)
00080                                 if(*tok != '\"')
00081                                         *(*buf)++ = *tok;
00082                         *(*buf)++ = '\"';
00083                         *(*buf)++ = '>';
00084                         for (tok = token + 3; *tok; tok++)
00085                                 if(*tok != '\"')
00086                                         *(*buf)++ = *tok;
00087                         pushString(buf, "</a>)</em></small>");
00088                 }
00089 
00090                 else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags
00091                         pushString(buf, " <small><em>(<a href=\"M");
00092                         for (tok = token + 2; *tok; tok++)
00093                                 if(*tok != '\"')
00094                                         *(*buf)++ = *tok;
00095                         *(*buf)++ = '\"';
00096                         *(*buf)++ = '>';
00097                         for (tok = token + 2; *tok; tok++)                              
00098                                 if(*tok != '\"')                        
00099                                         *(*buf)++ = *tok;               
00100                         pushString(buf, "</a>)</em></small>");
00101                 }
00102 
00103                 else if (!strncmp(token, "RX", 2)) {
00104                         pushString(buf, "<a href=\"");
00105                         for (tok = token + 3; *tok; tok++) {
00106                           if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') {
00107                             *(*buf)++ = *tok;
00108                           }
00109                           else {
00110                             break;
00111                           }
00112                         }
00113                         *(*buf)++ = '\"';
00114                         *(*buf)++ = '>';
00115                 }
00116 
00117                 else if (!strncmp(token, "RB", 2)) {
00118                         pushString(buf, "<i>");
00119                         userData["hasFootnotePreTag"] = "true";
00120                 }
00121 
00122                 else if (!strncmp(token, "RF", 2)) {
00123                         if(userData["hasFootnotePreTag"] == "true") {
00124                                 userData["hasFootnotePreTag"] = "false";
00125                                 pushString(buf, "</i> ");
00126                         }
00127                         pushString(buf, "<font color=\"#800000\"><small> (");
00128                 }
00129 
00130                 else if (!strncmp(token, "FN", 2)) {
00131                         pushString(buf, "<font face=\"");
00132                         for (tok = token + 2; *tok; tok++)                              
00133                                 if(*tok != '\"')                        
00134                                         *(*buf)++ = *tok;
00135                         *(*buf)++ = '\"';
00136                         *(*buf)++ = '>';
00137                 }
00138 
00139                 else if (!strncmp(token, "CA", 2)) {    // ASCII value
00140                         *(*buf)++ = (char)atoi(&token[2]);
00141                 }
00142                 
00143                 else {
00144                         return false;
00145                 }
00146         }
00147         return true;
00148 }


The documentation for this class was generated from the following files:
Generated on Thu Jun 20 22:13:02 2002 for The Sword Project by doxygen1.2.15