<commit_before>//
//  TagFactory.swift
//  Pods
//
//  Created by <NAME> on 24/10/2016.
//
//

import UIKit

public struct TagFactory {
    
    public static func factory(attributes: [String : Any]) -> TagGenerating {
        if attributes.keys.contains(NSLinkAttributeName) {
            return AnchorFactory()
        }
        else if attributes.keys.contains(NSForegroundColorAttributeName) ||
            attributes.keys.contains(NSFontAttributeName) ||
            attributes.keys.contains(NSBackgroundColorAttributeName) {
            return SpanFactory()
        }
        else {
            return ParagraphFactory()
        }
    }
    
    public static func factory(htmlTag: String) -> TagGenerating {
        switch htmlTag {
        case "a":
            return AnchorFactory()
        case "span":
            return SpanFactory()
        default:
            return ParagraphFactory()
        }
    }
}
<commit_msg>Added underline, strikethrough checks. WIP.<commit_after>//
//  TagFactory.swift
//  Pods
//
//  Created by <NAME> on 24/10/2016.
//
//

import UIKit

public struct TagFactory {
    
    public static func factory(attributes: [String : Any]) -> TagGenerating {
        if attributes.keys.contains(NSLinkAttributeName) {
            return AnchorFactory()
        }
        else if attributes.keys.contains(NSForegroundColorAttributeName) ||
            attributes.keys.contains(NSFontAttributeName) ||
            attributes.keys.contains(NSBackgroundColorAttributeName) ||
            attributes.keys.contains(NSUnderlineStyleAttributeName) ||
            attributes.keys.contains(NSStrikethroughStyleAttributeName) {
            return SpanFactory()
        }
        else {
            return ParagraphFactory()
        }
    }
    
    public static func factory(htmlTag: String) -> TagGenerating {
        switch htmlTag {
        case "a":
            return AnchorFactory()
        case "span":
            return SpanFactory()
        default:
            return ParagraphFactory()
        }
    }
}

{'fraction_non_alphanumeric': 0.0946078431372549, 'fraction_numerical': 0.00784313725490196, 'mean_word_length': 1.9970631424375918, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 9, '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': '518956', 'n_tokens_mistral': 547, 'n_tokens_neox': 535, 'n_words': 112}