def _get_mathMl(self): from comtypes.gen.ISimpleDOM import ISimpleDOMNode try: node = self.IAccessibleObject.QueryInterface(ISimpleDOMNode) # Try the data-mathml attribute. attrNames = (BSTR * 1)("data-mathml") namespaceIds = (c_short * 1)(0) attr = node.attributesForNames(1, attrNames, namespaceIds) if attr: import mathPres if not mathPres.getLanguageFromMath(attr) and self.language: attr = mathPres.insertLanguageIntoMath(attr, self.language) return attr if self.IA2Attributes.get("tag") != "math": # This isn't MathML. raise LookupError if self.language: attrs = ' xml:lang="%s"' % self.language else: attrs = "" return "<math%s>%s</math>" % (attrs, node.innerHTML) except COMError: log.debugWarning("Error retrieving math. " "Not supported in this browser or ISimpleDOM COM proxy not registered.", exc_info=True) raise LookupError
def _setSpeechLanguage(self, mathMl): lang = mathPres.getLanguageFromMath(mathMl) if not lang: lang = speech.getCurrentLanguage() if config.conf["language"]["alwaysSpeakMathInEnglish"]: lang = 'en' self._mpSpeechSettings.SetLanguage(lang.replace("_", "-")) self._language = lang
def _get_mathMl(self): from comtypes.gen.ISimpleDOM import ISimpleDOMNode node = self.IAccessibleObject.QueryInterface(ISimpleDOMNode) # Try the data-mathml attribute. attr = node.attributesForNames(1, (BSTR * 1)("data-mathml"), (c_short * 1)(0,)) if attr: import mathPres if not mathPres.getLanguageFromMath(attr) and self.language: attr = mathPres.insertLanguageIntoMath(attr, self.language) return attr if self.IA2Attributes.get("tag") != "math": # This isn't MathML. raise LookupError if self.language: attrs = ' xml:lang="%s"' % self.language else: attrs = "" return "<math%s>%s</math>" % (attrs, node.innerHTML)
def _get_mathMl(self): from comtypes.gen.ISimpleDOM import ISimpleDOMNode node = self.IAccessibleObject.QueryInterface(ISimpleDOMNode) # Try the data-mathml attribute. attr = node.attributesForNames(1, (BSTR * 1)("data-mathml"), (c_short * 1)(0, )) if attr: import mathPres if not mathPres.getLanguageFromMath(attr) and self.language: attr = mathPres.insertLanguageIntoMath(attr, self.language) return attr if self.IA2Attributes.get("tag") != "math": # This isn't MathML. raise LookupError if self.language: attrs = ' xml:lang="%s"' % self.language else: attrs = "" return "<math%s>%s</math>" % (attrs, node.innerHTML)
def _get_mathMl(self): import mathPres mathMl = mathPres.stripExtraneousXml(self.HTMLNode.outerHTML) if not mathPres.getLanguageFromMath(mathMl) and self.language: mathMl = mathPres.insertLanguageIntoMath(mathMl, self.language) return mathMl
def _setSpeechLanguage(self, mathMl): lang = mathPres.getLanguageFromMath(mathMl) if not lang: lang = speech.getCurrentLanguage() self._mpSpeechSettings.SetLanguage(lang.replace("_", "-")) self._language = lang