Пример #1
0
        public static BBC Basic()
        {
            var bbc = new BBC();

            bbc["[code]{text}[/code]"] =
                _ => "<pre>" + _.text + "</pre>";

            bbc["[b]{text}[/b]"] =
                _ => "<strong>" + bbc.Transform(_.text) + "</strong>";

            bbc["[i]{text}[/i]"] =
                _ => "<em>" + bbc.Transform(_.text) + "</em>";

            bbc["[date/]"] =
                _ => DateTime.Now.ToShortDateString();

            bbc["[url={url}]{text}[/url]"] =
                _ => "<a href='" + _.url + "'>" + _.text + "</a>";

            return(bbc);
        }
Пример #2
0
        static void Main(string[] args)
        {
            var bbc = BBC.Basic();

            Console.WriteLine(bbc.Transform("[date/] [b]this is bold[/b] and [code]this is [b]code[/b][/code]\nand this is [b]bold [i]italic[/i][/b]\n[url='http://google.com']test[/url]"));
        }