An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FLocal.Common.helpers;
namespace FLocal.Common.BBCodes {
abstract class BBCode : PJonDevelopment.BBCode.BBCodeElement<IPostParsingContext> {
public BBCode(string name)
: base(name) {
}
protected string GetInnerHTML(IPostParsingContext context, PJonDevelopment.BBCode.ITextFormatter<IPostParsingContext> formatter) {
StringBuilder builder = new StringBuilder();
foreach (var node in this.Nodes) {
builder.Append(node.Format(context, formatter));
}
return builder.ToString();
}
protected string Default {
get {
if(!this.Attributes.ContainsKey("DEFAULT")) {
return null;
}
string result = this.Attributes["DEFAULT"];
if(result == null || result == "") {
return null;
}
return this.Safe(result);
}
}
protected string DefaultOrValue {
get {
string result = this.Default;
if(result == null) {
result = this.Safe(this.InnerText);
}
return result;
}
}
protected string Safe(string str) {
return System.Web.HttpUtility.HtmlEncode(str);
}
}
}