From: <pau...@us...> - 2011-10-20 19:03:24
|
Author: paultremblay Date: 2011-10-20 21:03:16 +0200 (Thu, 20 Oct 2011) New Revision: 7193 Modified: trunk/sandbox/paultremblay/scripts/rstxml2mathml_sax.py Log: Fixed small text that needed to be changed. Modified: trunk/sandbox/paultremblay/scripts/rstxml2mathml_sax.py =================================================================== --- trunk/sandbox/paultremblay/scripts/rstxml2mathml_sax.py 2011-10-20 18:00:27 UTC (rev 7192) +++ trunk/sandbox/paultremblay/scripts/rstxml2mathml_sax.py 2011-10-20 19:03:16 UTC (rev 7193) @@ -153,21 +153,6 @@ if not found: return None return xml_tree - """ - line_to_read = 1 - xml_string = None - while line_to_read: - line_to_read = read_obj.readline() - line = line_to_read - search_obj = regexp.search(line) - if search_obj: - xml_string = (search_obj.group(0)) - read_obj.close() - if xml_string == None: - sys.stderr.write("found no math string\n") - sys.stderr.write('Bug, not quiting\n') - return xml_string - """ class ConverttoMathml: @@ -188,30 +173,12 @@ args = parser.parse_args() return args + def convert_to_mathml(self): import io - tree = etree.ElementTree() args = self.__parse_args() standard_in = False in_file = args.in_file - if isinstance(in_file, io.TextIOWrapper): - standard_in = True - the_string = sys.stdin.read() - xml_tree = tree.fromstring(the_string) - else: - xml_tree = tree.parse(in_file) - for element in xml_tree.iter('math_block'): - mathml_tree = asciimathml.parse(element.text) - string_tree = tostring(mathml_tree).decode() - element.append(etree.XML(string_tree)) - string_tree = tostring(xml_tree, encoding="utf-8").decode() - sys.stdout.write(string_tree) - - def convert_to_mathml_(self): - import io - args = self.__parse_args() - standard_in = False - in_file = args.in_file mathml = args.mathml if mathml: mathml = mathml[0] |