using System;
using CodeKicker.BBCode;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Collections.Specialized;
using System.Text;
namespace Yavsc.Helpers
{
///
/// BB code helper.
///
public static class BBCodeHelper
{
static Dictionary parent = new Dictionary ();
private static string tclass="shoh";
private static string cclass="hiduh";
private static string mp4=null, ogg=null, webm=null;
///
/// Gets or sets the BB code view class.
///
/// The BB code view class.
public static string BBCodeViewClass {
get {
return cclass;
}
set {
cclass = value;
}
}
///
/// Gets or sets the BB code case class.
///
/// The BB code case class.
public static string BBCodeCaseClass {
get {
return tclass;
}
set {
tclass = value;
}
}
///
/// Gets the BB tags usage.
///
/// The BB tags usage.
public static string[] BBTagsUsage {
get {
List u = new List ();
foreach (BBTag t in Parser.Tags)
if (!parent.ContainsValue(t))
{
TagBuilder tib = new TagBuilder ("div");
tib.AddCssClass (BBCodeCaseClass);
string temp = tagUsage (t);
tib.InnerHtml = temp;
u.Add (string.Format ("{0}
",
false, true,
Section1Transformer,
new BBAttribute ("title", "",TitleContentTransformer),
new BBAttribute ("title", "title", TitleContentTransformer),
new BBAttribute ("para", "para", L1ContentTransformer));
BBTag bbdp=new BBTag ("docpage",
"
${content}", "
",
false,
false,
DocPageContentTransformer);
parser = new BBCodeParser (new[] {
new BBTag ("b", "", ""),
new BBTag ("i", "", ""),
new BBTag ("em", "", ""),
new BBTag ("u", "", ""),
new BBTag ("code", "", ""),
new BBTag ("img", "", "", false, true, new BBAttribute ("alt", ""), new BBAttribute("alt","alt"), new BBAttribute ("style", "style")),
new BBTag ("quote", "
", "
"),
new BBTag ("div", "
", "
", new BBAttribute("style","style")),
new BBTag ("p", "
", "
"),
new BBTag ("h", "
", "
"),
bblist,
new BBTag ("*", "
", "
", true, false),
new BBTag ("url", "", "", true, true, new BBAttribute ("href", ""), new BBAttribute ("href", "href")),
new BBTag ("br", " ", "", true, false),
new BBTag ("video", "",
new BBAttribute("mp4","mp4"),
new BBAttribute("ogg","ogg"),
new BBAttribute("webm","webm"),
new BBAttribute("style","style")),
new BBTag ("tag", "", "", true, true,
TagContentTransformer),
bbs1,
bbs2,
new BBTag ("sect3",
"