WikiFunctions.Tools.HTMLListToWiki C# (CSharp) Method

HTMLListToWiki() public static method

Turns an HTML list into a wiki style list using the input bullet style (with space)
public static HTMLListToWiki ( string text, string bullet ) : string
text string HTML text to convert to list
bullet string List style to use (# or *)
return string
        public static string HTMLListToWiki(string text, string bullet)
        {
            text = text.Replace("\r\n\r\n", "\r\n");
            text = Regex.Replace(text, "<br ?/?>", "", RegexOptions.IgnoreCase);
            text = Regex.Replace(text, "</?(ol|ul|li)>", "", RegexOptions.IgnoreCase);
            text = Regex.Replace(text, "^</?(ol|ul|li)>\r\n", "", RegexOptions.Multiline | RegexOptions.IgnoreCase);
            text = Regex.Replace(text, @"^(\:|\*|#|\(? ?\d{1,3}\b ?\)|\d{1,3}\b\.?)", "", RegexOptions.Multiline);

            // add bullet to start of each line, but not empty lines or lines with just whitespace
            return WholeLine.Replace(text, m => bullet + " " + m.Groups[1].Value.TrimStart());
        }
Tools