From 20f0b25f1480f434b81ea0d363c399648dc072d3 Mon Sep 17 00:00:00 2001 From: belerico Date: Fri, 17 Apr 2020 00:00:49 +0200 Subject: [PATCH] Add version 0.2.4 --- py_asciimath/__init__.py | 2 +- py_asciimath/parser/parser.py | 2 ++ py_asciimath/py_asciimath.py | 4 ++-- py_asciimath/translator/translator.py | 26 +++++++++++++------------- py_asciimath/utils/utils.py | 2 +- setup.py | 1 + 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/py_asciimath/__init__.py b/py_asciimath/__init__.py index 2004cc7..32d1981 100644 --- a/py_asciimath/__init__.py +++ b/py_asciimath/__init__.py @@ -1,4 +1,4 @@ import os PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) -__version__ = "0.2.3" +__version__ = "0.2.4" diff --git a/py_asciimath/parser/parser.py b/py_asciimath/parser/parser.py index ac69964..f856d4d 100644 --- a/py_asciimath/parser/parser.py +++ b/py_asciimath/parser/parser.py @@ -258,6 +258,8 @@ def parse( Args: xml (str): String representing a MathML XML. + dtd (str): MathML DTD type. Must be on of the following: + `mathml1`, `mathml2` or `mathml3` dtd_validation (bool, optional): Validate XML against DTD during parsing. Defaults to True. network (bool, optional): Validate against remote DTD. diff --git a/py_asciimath/py_asciimath.py b/py_asciimath/py_asciimath.py index 12659e0..f63b05d 100644 --- a/py_asciimath/py_asciimath.py +++ b/py_asciimath/py_asciimath.py @@ -54,12 +54,12 @@ def main(): ilang = ( arguments[""].lower() if arguments["from"] - else arguments["--input"] + else arguments["--input"].lower() ) olang = ( arguments[""].lower() if arguments["to"] - else arguments["--output"] + else arguments["--output"].lower() ) if ilang == olang: print("Same input and output language. Nothing to do") diff --git a/py_asciimath/translator/translator.py b/py_asciimath/translator/translator.py index 96eb0c9..03ff037 100644 --- a/py_asciimath/translator/translator.py +++ b/py_asciimath/translator/translator.py @@ -45,9 +45,9 @@ def translate(self, exp, from_file=False, to_file=None, **kwargs): """Translates an input expression s Args: - exp (str): String to translate. If from_file is `True`, then s + exp (str): String to translate. If from_file is True, then s must represent the file's path - from_file (bool, optional): If `True`, load the string to translate + from_file (bool, optional): If True, load the string to translate from the file specified by s. Defaults to False. to_file (str, optional): If specified, save the translation to `to_file`. Defaults to None. @@ -116,9 +116,9 @@ def translate( specified by `self.transformer` Args: - exp (str): String to translate. If from_file is `True`, then s + exp (str): String to translate. If from_file is True, then s must represent the file's path - from_file (bool, optional): If `True`, load the string to translate + from_file (bool, optional): If True, load the string to translate from the file specified by s. Defaults to False. to_file (str, optional): If specified, save the translation to `to_file`. Defaults to None. @@ -178,11 +178,11 @@ def translate( """Translates an ASCIIMath string to LaTeX Args: - exp (str): String to translate. If from_file is `True`, then s + exp (str): String to translate. If from_file is True, then s must represent the file's path displaystyle (bool, optional): Add displaystyle attribute. Defaults to False. - from_file (bool, optional): If `True`, load the string to translate + from_file (bool, optional): If True, load the string to translate from the file specified by s. Defaults to False. pprint (bool, optional): Abstract Syntax Tree pretty print. Defaults to False. @@ -295,19 +295,19 @@ def translate( """Translates an ASCIIMath string to MathML Args: - exp (str): String to translate. If from_file is `True`, then s + exp (str): String to translate. If from_file is True, then s must represent the file's path displaystyle (bool, optional): Add displaystyle attribute. Defaults to False. dtd (str, optional): MathML DTD version to validate the output against. It can be: `mathml1`, `mathml2` or `mathml3`. Defaults to None. - dtd_validation (bool, optional): If `True` validate output against + dtd_validation (bool, optional): If True validate output against the DTD version specified by `dtd`. Defaults to False. - from_file (bool, optional): If `True`, load the string to translate + from_file (bool, optional): If True, load the string to translate from the file specified by s. Defaults to False. - network (bool, optional): If `True` validate the output against + network (bool, optional): If True validate the output against a remote DTD. Defaults to False. output (str, optional): Output mode: `string` to return the string @@ -382,11 +382,11 @@ def translate( """Translates a MathML string to LaTeX Args: - exp (str): String to translate. If from_file is `True`, then s + exp (str): String to translate. If from_file is True, then s must represent the file's path - from_file (bool, optional): If `True`, load the string to translate + from_file (bool, optional): If True, load the string to translate from the file specified by s. Defaults to False. - network (bool, optional): If `True` validate the output against + network (bool, optional): If True validate the output against a remote DTD. Defaults to False. to_file (str, optional): If specified, save the translation to diff --git a/py_asciimath/utils/utils.py b/py_asciimath/utils/utils.py index 4de54e3..eb186b0 100644 --- a/py_asciimath/utils/utils.py +++ b/py_asciimath/utils/utils.py @@ -137,7 +137,7 @@ def check_mat(cls, s): s (str): Input string to be matrix-checked Returns: - bool, list: `True`, [left_par, right_par] if the string s + bool, list: True, [left_par, right_par] if the string s has a matrix-like structure; False, [] otherwise """ diff --git a/setup.py b/setup.py index 1dbbf49..d39921d 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ], install_requires=["lark-parser", "docopt", "lxml"], )