[sword-cvs] sword/src/modules/filters osisfootnotes.cpp,NONE,1.1 Makefile.am,1.18,1.19

sword@www.crosswire.org sword@www.crosswire.org
Tue, 17 Jun 2003 15:14:20 -0700


Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv30816/src/modules/filters

Modified Files:
	Makefile.am 
Added Files:
	osisfootnotes.cpp 
Log Message:
added osis footnotes filter framework

--- NEW FILE: osisfootnotes.cpp ---
/******************************************************************************
 *
 *osishmlheadings -	SWFilter decendant to hide or show headings
 *			in an OSIS module.
 */


#include <stdlib.h>
#include <string.h>
#include <osisheadings.h>
#include <swmodule.h>
#include <utilxml.h>
#ifndef __GNUC__
#else
#include <unixstr.h>
#endif

SWORD_NAMESPACE_START

const char OSISFootnotes::on[] = "On";
const char OSISFootnotes::off[] = "Off";
const char OSISFootnotes::optName[] = "Footnotes";
const char OSISFootnotes::optTip[] = "Toggles Footnotes On and Off if they exist";


OSISFootnotes::OSISFootnotes() {
	option = false;
	options.push_back(on);
	options.push_back(off);
}


OSISFootnotes::~OSISFootnotes() {
}

void OSISFootnotes::setOptionValue(const char *ival)
{
	option = (!stricmp(ival, on));
}

const char *OSISFootnotes::getOptionValue()
{
	return (option) ? on:off;
}

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;
}

SWORD_NAMESPACE_END


Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/Makefile.am,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Makefile.am	1 Jun 2003 14:32:09 -0000	1.18
--- Makefile.am	17 Jun 2003 22:14:18 -0000	1.19
***************
*** 37,41 ****
--- 37,43 ----
  libsword_la_SOURCES += $(filtersdir)/gbfosis.cpp
  libsword_la_SOURCES += $(filtersdir)/thmlplain.cpp
+ 
  libsword_la_SOURCES += $(filtersdir)/osisheadings.cpp
+ libsword_la_SOURCES += $(filtersdir)/osisfootnotes.cpp 
  libsword_la_SOURCES += $(filtersdir)/osismorph.cpp
  libsword_la_SOURCES += $(filtersdir)/osisstrongs.cpp