Post and Thread tags implemented

main
Inga 🏳‍🌈 15 years ago
parent 00ad0ae3ab
commit 7936999cf9
  1. 24
      Common/BBCodes/Post.cs
  2. 24
      Common/BBCodes/Thread.cs
  3. 2
      Common/Common.csproj
  4. 2
      Common/UBBParser.cs

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJonDevelopment.BBCode;
namespace FLocal.Common.BBCodes {
class Post : BBCode {
public Post()
: base("post") {
}
public override string Format(ITextFormatter formatter) {
var post = dataobjects.Post.LoadById(int.Parse(this.DefaultOrValue));
var name = this.Safe(post.title);
if(this.Default != null) {
name = this.GetInnerHTML(formatter);
}
return "<a href=\"/Post/" + post.id.ToString() + "/\">" + name + "</a>";
}
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJonDevelopment.BBCode;
namespace FLocal.Common.BBCodes {
class Thread : BBCode {
public Thread()
: base("thread") {
}
public override string Format(ITextFormatter formatter) {
var thread = dataobjects.Thread.LoadById(int.Parse(this.DefaultOrValue));
var name = this.Safe(post.title);
if(this.Default != null) {
name = this.GetInnerHTML(formatter);
}
return "<a href=\"/Thread/" + thread.id.ToString() + "/\">" + name + "</a>";
}
}
}

@ -70,11 +70,13 @@
<Compile Include="BBCodes\ListElem.cs" />
<Compile Include="BBCodes\Lurk.cs" />
<Compile Include="BBCodes\Poll.cs" />
<Compile Include="BBCodes\Post.cs" />
<Compile Include="BBCodes\Quote.cs" />
<Compile Include="BBCodes\QuoteSkipper.cs" />
<Compile Include="BBCodes\RuWiki.cs" />
<Compile Include="BBCodes\S.cs" />
<Compile Include="BBCodes\Spoiler.cs" />
<Compile Include="BBCodes\Thread.cs" />
<Compile Include="BBCodes\U.cs" />
<Compile Include="BBCodes\UploadImage.cs" />
<Compile Include="BBCodes\UploadLink.cs" />

@ -123,9 +123,11 @@ namespace FLocal.Common {
this.parser.ElementTypes.Add("lurk", typeof(BBCodes.Lurk), true);
this.parser.ElementTypes.Add("*", typeof(BBCodes.ListElem), false);
this.parser.ElementTypes.Add("poll", typeof(BBCodes.Poll), true);
this.parser.ElementTypes.Add("post", typeof(BBCodes.Post), true);
this.parser.ElementTypes.Add("quote", typeof(BBCodes.Quote), true);this.parser.ElementTypes.Add("q", typeof(BBCodes.Quote), true);
this.parser.ElementTypes.Add("s", typeof(BBCodes.S), true);
this.parser.ElementTypes.Add("spoiler", typeof(BBCodes.Spoiler), true);this.parser.ElementTypes.Add("cut", typeof(BBCodes.Spoiler), true);
this.parser.ElementTypes.Add("thread", typeof(BBCodes.Thread), true);
this.parser.ElementTypes.Add("u", typeof(BBCodes.U), true);
this.parser.ElementTypes.Add("uploadimage", typeof(BBCodes.UploadImage), true);
this.parser.ElementTypes.Add("uploadlink", typeof(BBCodes.UploadLink), true);

Loading…
Cancel
Save