private string AnchorInlineEvaluator(Match match) { string linkText = match.Groups[2].Value; string url = match.Groups[3].Value; string title = match.Groups[6].Value; HyperTextLUT hyperText = new HyperTextLUT(); hyperText.text = linkText; string result; url = EncodeProblemUrlChars(url); url = EscapeBoldItalic(url); if (url.StartsWith("<") && url.EndsWith(">")) url = url.Substring(1, url.Length - 2); // remove <>'s surrounding URL, if present hyperText.url = url; result = string.Format("<a href=\"{0}\"", url); if (!String.IsNullOrEmpty(title)) { title = title.Replace("\"", """); title = EscapeBoldItalic(title); result += string.Format(" title=\"{0}\"", title); } result += string.Format(">{0}</a>", linkText); hyperTextList.Add(hyperText); result = "%%URL%%"+hyperTextList.Count+"%%URL%%"; //result = "<color=blue>"+linkText+"</color>"; return result; }
private string AnchorRefEvaluator(Match match) { string wholeMatch = match.Groups[1].Value; string linkText = match.Groups[2].Value; string linkID = match.Groups[3].Value.ToLowerInvariant(); HyperTextLUT hyperText = new HyperTextLUT(); hyperText.text = linkText; string result; //Vector2 _selection = new Vector2(result.Length,0); //Debug.Log(_selection.x); // for shortcut links like [this][]. if (linkID == "") linkID = linkText.ToLowerInvariant(); if (_urls.ContainsKey(linkID)) { string url = _urls[linkID]; url = EncodeProblemUrlChars(url); url = EscapeBoldItalic(url); //result = "<a href=\"" + url + "\""; hyperText.url = url; if (_titles.ContainsKey(linkID)) { string title = _titles[linkID]; title = EscapeBoldItalic(title); // result += " title=\"" + title + "\""; } // result += ">" + linkText + "</a>"; hyperTextList.Add(hyperText); //result = "<color=blue>"+linkText+"</color>"; result = "%%URL%%"+hyperTextList.Count+"%%URL%%"; } else result = wholeMatch; return result; }
private string AnchorRefShortcutEvaluator(Match match) { string wholeMatch = match.Groups[1].Value; string linkText = match.Groups[2].Value; string linkID = Regex.Replace(linkText.ToLowerInvariant(), @"[ ]*\n[ ]*", " "); // lower case and remove newlines / extra spaces HyperTextLUT hyperText = new HyperTextLUT(); hyperText.text = linkText; string result; if (_urls.ContainsKey(linkID)) { string url = _urls[linkID]; url = EncodeProblemUrlChars(url); url = EscapeBoldItalic(url); hyperText.url = url; result = "<a href=\"" + url + "\""; if (_titles.ContainsKey(linkID)) { string title = _titles[linkID]; title = EscapeBoldItalic(title); result += " title=\"" + title + "\""; } result += ">" + linkText + "</a>"; //result = "<color=blue>"+linkText+"</color>"; hyperTextList.Add(hyperText); result = "%%URL%%"+hyperTextList.Count+"%%URL%%"; } else result = wholeMatch; return result; }
private string HyperlinkEvaluator(Match match) { string link = match.Groups[1].Value; //return string.Format("<a href=\"{0}\">{0}</a>", link); // JFF HyperTextLUT hyperText = new HyperTextLUT(); hyperText.text = link; hyperText.url = link; hyperTextList.Add(hyperText); return "%%URL%%"+hyperTextList.Count+"%%URL%%"; // return string.Format("<color=blue>{0}</color>", link); }