[sword-cvs] sword/src/modules/filters osislemma.cpp,NONE,1.1 osisredletterwords.cpp,NONE,1.1 osisscripref.cpp,NONE,1.1
sword@www.crosswire.org
sword@www.crosswire.org
Thu, 26 Jun 2003 23:18:07 -0700
- Previous message: [sword-cvs] sword/src/modules/filters cipherfil.cpp,1.18,1.19 gbffootnotes.cpp,1.17,1.18 gbfheadings.cpp,1.8,1.9 gbfmorph.cpp,1.9,1.10 gbfosis.cpp,1.16,1.17 gbfplain.cpp,1.16,1.17 gbfredletterwords.cpp,1.5,1.6 gbfrtf.cpp,1.33,1.34 gbfstrongs.cpp,1.21,1.22 greeklexattribs.cpp,1.15,1.16 latin1utf16.cpp,1.7,1.8 latin1utf8.cpp,1.12,1.13 osisheadings.cpp,1.5,1.6 osishtmlhref.cpp,1.6,1.7 osismorph.cpp,1.6,1.7 osisrtf.cpp,1.8,1.9 osisstrongs.cpp,1.5,1.6 scsuutf8.cpp,1.8,1.9 thmlfootnotes.cpp,1.10,1.11 thmlheadings.cpp,1.9,1.10 thmllemma.cpp,1.7,1.8 thmlmorph.cpp,1.12,1.13 thmlosis.cpp,1.24,1.25 thmlplain.cpp,1.10,1.11 thmlscripref.cpp,1.10,1.11 thmlstrongs.cpp,1.15,1.16 thmlvariants.cpp,1.8,1.9 unicodertf.cpp,1.15,1.16 utf16utf8.cpp,1.9,1.10 utf8arshaping.cpp,1.7,1.8 utf8bidireorder.cpp,1.7,1.8 utf8cantillation.cpp,1.6,1.7 utf8greekaccents.cpp,1.8,1.9 utf8hebrewpoints.cpp,1.8,1.9 utf8html.cpp,1.7,1.8 utf8latin1.cpp,1.7,1.8 utf8nfc.cpp,1.9,1.10 utf8nfkd.cpp,1.9,1.10 utf8transliterator.cpp,1.28,1.29 utf8utf16.cpp,1.8,1.9
- Next message: [sword-cvs] sword/include osislemma.h,NONE,1.1 osisredletterwords.h,NONE,1.1 osisscripref.h,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv2984
Added Files:
osislemma.cpp osisredletterwords.cpp osisscripref.cpp
Log Message:
OSIS filters for lemmas, scripture references, & red words of Christ
--- NEW FILE: osislemma.cpp ---
/******************************************************************************
*
* osislemma - SWFilter descendant to hide or show lemmata
* in a OSIS module.
*/
#include <stdlib.h>
#include <osislemma.h>
#include <utilxml.h>
#ifndef __GNUC__
#else
#include <unixstr.h>
#endif
SWORD_NAMESPACE_START
const char OSISLemma::on[] = "On";
const char OSISLemma::off[] = "Off";
const char OSISLemma::optName[] = "Lemmas";
const char OSISLemma::optTip[] = "Toggles Lemmas On and Off if they exist";
OSISLemma::OSISLemma() {
option = false;
options.push_back(on);
options.push_back(off);
}
OSISLemma::~OSISLemma() {
}
void OSISLemma::setOptionValue(const char *ival)
{
option = (!stricmp(ival, on));
}
const char *OSISLemma::getOptionValue()
{
return (option) ? on:off;
}
char OSISLemma::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
if (!option) { // if we don't want lemmas
const char *from;
char token[2048]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
bool lastspace = false;
SWBuf orig = text;
from = orig.c_str();
for (text = ""; *from; from++) {
if (*from == '<') {
intoken = true;
tokpos = 0;
token[0] = 0;
continue;
}
if (*from == '>') { // process tokens
intoken = false;
XMLTag tag(token);
if ((!strcmp(tag.getName(), "w")) && (!tag.isEndTag())) { // Lemma
if (tag.getAttribute("lemma"))
tag.setAttribute("lemma", 0);
}
// keep tag, possibly with the lemma removed
text += tag;
continue;
}
if (intoken) {
if (tokpos < 2045)
token[tokpos++] = *from;
token[tokpos] = 0;
}
else {
text += *from;
lastspace = (*from == ' ');
}
}
}
return 0;
}
SWORD_NAMESPACE_END
--- NEW FILE: osisredletterwords.cpp ---
/******************************************************************************
*
* OSISRedLetterWords - SWFilter descendant to toggle red coloring for words
* of Christ in an OSIS module.
*/
#include <stdlib.h>
#include <osisredletterwords.h>
#include <swmodule.h>
#include <utilxml.h>
#ifndef __GNUC__
#else
#include <unixstr.h>
#endif
SWORD_NAMESPACE_START
const char OSISRedLetterWords::on[] = "On";
const char OSISRedLetterWords::off[] = "Off";
const char OSISRedLetterWords::optName[] = "Words of Christ in Red";
const char OSISRedLetterWords::optTip[] = "Toggles Red Coloring for Words of Christ On and Off if they are marked";
OSISRedLetterWords::OSISRedLetterWords() {
option = false;
options.push_back(on);
options.push_back(off);
}
OSISRedLetterWords::~OSISRedLetterWords() {
}
void OSISRedLetterWords::setOptionValue(const char *ival)
{
option = (!stricmp(ival, on));
}
const char *OSISRedLetterWords::getOptionValue()
{
return (option) ? on:off;
}
char OSISRedLetterWords::processText(SWBuf &text, const SWKey *key, const SWModule *module)
{
SWBuf token;
bool intoken = false;
char buf[254];
SWBuf orig = text;
const char *from = orig.c_str();
if (!option)
for (text = ""; *from; from++) {
if (*from == '<') {
intoken = true;
token = "";
continue;
}
if (*from == '>') { // process tokens
intoken = false;
XMLTag tag(token);
if (!stricmp(tag.getName(), "q")) {
if ((tag.getAttribute("who")) && (!stricmp(tag.getAttribute("who"), "Jesus"))) {
tag.setAttribute("who", 0);
}
}
text += '<';
text.append(token);
text += '>';
continue;
}
if (intoken) { //copy token
token += *from;
}
else { //copy text which is not inside a token
text += *from;
}
}
return 0;
}
SWORD_NAMESPACE_END
--- NEW FILE: osisscripref.cpp ---
/******************************************************************************
*
* OSISScripref - SWFilter descendant to hide or show scripture references
* in an OSIS module.
*/
#include <stdlib.h>
#include <osisscripref.h>
#include <swmodule.h>
#include <utilxml.h>
#ifndef __GNUC__
#else
#include <unixstr.h>
#endif
SWORD_NAMESPACE_START
const char OSISScripref::on[] = "On";
const char OSISScripref::off[] = "Off";
const char OSISScripref::optName[] = "Scripture Cross-references";
const char OSISScripref::optTip[] = "Toggles Scripture Cross-references On and Off if they exist";
OSISScripref::OSISScripref() {
option = true;
options.push_back(on);
options.push_back(off);
}
OSISScripref::~OSISScripref() {
}
void OSISScripref::setOptionValue(const char *ival)
{
option = (!stricmp(ival, on));
}
const char *OSISScripref::getOptionValue()
{
return (option) ? on:off;
}
char OSISScripref::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
SWBuf token;
bool intoken = false;
bool hide = false;
SWBuf tagText;
XMLTag startTag;
int tagTextNum = 1;
int footnoteNum = 1;
char buf[254];
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;
XMLTag tag(token);
if (!strcmp(tag.getName(), "note") && !strcmp(tag.getAttribute("type"), "crossReference")) {
if (!tag.isEndTag() && (!tag.isEmpty())) {
startTag = tag;
hide = true;
tagText = "";
if (option) { // we want the tag in the text
text += '<';
text.append(token);
text += '>';
}
continue;
}
if (hide && tag.isEndTag()) {
if (module->isProcessEntryAttributes() && option) {
sprintf(buf, "%i", footnoteNum++);
ListString attributes = startTag.getAttributeNames();
for (ListString::iterator it = attributes.begin(); it != attributes.end(); it++) {
module->getEntryAttributes()["Footnote"][buf][it->c_str()] = startTag.getAttribute(it->c_str());
}
module->getEntryAttributes()["Footnote"][buf]["body"] = tagText;
if (option) { // we want the tag in the text
text.append(tagText);
}
}
hide = false;
if (!option) { // we don't want the tag in the text anymore
continue;
}
}
}
// if not a heading 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 tagText += *from;
}
return 0;
}
SWORD_NAMESPACE_END
- Previous message: [sword-cvs] sword/src/modules/filters cipherfil.cpp,1.18,1.19 gbffootnotes.cpp,1.17,1.18 gbfheadings.cpp,1.8,1.9 gbfmorph.cpp,1.9,1.10 gbfosis.cpp,1.16,1.17 gbfplain.cpp,1.16,1.17 gbfredletterwords.cpp,1.5,1.6 gbfrtf.cpp,1.33,1.34 gbfstrongs.cpp,1.21,1.22 greeklexattribs.cpp,1.15,1.16 latin1utf16.cpp,1.7,1.8 latin1utf8.cpp,1.12,1.13 osisheadings.cpp,1.5,1.6 osishtmlhref.cpp,1.6,1.7 osismorph.cpp,1.6,1.7 osisrtf.cpp,1.8,1.9 osisstrongs.cpp,1.5,1.6 scsuutf8.cpp,1.8,1.9 thmlfootnotes.cpp,1.10,1.11 thmlheadings.cpp,1.9,1.10 thmllemma.cpp,1.7,1.8 thmlmorph.cpp,1.12,1.13 thmlosis.cpp,1.24,1.25 thmlplain.cpp,1.10,1.11 thmlscripref.cpp,1.10,1.11 thmlstrongs.cpp,1.15,1.16 thmlvariants.cpp,1.8,1.9 unicodertf.cpp,1.15,1.16 utf16utf8.cpp,1.9,1.10 utf8arshaping.cpp,1.7,1.8 utf8bidireorder.cpp,1.7,1.8 utf8cantillation.cpp,1.6,1.7 utf8greekaccents.cpp,1.8,1.9 utf8hebrewpoints.cpp,1.8,1.9 utf8html.cpp,1.7,1.8 utf8latin1.cpp,1.7,1.8 utf8nfc.cpp,1.9,1.10 utf8nfkd.cpp,1.9,1.10 utf8transliterator.cpp,1.28,1.29 utf8utf16.cpp,1.8,1.9
- Next message: [sword-cvs] sword/include osislemma.h,NONE,1.1 osisredletterwords.h,NONE,1.1 osisscripref.h,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]