summaryrefslogtreecommitdiff
path: root/tests/webiftest.cpp
blob: 7b3bc4e8118635d8e1e285860904c24c4c8b13ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
 *	CrossWire Bible Society
 *	P. O. Box 2528
 *	Tempe, AZ  85280-2528
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation version 2.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 */

#ifndef __GNUC__
#include <io.h>
#else
#include <unistd.h>
#endif
#include <fcntl.h>
#include <errno.h>
#include <iostream>
#include <thmlhtmlhref.h>
#include <unicodertf.h>
#include <thmlosis.h>
#include <gbfosis.h>
#include <thmlosis.h>
#include <versekey.h>
#include <swmgr.h>
#include <swmodule.h>
#include <markupfiltmgr.h>
#ifndef NO_SWORD_NAMESPACE
using namespace sword;
#endif
using namespace std;

#define MAXBUF 30000

int main(int argc, char **argv) {

	const char* modName = (argc >= 2) ? argv[1] : "KJV";
	const char* keyName = (argc == 3) ? argv[2] : "John 1:1";

	SWMgr mgr(0, 0, true, new MarkupFilterMgr(FMT_WEBIF, ENC_UTF8));
	mgr.setGlobalOption("Strong's Numbers", "on");
	mgr.setGlobalOption("Morphological Tags", "on");

	SWModule *module = mgr.Modules[modName];
	if (!module) {
		module = mgr.Modules.begin()->second;
	}
	module->setKey(keyName);
	std::cout << module->RenderText() << std::endl<< std::endl<< std::endl;

	//------------------------

	SWMgr mgr2(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF, ENC_UTF8));
	mgr2.setGlobalOption("Strong's Numbers", "on");
	mgr2.setGlobalOption("Morphological Tags", "on");
	module = mgr2.Modules[modName];
	if (!module) {
		module = mgr2.Modules.begin()->second;
	}

	module->setKey(keyName);
	std::cout << module->RenderText() << std::endl;

	return 0;
}