This project is read-only.
1
Vote

BBCode Parser Color and Size Tag issues

description

Issue with BBCode parser is that it doesn't render some HTML tags like [COLOR] and [SIZE].

we can not use BBCode.ToHTML( ) for above tags.

Hence we have to end up writing customized parser which includes tags and apart from that needs to inject some more text for rendering proper HTML.

Example for COLOR tag we need to do following
List<BBTag> tags = new List<BBTag>();
        tags.Add(new BBTag("color", "<span style=\"${color}\">", "</span>", true, true,
                new BBAttribute("color", "color",
                    attributeRenderingContext => string.IsNullOrEmpty(attributeRenderingContext.AttributeValue)
                        ? ""
                        : "color:"
                        + attributeRenderingContext.AttributeValue + ";")));
string input = "[color=#800000]Hi I am [b][i]bhargav[/i][/b][/color] ";
    input = input.Replace("[color=", "[color color=");
        BBCodeParser MyParser = new BBCodeParser(tags);
    string input = "[color=#800000]Hi I am [b][i]bhargav[/i][/b][/color] ";

Looking for an ideal solution where I don't have to create my customer parser and need to inject some text as I am doing in above example.

comments