2
* itex2MML.cc last modified 9/15/2005
11
int main (int argc, char ** argv)
13
bool bPrintItex = false;
14
bool bRawFilter = false;
16
bool bDisplay = false;
20
for (int arg = 1; arg < argc; arg++)
22
std::string args = argv[arg];
26
fputs ("usage: itex2MML [OPTIONS]\n"
28
"itex2MML filters an input text stream (e.g., an XHTML web page) converting itex expressions\n"
29
"to MathML. Inline itex expressions are delimited either side by single dollar symbols ($):\n"
31
"\t<p>The parameters $\\alpha$ and $\\beta$ in the function $f(x)$ are defined below.</p>\n"
33
"For normal display of equations, etc., itex expressions can be delimited with double dollar\n"
34
"symbols ($$) either side or by \\[ to the left and \\] to the right:\n"
36
"\t<p class=\"equation\">\\[\n"
37
"\t\tf(x) = \\alpha x + \\frac{\\beta}{1+|x|}\n"
42
" --raw-filter filter input stream, converting equations as found to MathML [stops on error]\n"
43
" --inline converts a single itex equation, without any $ symbols, to inline MathML\n"
44
" --display converts a single itex equation, without any $ symbols, to display-mode MathML\n"
45
" --print-itex used in conjuction with --inline or --display: prints the itex string\n"
47
"For further information, see http://golem.ph.utexas.edu/~distler/blog/itex2MML.html\n", stdout);
52
if (args == "--print-itex")
58
if (args == "--inline")
65
if (args == "--display")
72
if (args == "--raw-filter")
85
if (bInline) itex += "$";
86
if (bDisplay) itex += "$$";
90
while (fgets (buffer, BUFSIZE, stdin)) itex += buffer;
92
if (bInline) itex += "$";
93
if (bDisplay) itex += "$$";
97
fputs (itex.c_str (), stdout);
102
if (!bInline && !bDisplay)
105
itex2MML_filter (itex.c_str(), itex.size());
107
itex2MML_html_filter (itex.c_str(), itex.size());
111
char * mathml = itex2MML_parse (itex.c_str(), itex.size());
115
fputs (mathml, stdout);
116
fputs ("\n", stdout);
118
itex2MML_free_string (mathml);
123
fputs ("itex2MML: itex parser failed to generate MathML from itex!\n", stderr);