/// <summary> /// Modifies <paramref name="templateBody"/>. /// </summary> /// <param name="templateBody">Template body.</param> /// <returns>Modified template body.</returns> public static string ModifyTemplate(string templateBody) { List <string> anchorElements = MailingUtilities.ParseHtmlAnchorElement(templateBody); Dictionary <string, string> modifiedLinks = ModifyTemplateLinks(anchorElements); return(ReplaceLinksInTemplate(templateBody, modifiedLinks)); }
/// <summary> /// Returns all anchor elements from <paramref name="src"/>. /// </summary> /// <param name="src">Source text.</param> /// <returns>Collection of anchor elements, element definition as key and href parameter as value.</returns> private Dictionary <string, string> ParseHtmlAnchorElements(string src) { var result = new Dictionary <string, string>(); List <string> anchorElements = MailingUtilities.ParseHtmlAnchorElement(src); foreach (string anchorElement in anchorElements) { result[anchorElement] = MailingUtilities.ParseHtmlHrefValue(anchorElement); } return(result); }
private IEnumerable <string> GetUrlElementsWithMacro(string src) { var urlHtmlElements = MailingUtilities.ParseHtmlAnchorElement(src); return(urlHtmlElements.Where(x => _macroNameRegex.IsMatch(x))); }