def __init__(self, templateRecord, debug=False): self.subscript = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.subscript], debug) self.subscript = self.subscript[0] self.superscript = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.superscript], debug) self.superscript = self.superscript[0]
def __init__(self, templateRecord, debug=False): self.dividend = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.dividend], debug) self.dividend = self.dividend[0] self.quotient = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.quotient], debug) self.quotient = self.quotient[0]
def __init__(self, templateRecord, debug=False): self.mainSlot = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.mainSlot], debug) self.mainSlot = self.mainSlot[0] self.radicand = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.radicand], debug) self.radicand = self.radicand[0]
def __init__(self, templateRecord, debug=False): self.numerator = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.numerator], debug) self.numerator = self.numerator[0] self.denominator = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.denominator], debug) self.denominator = self.denominator[0]
def __init__(self, templateRecord, debug=False): self.mainSlot = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.mainSlot], debug) self.mainSlot = self.mainSlot[0] self.smallSlot = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.smallSlot], debug) self.smallSlot = self.smallSlot[0] self.braceChar = templateRecord.childRecords[2].mtCode
def __init__(self, templateRecord, debug=False): self.mainSlot = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.mainSlot], debug) self.mainSlot = self.mainSlot[0] self.upper = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.upper], debug) self.upper = self.upper[0] self.lower = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[2]], [self.lower], debug) self.lower = self.lower[0] # This can either be a character or a line. Either way, convert the # records self.operator = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[3]], [self.operator], debug) self.operator = self.operator[0] # If operator is just a character, then force to be an mo charTags = ['mi', 'mo', 'mn'] if self.operator.tag in charTags: self.operator.tag = 'mo'
def __init__(self, templateRecord, defaultLeft='(', defaultRight=')', debug=False): j = 0 self.mainSlot = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[j]], [self.mainSlot], debug) self.mainSlot = self.mainSlot[0] if _testVariation(templateRecord.variation, TV_FENCE_L): j += 1 self.leftFence = unichr(templateRecord.childRecords[j].mtCode) else: self.leftFence = defaultLeft if _testVariation(templateRecord.variation, TV_FENCE_R): j += 1 self.rightFence = unichr(templateRecord.childRecords[j].mtCode) else: self.rightFence = defaultRight
def __init__(self, templateRecord, debug=False): self.left = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.left], debug) self.left = self.left[0] i = 1 self.right = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[i]], [self.right], debug) self.right = self.right[0] i += 1 self.leftBracket = '[' if _testVariation(templateRecord.variation, TV_DI_LEFT): self.leftBracket = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[i]], [self.leftBracket], debug) self.leftBracket = self.leftBracket[0].text i += 1 self.verticalBar = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[i]], [self.verticalBar], debug) self.verticalBar = self.verticalBar[0] i += 1 self.rightBracket = ']' if _testVariation(templateRecord.variation, TV_DI_RIGHT): self.rightBracket = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[i]], [self.rightBracket], debug) self.rightBracket = self.rightBracket[0].text
def __init__(self, templateRecord, debug=False): self.mainSlot = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.mainSlot], debug) self.mainSlot = self.mainSlot[0] self.lower = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.lower], debug) self.lower = self.lower[0] self.upper = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[2]], [self.upper], debug) self.upper = self.upper[0]
def __init__(self, templateRecord, debug=False): self.slot1 = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[0]], [self.slot1], debug) self.slot1 = self.slot1[0] #i = 1 # if _testVariation(templateRecord.variation, TV_AR_TOP) and _testVariation(templateRecord.variation, TV_AR_BOTTOM): # self.slot2 = etree.Element('mrow') # convertRecords(0, [templateRecord.childRecords[i]], [self.slot2]) # self.slot2 = self.slot2[0] # i += 1 self.slot2 = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[1]], [self.slot2], debug) self.slot2 = self.slot2[0] self.arrow = etree.Element('mrow') convertRecords(0, [templateRecord.childRecords[2]], [self.arrow], debug) self.arrow = self.arrow[0]