Open NickThissen opened 7 years ago
Just hit this.... to fix it do this..
new BBAttribute("href", "", GetHRef, HtmlEncodingMode.UnsafeDontEncode), // Default Attribute
new BBAttribute("href", "href", GetHRef, HtmlEncodingMode.UnsafeDontEncode),
private string GetHRef(IAttributeRenderingContext attributeRenderingContext)
{
var href = attributeRenderingContext.GetAttributeValueByID("href");
if (href == null)
{
return attributeRenderingContext.GetAttributeValueByID("content");
}
return href;
}
Here's what I did:
new BBTag("url", "<a href=\"${href}\">", "</a>", new BBAttribute("href", ""), new BBAttribute("href", "href"))
Hi! Thanks for these fixes to the BBCode parser. I hope you are still reading this. I am having some parsing trouble and hoped you could help.
I am trying to parse two possible flavors of the [url] tag:
This is my desired output:
I know how to configure either of these, e.g.:
The problem is, I cannot declare both of these at the same time because tags should have unique names. Both of these tags are named "url" so there's an error in the parser where it tries to obtain the tag by name.
Is this not supported? Isn't this an extremely common use-case and how pretty much every forum works?
I suppose to fix you'd have to get a list of all matching tags, and then figure out by their attributes which one is meant... But I haven't been able to get anywhere close to this. Hope you have an idea!