diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs
index d775854..dd4ad39 100644
--- a/AssemblyVersion.cs
+++ b/AssemblyVersion.cs
@@ -16,5 +16,5 @@ using System.Reflection;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("3.0.1.453")]
-[assembly: AssemblyFileVersion("3.0.1.453")]
+[assembly: AssemblyVersion("3.0.1.454")]
+[assembly: AssemblyFileVersion("3.0.1.454")]
diff --git a/PluginPack/RssFeedDisplay.cs b/PluginPack/RssFeedDisplay.cs
index c82ef3a..b9a705d 100644
--- a/PluginPack/RssFeedDisplay.cs
+++ b/PluginPack/RssFeedDisplay.cs
@@ -18,10 +18,10 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
private IHostV30 _host;
private string _config;
private bool _enableLogging = true;
- private static readonly ComponentInformation Info = new ComponentInformation("RSS Feed Display Plugin", "ScrewTurn Software", "3.0.1.453", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/RssFeedDisplay.txt");
+ private static readonly ComponentInformation Info = new ComponentInformation("RSS Feed Display Plugin", "ScrewTurn Software", "3.0.1.454", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/RssFeedDisplay.txt");
- private static readonly Regex RssRegex = new Regex(@"{RSS:http://(.+?)}",
- RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
+ private static readonly Regex RssRegex = new Regex(@"{(RSS|Twitter):(.+?)}",
+ RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
///
/// Specifies whether or not to execute Phase 1.
@@ -66,7 +66,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
try {
- KeyValuePair block = FindAndRemoveFirstOccurrence(buffer);
+ KeyValuePair block = FindAndRemoveFirstOccurrence(buffer);
while(block.Key != -1) {
string blockHash = block.Value.ToString();
@@ -78,20 +78,35 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
}
if(result == null) {
- XmlDocument feedXml = GetXml(block.Value.ToString().Substring(5, block.Value.ToString().Length - 6));
+ bool isTwitter = block.Value.Groups[1].Value.ToLowerInvariant() == "twitter";
+ XmlDocument feedXml = GetXml(block.Value.Groups[2].Value);
XmlNode node = feedXml.DocumentElement;
XmlNode itemTitle = node.SelectNodes("/rss/channel/item/title")[0];
XmlNode itemLink = node.SelectNodes("/rss/channel/item/link")[0];
XmlNode itemContent = node.SelectNodes("/rss/channel/item/description")[0];
string itemContentStr = StripHtml(itemContent.InnerText);
- itemContentStr = (itemContentStr.Length > 350 && itemContentStr.Substring(347, 5) != "[...]") ? itemContentStr.Substring(0, itemContentStr.IndexOf(" ", 345)) + " [...]" : itemContentStr;
- result = @"";
+ itemContentStr = (itemContentStr.Length > 350 && itemContentStr.Substring(347, 5) != "[...]") ? itemContentStr.Substring(0, itemContentStr.IndexOf(" ", 345) + 1) + " [...]" : itemContentStr;
+ if(itemContentStr.Length <= 1) itemContentStr = StripHtml(itemContent.InnerText);
+
+ if(isTwitter) {
+ string tweet = itemTitle.InnerText;
+ tweet = tweet.Substring(tweet.IndexOf(":") + 2);
+ result = @"";
+ }
+ else {
+ result = @"";
+ }
+
if(System.Web.HttpContext.Current != null) {
System.Web.HttpContext.Current.Cache.Add(blockHash, result, null, DateTime.Now.AddMinutes(60),
System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
@@ -105,7 +120,6 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
}
catch(Exception ex) {
LogWarning(string.Format("Exception occurred: {0}", ex.Message));
- return null;
}
return buffer.ToString();
}
@@ -127,7 +141,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
results.LoadXml(xmlString);
}
catch {
- LogWarning("Received Unexpected Response from Unfuddle Server.");
+ LogWarning("Received Unexpected Response from server.");
}
}
return results;
@@ -143,16 +157,16 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
///
/// The buffer.
/// The index->content data.
- private static KeyValuePair FindAndRemoveFirstOccurrence(StringBuilder buffer) {
+ private static KeyValuePair FindAndRemoveFirstOccurrence(StringBuilder buffer) {
Match match = RssRegex.Match(buffer.ToString());
if(match.Success) {
buffer.Remove(match.Index, match.Length);
- return new KeyValuePair(match.Index, match.Value);
+ return new KeyValuePair(match.Index, match);
}
- return new KeyValuePair(-1, null);
+ return new KeyValuePair(-1, null);
}
///
@@ -221,7 +235,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
/// Gets a brief summary of the configuration string format, in HTML. Returns null if no configuration is needed.
///
public string ConfigHelpHtml {
- get { return null; }
+ get { return "Specify nolog for disabling warning log messages."; }
}
}