1 /*
2 blahtex: a TeX to MathML converter designed with MediaWiki in mind
3 blahtexml: an extension of blahtex with XML processing in mind
4 http://gva.noekeon.org/blahtexml
5 
6 Copyright (c) 2006, David Harvey
7 Copyright (c) 2009, Gilles Van Assche
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
11 
12     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
13     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14     * Neither the names of the authors nor the names of their affiliation may be used to endorse or promote products derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 */
18 
19 #include <sstream>
20 #include "Interface.h"
21 #include "MathmlNode.h"
22 
23 using namespace std;
24 
25 namespace blahtex
26 {
27 
ProcessInput(const wstring & input,bool displayStyle)28 void Interface::ProcessInput(const wstring& input, bool displayStyle)
29 {
30     mManager.reset(new Manager);
31     mManager->ProcessInput(input, mTexvcCompatibility, displayStyle);
32 }
33 
GetMathml()34 wstring Interface::GetMathml()
35 {
36     wostringstream output;
37     auto_ptr<MathmlNode> root = mManager->GenerateMathml(mMathmlOptions);
38     root->Print(output, mEncodingOptions, mIndented);
39     return output.str();
40 }
41 
GetPurifiedTex()42 wstring Interface::GetPurifiedTex()
43 {
44     return mManager->GeneratePurifiedTex(mPurifiedTexOptions);
45 }
46 
GetPurifiedTexOnly()47 wstring Interface::GetPurifiedTexOnly()
48 {
49     return mManager->GeneratePurifiedTexOnly();
50 }
51 
52 #ifdef BLAHTEXML_USING_XERCES
PrintAsSAX2(ContentHandler & sax,const wstring & prefix,bool ignoreFirstmrow) const53 void Interface::PrintAsSAX2(ContentHandler& sax, const wstring& prefix, bool ignoreFirstmrow) const
54 {
55     wostringstream output;
56     auto_ptr<MathmlNode> root = mManager->GenerateMathml(mMathmlOptions);
57     root->PrintAsSAX2(sax, prefix, ignoreFirstmrow);
58 }
59 #endif
60 
61 }
62 
63 // end of file @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
64