1
/******************************************************************************
3
* osislemma - SWFilter descendant to hide or show lemmata
18
const char oName[] = "Lemmas";
19
const char oTip[] = "Toggles Lemmas On and Off if they exist";
21
const SWBuf choices[3] = {"On", "Off", ""};
22
const StringList oValues(&choices[0], &choices[2]);
24
OSISLemma::OSISLemma() : SWOptionFilter(oName, oTip, &oValues) {
25
setOptionValue("Off");
29
OSISLemma::~OSISLemma() {
33
char OSISLemma::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
34
if (!option) { // if we don't want lemmas
36
char token[2048]; // cheese. Fix.
39
bool lastspace = false;
43
for (text = ""; *from; from++) {
50
if (*from == '>') { // process tokens
53
if ((!strcmp(tag.getName(), "w")) && (!tag.isEndTag())) { // Lemma
54
SWBuf lemma = tag.getAttribute("lemma");
56
tag.setAttribute("lemma", 0);
57
tag.setAttribute("savlm", lemma.c_str());
60
// keep tag, possibly with the lemma removed
66
token[tokpos++] = *from;
71
lastspace = (*from == ' ');