<commit_before>//
//  VideoTranscriptTableViewCell.swift
//  edX
//
//  Created by <NAME> on 1/13/17.
//  Copyright © 2017 edX. All rights reserved.
//

import UIKit

class VideoTranscriptTableViewCell: UITableViewCell {
    
    static let cellIdentifier = "VideoTranscriptCell"
    
    let titleLabel = UILabel(frame: CGRect.zero)
    
    private var standardTitleStyle : OEXTextStyle {
        let style = OEXTextStyle(weight: OEXTextWeight.semiBold, size: .base, color: OEXStyles.shared().primaryBaseColor())
        titleLabel.lineBreakMode = .byWordWrapping
        return style
    }
    
    private var highlightedTitleStyle : OEXTextStyle {
        let style = OEXTextStyle(weight: OEXTextWeight.semiBold, size: .base, color: OEXStyles.shared().neutralXDark())
        titleLabel.lineBreakMode = .byWordWrapping
        return style
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = UIColor.white
        titleLabel.numberOfLines = 0
        titleLabel.preferredMaxLayoutWidth = bounds.width
        self.addSubview(titleLabel)
        titleLabel.snp.remakeConstraints { make in
            make.left.equalTo(self.snp.left).offset(20.0)
            make.right.equalTo(self.snp.right).offset(-20.0)
            make.top.equalTo(self.snp.top).offset(10.0)
            make.bottom.equalTo(self.snp.bottom).offset(-10.0)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
    func setTranscriptText(text: String? , highlighted: Bool) {
        if !highlighted {
            titleLabel.attributedText = standardTitleStyle.attributedString(withText: text)
        }
        else{
            titleLabel.attributedText = highlightedTitleStyle.attributedString(withText: text)
        }
    }
}
<commit_msg>Properly render subtitles with HTML-like markup (#1271)<commit_after>//
//  VideoTranscriptTableViewCell.swift
//  edX
//
//  Created by <NAME> on 1/13/17.
//  Copyright © 2017 edX. All rights reserved.
//

import UIKit

class VideoTranscriptTableViewCell: UITableViewCell {
    
    static let cellIdentifier = "VideoTranscriptCell"
    
    let titleLabel = UILabel(frame: CGRect.zero)
    
    private var standardTitleStyle : OEXTextStyle {
        let style = OEXTextStyle(weight: OEXTextWeight.semiBold, size: .base, color: OEXStyles.shared().primaryBaseColor())
        titleLabel.lineBreakMode = .byWordWrapping
        return style
    }
    
    private var highlightedTitleStyle : OEXTextStyle {
        let style = OEXTextStyle(weight: OEXTextWeight.semiBold, size: .base, color: OEXStyles.shared().neutralXDark())
        titleLabel.lineBreakMode = .byWordWrapping
        return style
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = UIColor.white
        titleLabel.numberOfLines = 0
        titleLabel.preferredMaxLayoutWidth = bounds.width
        self.addSubview(titleLabel)
        titleLabel.snp.remakeConstraints { make in
            make.left.equalTo(self.snp.left).offset(20.0)
            make.right.equalTo(self.snp.right).offset(-20.0)
            make.top.equalTo(self.snp.top).offset(10.0)
            make.bottom.equalTo(self.snp.bottom).offset(-10.0)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
    func setTranscriptText(text: String? , highlighted: Bool) {
        if !highlighted {
            titleLabel.attributedText = standardTitleStyle.markdownString(withText: text)
        }
        else{
            titleLabel.attributedText = highlightedTitleStyle.markdownString(withText: text)
        }
    }
}

{'fraction_non_alphanumeric': 0.09788867562380038, 'fraction_numerical': 0.011516314779270634, 'mean_word_length': 2.735663082437276, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '399724', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1236, 'n_words': 238}