{ "info": { "author": "Paul Tremblay", "author_email": "Paul Henry Tremblay ", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Documentation", "Topic :: Software Development :: Documentation" ], "description": "README\n+++++++\n\n.. comment\n\n=========\nOverview\n=========\n\nThe asciitomathml converts ASCII math to MathML. See http://mathcs.chapman.edu/~jipsen/mathml/asciimath.html\nfor more details. As an example, asciitomathml converts the string `x^2` to::\n\n \n \n \n x\n 2\n \n \n \n\n=============\nInstallation\n=============\n\nInstall asciitomathml in the normal way::\n\n python setup.py install\n\nOr, for pip::\n\n pip install asciitomathml\n\nInstallation for Python 2\n==========================\n\nUse version .88 if you need asciimathml for Python 2.7::\n pip install asciitomathml=.88\n\n\n\n===\nUse\n===\n\nThe following creates etree from a string::\n\n import asciitomathml.asciitomathml \n the_string = 'x^2'\n math_obj = asciitomathml.asciitomathml.AsciiMathML()\n math_obj.parse_string(the_string)\n\n\nIn order to get the tree, use the `math_tree` method::\n\n math_tree = math_obj.get_tree() # math_tree is an etree object\n\nInstead, if you want an XML string, use the `to_xml_string` method:: \n\n xml_string = math_obj.to_xml_string() # xml_string a binary string\n\n\nThe xml_string will have type 'bytes'. If you will to have a type of 'str'\npass an encoding of type \"unicode\"::\n\n xml_string = math_obj.to_xml_string(encoding='unicode')\n\nThe string will be encoded as UTF-8.\n\nIf you pass an encoding other than utf8 to this method, the string will start with the \nstandard XML encoding, in accordance with XML standards::\n\n \n\nIf you are incorporating the string into an XML document, and don't want the\nencoding string, you should probably use the get_tree method and incorporate\nthe resulting object into your etree document. Likewise, by not passing any\nencoding to this method, the returned string will be encoded as ASCII and\nshould not include the encoding part of the string. However, if for whatever\nreason you need a tree without the encoding, pass the no_encoding_string\noption to the to_xml_string method::\n\n xml_string = math_obj.to_xml_string(encoding=\"utf8\", no_encoding_string = True) \n\n\nMath style\n===========\n\nYou can pass any attributes to the `` that are allowed. Use the `mstyle` \noption to pass a *dictionary* when creating the method::\n\n math_obj = asciitomathml.asciitomathml.AsciiMathML(mstyle={'displaystyle':'true'})\n\nThe most useful attribute is probably `displaystyle`. In general, set this attribute to \n`true` if you will put the equation by itself, in block. Otherwise, don't set this value at all, \nor set it to `false`. The consortium for mathml explains it this way:\n\n\n For an instance of MathML embedded in a textual data format (such as HTML) in\n \"display\" mode, i.e. in place of a paragraph, displaystyle = \"true\" and\n scriptlevel = \"0\" for the outermost expression of the embedded MathML; if the\n MathML is embedded in \"inline\" mode, i.e. in place of a character,\n displaystyle = \"false\" and scriptlevel = \"0\" for the outermost expression. See\n Chapter 7 The MathML Interface for further discussion of the distinction\n between \"display\" and \"inline\" embedding of MathML and how this can be\n specified in particular instances. In general, a MathML renderer may determine\n these initial values in whatever manner is appropriate for the location and\n context of the specific instance of MathML it is rendering, or if it has no\n way to determine this, based on the way it is most likely to be used; as a\n last resort it is suggested that it use the most generic values \n displaystyle = \"\"true\"\" and scriptlevel = \"\"0\"\". \n\nhttp://www.w3.org/TR/MathML2/chapter3.html#presm.mstyle\n\n=======\nScripts\n=======\n\nI have included two scripts as examples. These scripts show the capability of\nthe libarary. Since they must read text from a file, form paragraphs, and distinguish \nbetween math and non math markup, they are not meant as tools for extensive conversion of \ntext to HTM or FO. For such conversions, see:\n\nhttp://docutils.sourceforge.net/\n\nSpecifically, see the sandbox/docbook directory, which features extensive\nstylesheets and instructions for converting text to docbook, and then to HTML\nor FO. \n\nIn order to use the scripts, type::\n\n python scripts/asciimath2fo.py \n\nor::\n \n python scripts/asciimath2html.py \n\nThe scripts convert anything between \"`\" and \"`\" to mathml; otherwise, the scripts just copy the \ntext verbatim. See the examples in the example directory. For a quick start, try::\n\n\n python scripts/asciimath2html.py examples/linear_regression.txt > linear.xhtml\n\nand then open `linear.xhtml` in a browser that can handle mathml, such as Firefox.\n\n====\nTest\n====\n\nTo test the library, type::\n\n python test/test_all.py", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://sourceforge.net/projects/asciimathpython/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "asciitomathml", "package_url": "https://pypi.org/project/asciitomathml/", "platform": "any", "project_url": "https://pypi.org/project/asciitomathml/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://sourceforge.net/projects/asciimathpython/" }, "release_url": "https://pypi.org/project/asciitomathml/1.0/", "requires_dist": null, "requires_python": null, "summary": "Module converts ASCII math to Mathml", "version": "1.0" }, "last_serial": 2226648, "releases": { ".85": [ { "comment_text": "", "digests": { "md5": "c8aa93ca9ee6b4ee7ce01a1d02ac2ae2", "sha256": "46bf2a6f548628594699e12ce274f2c291be0fe882c37fb4cb25dddbe8481e15" }, "downloads": -1, "filename": "asciitomathml-.85.tar.gz", "has_sig": false, "md5_digest": "c8aa93ca9ee6b4ee7ce01a1d02ac2ae2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34091, "upload_time": "2012-11-06T01:24:10", "url": "https://files.pythonhosted.org/packages/93/0e/f707a91be234c8b8a35492773cdb590481734de53bbe11961f1dbb1e9c14/asciitomathml-.85.tar.gz" } ], ".86": [ { "comment_text": "", "digests": { "md5": "cd49935be36b1968b719077686f089ca", "sha256": "56e703f4a2bab7c9a349190f41235f4b40fbdb30677e97d9c1be6184b788673c" }, "downloads": -1, "filename": "asciitomathml-.86.tar.gz", "has_sig": false, "md5_digest": "cd49935be36b1968b719077686f089ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34115, "upload_time": "2012-11-15T01:54:35", "url": "https://files.pythonhosted.org/packages/f2/71/c0628ccce786fcf16cef310185197744c09077a2c4b5a93b7c0f38415a83/asciitomathml-.86.tar.gz" } ], ".87": [ { "comment_text": "", "digests": { "md5": "2b1f7c8b6b084ff84e02406137b135cd", "sha256": "9cd34fd2429f76466f31d70f7e6aa4414975f5ffa0088287c7ed8653e6a270c0" }, "downloads": -1, "filename": "asciitomathml-.87.tar.gz", "has_sig": false, "md5_digest": "2b1f7c8b6b084ff84e02406137b135cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34040, "upload_time": "2013-03-06T00:12:29", "url": "https://files.pythonhosted.org/packages/6c/53/4e88774617f16a04783b29a42d08ba5b3cc7ee027391ba42464e4c1ba573/asciitomathml-.87.tar.gz" } ], ".88": [ { "comment_text": "", "digests": { "md5": "8f712436e2a12e92bf0f56196b4fc9ff", "sha256": "da8f68160c1e778536da2e23e418513bc9b90356ef3906344c197d67abd3f3a4" }, "downloads": -1, "filename": "asciitomathml-.88.tar.gz", "has_sig": false, "md5_digest": "8f712436e2a12e92bf0f56196b4fc9ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34067, "upload_time": "2013-05-11T14:17:50", "url": "https://files.pythonhosted.org/packages/26/ff/f13c6064bbabbea423431e136f798122cb059ea66900426f72475c4e8e19/asciitomathml-.88.tar.gz" } ], ".89": [ { "comment_text": "", "digests": { "md5": "2a2acacb0caa8fd4a1015f321221049d", "sha256": "6f19dbb72dbedd4bb09f4295ba071a69636801f9e50a7068e94ac58bfebbd5e0" }, "downloads": -1, "filename": "asciitomathml-.89.tar.gz", "has_sig": false, "md5_digest": "2a2acacb0caa8fd4a1015f321221049d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34095, "upload_time": "2013-05-11T14:28:39", "url": "https://files.pythonhosted.org/packages/3e/d3/aab5eed48ca21a35c9aac9c0c3fbd3c9883946a6456ecb80cf5a23866a32/asciitomathml-.89.tar.gz" } ], "0.89": [], "1.0": [ { "comment_text": "", "digests": { "md5": "05853e800dd26e5b76927f59084774cf", "sha256": "656e43ac8b2d3b719cd23efeac854086e7b93fe7dbd646925bdffaab1b36adfc" }, "downloads": -1, "filename": "asciitomathml-1.0.tar.gz", "has_sig": false, "md5_digest": "05853e800dd26e5b76927f59084774cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51735, "upload_time": "2016-07-17T08:10:04", "url": "https://files.pythonhosted.org/packages/88/f8/686b5bbf6742abb65610f788b5efbfd7dab10811163a3a9f73f8bc883ea9/asciitomathml-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "05853e800dd26e5b76927f59084774cf", "sha256": "656e43ac8b2d3b719cd23efeac854086e7b93fe7dbd646925bdffaab1b36adfc" }, "downloads": -1, "filename": "asciitomathml-1.0.tar.gz", "has_sig": false, "md5_digest": "05853e800dd26e5b76927f59084774cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51735, "upload_time": "2016-07-17T08:10:04", "url": "https://files.pythonhosted.org/packages/88/f8/686b5bbf6742abb65610f788b5efbfd7dab10811163a3a9f73f8bc883ea9/asciitomathml-1.0.tar.gz" } ] }