<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using TcmTemplating.Extensions;
using TcmTemplating.Interfaces;
using Tridion;
using Tridion.ContentManager.ContentManagement;

namespace TcmTemplating.Helpers
{
	/// <summary>
	/// <see cref="FormatTextResolver" /> is a helper class to resolve FormatText fields published from Tridion.
	/// </summary>
	public class FormatTextResolver
	{
		private TemplateBase mTemplateBase;
		private IEnumerable<IFormatTextResolver> mResolvers;

		public readonly String SCHEMA_NONE = "<None>";

		private String PrefixLink(String url)
		{
			foreach (IFormatTextResolver resolver in mResolvers)
			{
				if (resolver.IsSupported(SCHEMA_NONE))
					return resolver.PrefixLink(url);
			}

			return String.Empty;
		}

		private void Resolve(XElement xhtml, Component component)
		{
			String schema = component.BasedOnSchema();

			foreach (IFormatTextResolver resolver in mResolvers)
			{
				if (resolver.IsSupported(schema))
					resolver.Resolve(TemplateBase, xhtml, component);
			}
		}<commit_msg> - Fixed the Resolve function to break at the first supported resolver<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using TcmTemplating.Extensions;
using TcmTemplating.Interfaces;
using Tridion;
using Tridion.ContentManager.ContentManagement;

namespace TcmTemplating.Helpers
{
	/// <summary>
	/// <see cref="FormatTextResolver" /> is a helper class to resolve FormatText fields published from Tridion.
	/// </summary>
	public class FormatTextResolver
	{
		private TemplateBase mTemplateBase;
		private IEnumerable<IFormatTextResolver> mResolvers;

		public readonly String SCHEMA_NONE = "<None>";

		private String PrefixLink(String url)
		{
			foreach (IFormatTextResolver resolver in mResolvers)
			{
				if (resolver.IsSupported(SCHEMA_NONE))
					return resolver.PrefixLink(url);
			}

			return String.Empty;
		}

        /// <summary>
        /// Resolves the specified XHTML.
        /// </summary>
        /// <param name="xhtml">The <see cref="T:System.Xml.Linq.XElement"/>.</param>
        /// <param name="component">The <see cref="T:Tridion.ContentManager.ContentManagement.Component"/>.</param>
		private void Resolve(XElement xhtml, Component component)
		{
			String schema = component.BasedOnSchema();

			foreach (IFormatTextResolver resolver in mResolvers)
			{
                if (resolver.IsSupported(schema))
                {
                    resolver.Resolve(TemplateBase, xhtml, component);
                    break;
                }
			}
		}
{'fraction_non_alphanumeric': 0.09939070830159939, 'fraction_numerical': 0.0, 'mean_word_length': 3.576655052264808, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '3389462', 'n_tokens_mistral': 847, 'n_tokens_neox': 772, 'n_words': 188}