From 7936999cf92dc0e65e366737c91f7ee6e1a29f4c Mon Sep 17 00:00:00 2001
From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com>
Date: Wed, 1 Sep 2010 15:23:46 +0000
Subject: [PATCH] Post and Thread tags implemented
---
Common/BBCodes/Post.cs | 24 ++++++++++++++++++++++++
Common/BBCodes/Thread.cs | 24 ++++++++++++++++++++++++
Common/Common.csproj | 2 ++
Common/UBBParser.cs | 2 ++
4 files changed, 52 insertions(+)
create mode 100644 Common/BBCodes/Post.cs
create mode 100644 Common/BBCodes/Thread.cs
diff --git a/Common/BBCodes/Post.cs b/Common/BBCodes/Post.cs
new file mode 100644
index 0000000..a3a7177
--- /dev/null
+++ b/Common/BBCodes/Post.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 "" + name + "";
+ }
+
+ }
+}
diff --git a/Common/BBCodes/Thread.cs b/Common/BBCodes/Thread.cs
new file mode 100644
index 0000000..e35e772
--- /dev/null
+++ b/Common/BBCodes/Thread.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 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 "" + name + "";
+ }
+
+ }
+}
diff --git a/Common/Common.csproj b/Common/Common.csproj
index d28ac80..331fb91 100644
--- a/Common/Common.csproj
+++ b/Common/Common.csproj
@@ -70,11 +70,13 @@
+
+
diff --git a/Common/UBBParser.cs b/Common/UBBParser.cs
index e3a82ab..e28d999 100644
--- a/Common/UBBParser.cs
+++ b/Common/UBBParser.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);