Added Footnotes Plugin (contributed from Jens Felsner).
Updated plugins version numbers.
This commit is contained in:
parent
0287216b0e
commit
6c3355b3fa
18 changed files with 166 additions and 16 deletions
|
@ -357,7 +357,7 @@ namespace ScrewTurn.Wiki.Plugins.ActiveDirectory {
|
|||
/// TODO return and complete
|
||||
/// </summary>
|
||||
public ComponentInformation Information {
|
||||
get { return new ComponentInformation("ActiveDirectoryProvider", "ScrewTurn Software", "3.0.1.417", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/ActiveDirectoryProvider.txt"); }
|
||||
get { return new ComponentInformation("ActiveDirectoryProvider", "Threeplicate Srl", "3.0.1.417", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/ActiveDirectoryProvider.txt"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ScrewTurn.Wiki {
|
|||
public class CacheProvider : ICacheProviderV30 {
|
||||
|
||||
private readonly ComponentInformation _info =
|
||||
new ComponentInformation("Local Cache Provider", "ScrewTurn Software", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
new ComponentInformation("Local Cache Provider", "Threeplicate Srl", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
|
||||
private IHostV30 _host;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ The ##WIKITITLE## Team.";
|
|||
/// The default content of the edit notice.
|
||||
/// </summary>
|
||||
public const string EditNoticeContent = @"Please '''do not''' include contents covered by copyright without the explicit permission of the Author. Always preview the result before saving.{BR}
|
||||
If you are having trouble, please visit the [http://www.screwturn.eu/Help.aspx|Help section] at [http://www.screwturn.eu|ScrewTurn Software].";
|
||||
If you are having trouble, please visit the [http://www.screwturn.eu/Help.aspx|Help section] at the [http://www.screwturn.eu|ScrewTurn Wiki Website].";
|
||||
|
||||
/// <summary>
|
||||
/// The default content of the footer.
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki {
|
|||
public class FilesStorageProvider : IFilesStorageProviderV30 {
|
||||
|
||||
private readonly ComponentInformation info = new ComponentInformation("Local Files Provider",
|
||||
"ScrewTurn Software", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
"Threeplicate Srl", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
|
||||
// The following strings MUST terminate with DirectorySeparatorPath in order to properly work
|
||||
// in BuildFullPath method
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ScrewTurn.Wiki {
|
|||
private const string IndexMappingsFile = "IndexMappings.cs";
|
||||
|
||||
private readonly ComponentInformation info =
|
||||
new ComponentInformation("Local Pages Provider", "ScrewTurn Software", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
new ComponentInformation("Local Pages Provider", "Threeplicate Srl", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
private IHostV30 host;
|
||||
|
||||
// This cache is needed due to performance problems
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace ScrewTurn.Wiki {
|
|||
public static readonly string ProviderName = "Local Settings Provider";
|
||||
|
||||
private readonly ComponentInformation info =
|
||||
new ComponentInformation(ProviderName, "ScrewTurn Software", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
new ComponentInformation(ProviderName, "Threeplicate Srl", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
|
||||
private IHostV30 host;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace ScrewTurn.Wiki {
|
|||
private const string GroupsFile = "Groups.cs";
|
||||
|
||||
private readonly ComponentInformation info = new ComponentInformation("Local Users Provider",
|
||||
"ScrewTurn Software", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
"Threeplicate Srl", Settings.WikiVersion, "http://www.screwturn.eu", null);
|
||||
|
||||
private IHostV30 host;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
|||
private IHostV30 _host;
|
||||
private string _config;
|
||||
private bool _enableLogging = true;
|
||||
private static readonly ComponentInformation Info = new ComponentInformation("Download Counter", "ScrewTurn Software", "3.0.0.206", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/DownloadCounter.txt");
|
||||
private static readonly ComponentInformation Info = new ComponentInformation("Download Counter Plugin", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/DownloadCounter.txt");
|
||||
|
||||
private static readonly Regex XmlRegex = new Regex(@"\<countDownloads(.+?)\>(.+?)\<\/countDownloads\>",
|
||||
RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
|
149
PluginPack/Footnotes.cs
Normal file
149
PluginPack/Footnotes.cs
Normal file
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ScrewTurn.Wiki.PluginFramework;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
||||
|
||||
/// <summary>
|
||||
/// Implements a footnotes plugin.
|
||||
/// </summary>
|
||||
public class Footnotes : IFormatterProviderV30 {
|
||||
|
||||
// Kindly contributed by Jens Felsner
|
||||
private static readonly ComponentInformation info = new ComponentInformation("Footnotes Plugin", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/RssFeedDisplay.txt");
|
||||
|
||||
private static readonly Regex ReferencesRegex = new Regex("(<[ ]*references[ ]*/[ ]*>|<[ ]*references[ ]*>.*?<[ ]*/[ ]*references[ ]*>)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex RefRegex = new Regex("<[ ]*ref[ ]*>.*?<[ ]*/[ ]*ref[ ]*>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex RefRemovalRegex = new Regex("(<[ ]*ref[ ]*>|<[ ]*/[ ]*ref[ ]*>)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private IHostV30 host = null;
|
||||
private string config = "";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the Storage Provider.
|
||||
/// </summary>
|
||||
/// <param name="host">The Host of the Component.</param>
|
||||
/// <param name="config">The Configuration data, if any.</param>
|
||||
/// <exception cref="ArgumentNullException">If <paramref name="host"/> or <paramref name="config"/> are <c>null</c>.</exception>
|
||||
/// <exception cref="InvalidConfigurationException">If <paramref name="config"/> is not valid or is incorrect.</exception>
|
||||
public void Init(IHostV30 host, string config) {
|
||||
this.host = host;
|
||||
this.config = config != null ? config : "";
|
||||
}
|
||||
|
||||
// Replaces the first occurence of 'find' in 'input' with 'replace'
|
||||
private static string ReplaceFirst(string input, string find, string replace) {
|
||||
return input.Substring(0, input.IndexOf(find)) + replace + input.Substring(input.IndexOf(find) + find.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a Formatting phase.
|
||||
/// </summary>
|
||||
/// <param name="raw">The raw content to Format.</param>
|
||||
/// <param name="context">The Context information.</param>
|
||||
/// <param name="phase">The Phase.</param>
|
||||
/// <returns>The Formatted content.</returns>
|
||||
public string Format(string raw, ContextInformation context, FormattingPhase phase) {
|
||||
// Match all <ref>*</ref>
|
||||
MatchCollection mc = RefRegex.Matches(raw);
|
||||
|
||||
// No ref-tag found, nothing to do
|
||||
if(mc.Count == 0) return raw;
|
||||
|
||||
// No references tag
|
||||
if(ReferencesRegex.Matches(raw).Count == 0) {
|
||||
return raw + "<br/><span style=\"color: #FF0000;\">Reference Error! Missing element <references/></span>";
|
||||
}
|
||||
|
||||
string output = raw;
|
||||
string ref_string = "<table class=\"footnotes\">";
|
||||
|
||||
int footnoteCounter = 0;
|
||||
|
||||
// For each <ref>...</ref> replace it with Footnote, append it to ref-section
|
||||
foreach(Match m in mc) {
|
||||
footnoteCounter++;
|
||||
output = ReplaceFirst(output, m.Value, "<a id=\"refnote" + footnoteCounter.ToString() + "\" href=\"#footnote" + footnoteCounter.ToString() + "\"><sup>" + footnoteCounter.ToString() + "</sup></a>");
|
||||
|
||||
ref_string += "<tr><td><a id=\"footnote" + footnoteCounter.ToString() + "\" href=\"#refnote" + footnoteCounter.ToString() + "\"><sup>" + footnoteCounter.ToString() + "</sup></a></td><td>" + RefRemovalRegex.Replace(m.Value, "") + "</td></tr>";
|
||||
}
|
||||
ref_string += "</table>";
|
||||
|
||||
// Replace <reference/> with ref-section
|
||||
output = ReferencesRegex.Replace(output, ref_string);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
#region IFormatterProviderV30 Member
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether or not to execute Phase 1.
|
||||
/// </summary>
|
||||
public bool PerformPhase1 {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether or not to execute Phase 2.
|
||||
/// </summary>
|
||||
public bool PerformPhase2 {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether or not to execute Phase 3.
|
||||
/// </summary>
|
||||
public bool PerformPhase3 {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the execution priority of the provider (0 lowest, 100 highest).
|
||||
/// </summary>
|
||||
public int ExecutionPriority {
|
||||
get { return 50; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the title of an item for display (always during phase 3).
|
||||
/// </summary>
|
||||
/// <param name="title">The input title.</param>
|
||||
/// <param name="context">The context information.</param>
|
||||
/// <returns>The prepared title (no markup allowed).</returns>
|
||||
public string PrepareTitle(string title, ContextInformation context) {
|
||||
return title;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IProviderV30 Member
|
||||
|
||||
/// <summary>
|
||||
/// Method invoked on shutdown.
|
||||
/// </summary>
|
||||
/// <remarks>This method might not be invoked in some cases.</remarks>
|
||||
public void Shutdown() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Information about the Provider.
|
||||
/// </summary>
|
||||
public ComponentInformation Information {
|
||||
get { return info; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a brief summary of the configuration string format, in HTML. Returns <c>null</c> if no configuration is needed.
|
||||
/// </summary>
|
||||
public string ConfigHelpHtml {
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
|||
|
||||
private IHostV30 host;
|
||||
private string config;
|
||||
private ComponentInformation info = new ComponentInformation("Multilanguage Content Plugin", "ScrewTurn Software", "3.0.0.180", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/Multilanguage.txt");
|
||||
private ComponentInformation info = new ComponentInformation("Multilanguage Content Plugin", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/Multilanguage.txt");
|
||||
|
||||
private string defaultLanguage = "en-us";
|
||||
private bool displayWarning = false;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
|||
|
||||
private IHostV30 host;
|
||||
private string config;
|
||||
private static readonly ComponentInformation info = new ComponentInformation("Pages Sandbox", "ScrewTurn Software", "3.0.0.180", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/PagesSandbox.txt");
|
||||
private static readonly ComponentInformation info = new ComponentInformation("Pages Sandbox", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/PagesSandbox.txt");
|
||||
|
||||
private List<NamespaceInfo> allNamespaces = new List<NamespaceInfo>(5);
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
<Compile Include="..\AssemblyVersion.cs">
|
||||
<Link>AssemblyVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Footnotes.cs" />
|
||||
<Compile Include="RssFeedDisplay.cs" />
|
||||
<Compile Include="DownloadCounter.cs" />
|
||||
<Compile Include="MultilanguageContentPlugin.cs" />
|
||||
|
|
|
@ -18,7 +18,7 @@ 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.454", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/RssFeedDisplay.txt");
|
||||
private static readonly ComponentInformation Info = new ComponentInformation("RSS Feed Display Plugin", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/RssFeedDisplay.txt");
|
||||
|
||||
private static readonly Regex RssRegex = new Regex(@"{(RSS|Twitter):(.+?)}",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ScrewTurn.Wiki.Plugins.PluginPack {
|
|||
private const string ConfigHelpHtmlValue = "Config consists of three lines:<br/><i><Url></i> - The base url to the Unfuddle API (i.e. http://account_name.unfuddle.com/api/v1/projects/project_ID)<br/><i><Username></i> - The username to the unfuddle account to use for authentication<br/><i><Password></i> - The password to the unfuddle account to use for authentication<br/>";
|
||||
private const string LoadErrorMessage = "Unable to load ticket report at this time.";
|
||||
private static readonly Regex UnfuddleRegex = new Regex(@"{unfuddle}", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
private static readonly ComponentInformation Info = new ComponentInformation("Unfuddle Tickets", "ScrewTurn Software", "3.0.0.204", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/UnfuddleTickets.txt");
|
||||
private static readonly ComponentInformation Info = new ComponentInformation("Unfuddle Tickets Plugin", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/PluginPack/UnfuddleTickets.txt");
|
||||
|
||||
private string _config;
|
||||
private IHostV30 _host;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
|
|||
/// </summary>
|
||||
public class SqlServerFilesStorageProvider : SqlFilesStorageProviderBase {
|
||||
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Files Storage Provider", "ScrewTurn Software", "3.0.0.341", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Files.txt");
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Files Storage Provider", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Files.txt");
|
||||
|
||||
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
|
|||
/// </summary>
|
||||
public class SqlServerPagesStorageProvider : SqlPagesStorageProviderBase, IPagesStorageProviderV30 {
|
||||
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Pages Storage Provider", "ScrewTurn Software", "3.0.1.403", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Pages.txt");
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Pages Storage Provider", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Pages.txt");
|
||||
|
||||
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
|
|||
/// </summary>
|
||||
public class SqlServerSettingsStorageProvider : SqlSettingsStorageProviderBase {
|
||||
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Settings Storage Provider", "ScrewTurn Software", "3.0.1.461", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Settings.txt");
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Settings Storage Provider", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Settings.txt");
|
||||
|
||||
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
|
|||
/// </summary>
|
||||
public class SqlServerUsersStorageProvider : SqlUsersStorageProviderBase, IUsersStorageProviderV30 {
|
||||
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Users Storage Provider", "ScrewTurn Software", "3.0.0.341", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Users.txt");
|
||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Users Storage Provider", "Threeplicate Srl", "3.0.1.471", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Users.txt");
|
||||
|
||||
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue