Put back Color code in place of txetcolor due to crashes.

This commit is contained in:
Michael Griebling
2024-10-05 11:29:31 -04:00
parent a87d4b5a3c
commit 428537b8d9
5 changed files with 69 additions and 68 deletions

View File

@@ -235,10 +235,10 @@ public class MTMathAtom: NSObject {
return MTAccent(self as? MTAccent)
case .space:
return MTMathSpace(self as? MTMathSpace)
case .color:
case .color, .textcolor:
return MTMathColor(self as? MTMathColor)
case .textcolor:
return MTMathTextColor(self as? MTMathTextColor)
// case .textcolor:
// return MTMathTextColor(self as? MTMathTextColor)
case .colorBox:
return MTMathColorbox(self as? MTMathColorbox)
case .table:
@@ -684,32 +684,33 @@ public class MTMathColor: MTMathAtom {
Note: None of the usual fields of the `MTMathAtom` apply even though this
class inherits from `MTMathAtom`. i.e. it is meaningless to have a value
in the nucleus, subscript or superscript fields. */
public class MTMathTextColor: MTMathAtom {
public var colorString:String=""
public var innerList:MTMathList?
init(_ color: MTMathTextColor?) {
super.init(color)
self.type = .textcolor
self.colorString = color?.colorString ?? ""
self.innerList = MTMathList(color?.innerList)
}
override init() {
super.init()
self.type = .textcolor
}
public override var string: String {
"\\textcolor{\(self.colorString)}{\(self.innerList!.string)}"
}
override public var finalized: MTMathAtom {
let newColor = super.finalized as! MTMathTextColor
newColor.innerList = newColor.innerList?.finalized
return newColor
}
}
// FIXME: Removed due to crash
//public class MTMathTextColor: MTMathAtom {
// public var colorString:String=""
// public var innerList:MTMathList?
//
// init(_ color: MTMathTextColor?) {
// super.init(color)
// self.type = .textcolor
// self.colorString = color?.colorString ?? ""
// self.innerList = MTMathList(color?.innerList)
// }
//
// override init() {
// super.init()
// self.type = .textcolor
// }
//
// public override var string: String {
// "\\textcolor{\(self.colorString)}{\(self.innerList!.string)}"
// }
//
// override public var finalized: MTMathAtom {
// let newColor = super.finalized as! MTMathTextColor
// newColor.innerList = newColor.innerList?.finalized
// return newColor
// }
//}
// MARK: - MTMathColorbox
/** An atom representing an colorbox element.