#include <iostream>
#include <map>
#include <stdio.h>
#include <markupfiltmgr.h>
#include <swmgr.h>
#include <swmodule.h>
#include <versekey.h>
Go to the source code of this file.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 61 of file mod2imp.cpp.
64 if (argc < 2)
usage(*argv);
66 const char *progName = argv[0];
67 const char *modName = argv[1];
72 map<SWBuf, SWBuf> options;
74 for (
int i = 2; i < argc; i++) {
75 if (!strcmp(argv[i],
"-r")) {
76 if (strip)
usage(progName,
"-r can't be supplied when using -s");
77 if (i+1 < argc) renderForm = argv[++i];
80 else if (!strcmp(argv[i],
"-s")) {
81 if (render)
usage(progName,
"-s can't be supplied when using -r");
84 else if (!strcmp(argv[i],
"-f")) {
85 if (i+1 < argc) optionName = argv[++i];
86 if (i+1 < argc) options[optionName] = argv[++i];
87 else usage(progName,
"-f requires <option_name> <option_value>");
89 else usage(progName, (((SWBuf)
"Unknown argument: ")+ argv[i]).c_str());
100 else if (renderForm.length())
usage(progName, (((SWBuf)
"Unknown output_format for -r (")+renderForm+
")").c_str());
102 SWMgr *
mgr = (markupMgr) ?
new SWMgr(markupMgr) :
new SWMgr();
105 for (map<SWBuf, SWBuf>::iterator it = options.begin(); it != options.end(); it++) {
106 mgr->setGlobalOption(it->first, it->second);
109 SWModule *
module = mgr->getModule(modName);
111 if (!module)
usage(progName, (((SWBuf)
"Couldn't find module: ") + modName).c_str());
114 SWKey *key = module->getKey();
118 vkey->setIntros(
true);
120 for ((*module) =
TOP; !module->popError(); (*module)++) {
121 std::cout <<
"$$$" << module->getKeyText() << std::endl;
122 std::cout << ((render) ? module->renderText().c_str() : (strip) ? module->stripText() : module->getRawEntry()) <<
"\n";
#define SWDYNAMIC_CAST(className, object)
void usage(const char *app)
void usage |
( |
const char * |
progName, |
|
|
const char * |
error = 0 |
|
) |
| |
Definition at line 47 of file mod2imp.cpp.
48 if (error) fprintf(stderr,
"\n%s: %s\n", progName, error);
49 fprintf(stderr,
"\n=== mod2imp (Revision $Rev: 3088 $) SWORD module exporter.\n");
50 fprintf(stderr,
"\nusage: %s <module_name> [options]\n"
51 "\t -r [output_format] - render content instead of outputting raw native\n"
52 "\t\tdata. output_format can be: OSIS, XHTML, LATEX, HTMLHREF, RTF.\n"
53 "\t -s - strip markup instead of outputting raw native data.\n"
54 "\t -f <option_name> <option_value> - when rendering (-r, above), option\n"
55 "\t\tfilter values can be set with this option.\n\n"