1
/******************************************************************************
3
* thmlmorph - SWFilter descendant to hide or show morph tags
7
* Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
8
* CrossWire Bible Society
10
* Tempe, AZ 85280-2528
12
* This program is free software; you can redistribute it and/or modify it
13
* under the terms of the GNU General Public License as published by the
14
* Free Software Foundation version 2.
16
* This program is distributed in the hope that it will be useful, but
17
* WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* General Public License for more details.
24
#include <thmlmorph.h>
28
const char oName[] = "Morphological Tags";
29
const char oTip[] = "Toggles Morphological Tags On and Off if they exist";
31
const SWBuf choices[3] = {"Off", "On", ""};
32
const StringList oValues(&choices[0], &choices[2]);
34
ThMLMorph::ThMLMorph() : SWOptionFilter(oName, oTip, &oValues) {
35
setOptionValue("Off");
39
ThMLMorph::~ThMLMorph() {
43
char ThMLMorph::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
44
if (!option) { // if we don't want morph tags
49
const char *from = orig.c_str();
50
for (text = ""; *from; from++) {
56
if (*from == '>') { // process tokens
58
if (!strncmp(token.c_str(), "sync ", 5) && strstr(token.c_str(), "type=\"morph\"")) { // Morph
62
// if not a morph tag token, keep token in text