<commit_before>MathML to SVG Service
=====================

.. Not on travis because oer.exports is a private repo.

   .. image:: https://travis-ci.org/Connexions/cnx-mathml2svg.svg
      :target: https://travis-ci.org/Connexions/cnx-mathml2svg

   .. image:: https://badge.fury.io/py/cnx-mathml2svg.svg
      :target: http://badge.fury.io/py/cnx-mathml2svg

A simple web application for accepting MathML to convert to SVG.

Install & Run
-------------

The installation requires access to the `oer.exports <https://github.com/Connexions/oer.exports>` repository for access to the MathML2SVG XSLT and Saxon executable.

::

    git clone <EMAIL>:Connexions/oer.exports
    python setup.py install
    pserve development.ini

Usage
-----

This application does not have a web interface.
You can post to it directly at ``/``, which will return the SVG in the response.
The POST parameter at this time is ``MathML``.

Example::

    curl -F 'MathML=<math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="true"><mrow><mi>sin</mi><mrow><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mrow></mstyle></math>' http://localhost:5689/

or::

   echo '<math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="true"><mrow><mi>sin</mi><mrow><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mrow></mstyle></math>' | curl -F 'MathML=@-' http://localhost:5689/

License
-------

This software is subject to the provisions of the GNU Affero General<commit_msg>adding python example<commit_after>MathML to SVG Service
=====================

.. Not on travis because oer.exports is a private repo.

   .. image:: https://travis-ci.org/Connexions/cnx-mathml2svg.svg
      :target: https://travis-ci.org/Connexions/cnx-mathml2svg

   .. image:: https://badge.fury.io/py/cnx-mathml2svg.svg
      :target: http://badge.fury.io/py/cnx-mathml2svg

A simple web application for accepting MathML to convert to SVG.

Install & Run
-------------

The installation requires access to the `oer.exports <https://github.com/Connexions/oer.exports>` repository for access to the MathML2SVG XSLT and Saxon executable.

::

    git clone <EMAIL>:Connexions/oer.exports
    python setup.py install
    pserve development.ini

Usage
-----

This application does not have a web interface.
You can post to it directly at ``/``, which will return the SVG in the response.
The POST parameter at this time is ``MathML``.

Example::

    curl -F 'MathML=<math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="true"><mrow><mi>sin</mi><mrow><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mrow></mstyle></math>' http://localhost:5689/

or::

   echo '<math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="true"><mrow><mi>sin</mi><mrow><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mrow></mstyle></math>' | curl -F 'MathML=@-' http://localhost:5689/

or in python::

   >>> import requests
   >>> payload = {'MathML':'<math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="true"><mrow><mi>sin</mi><mrow><mo>(</mo><mi>x</mi><mo>)</mo></mrow></mrow></mstyle></math>'}
   >>> r = requests.post("http://localhost:5689", data=payload)
   >>> r.text
   u'<svg xmlns="http://www.w3.org/2000/svg" ....

License
-------

This software is subject to the provisions of the GNU Affero General
{'fraction_non_alphanumeric': 0.20042708968883466, 'fraction_numerical': 0.018303843807199512, 'mean_word_length': 3.843426883308715, 'pattern_counts': {'":': 0, '<': 88, '<?xml version=': 0, '>': 99, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6974098', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1111, 'n_words': 258}