private static string GetRegExForType(NetBiscuitLinkType type) { switch (type) { case NetBiscuitLinkType.Link: return NET_BISCUIT_LINK_PATTERN; case NetBiscuitLinkType.Url: return BBCODE_URL_PATTERN; case NetBiscuitLinkType.UrlNoFollow: return BBCODE_URL_NO_FOLLOW_PATTERN; case NetBiscuitLinkType.Cell: return NET_BISCUIT_CELL_PATTERN; default: return string.Empty; } }
private static string ConvertToComponentLinkTag(Match match, NetBiscuitLinkType type) { string outputMarkup = (type == NetBiscuitLinkType.Cell) ? ReplaceURIWithPlaceHolder(match) : string.Empty; return CreateComponentLinkTag(GetTcmUri(match), type, GetLinkText(match), outputMarkup); }
private static string CreateComponentLinkTag(string tcmUri, NetBiscuitLinkType type, string linkText, string outputMarkup) { return string.Format(NET_BISCUIT_COMPONENT_LINK_CONTROL, tcmUri, type, linkText, outputMarkup); }
private string ReplaceLinksOfType(NetBiscuitLinkType type, string output) { return Regex.Replace(output, GetRegExForType(type), new MatchEvaluator((match) => { linksFound = true; return ConvertToComponentLinkTag(match, type); })); }