1
This commit is contained in:
@@ -5,7 +5,7 @@ using ZelWiki.Engine.Library.Interfaces;
|
|||||||
namespace ZelWiki.Engine.Implementation
|
namespace ZelWiki.Engine.Implementation
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 处理处理指令函数调用,这些函数会影响页面的处理方式,但不会直接替换为文本.
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessingInstructionFunctionHandler : IProcessingInstructionFunctionHandler
|
public class ProcessingInstructionFunctionHandler : IProcessingInstructionFunctionHandler
|
||||||
{
|
{
|
||||||
@@ -17,11 +17,11 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
{
|
{
|
||||||
if (_collection == null)
|
if (_collection == null)
|
||||||
{
|
{
|
||||||
_collection =
|
_collection = new FunctionPrototypeCollection(FunctionPrototypeCollection.WikiFunctionType.Instruction);
|
||||||
new FunctionPrototypeCollection(FunctionPrototypeCollection.WikiFunctionType.Instruction);
|
|
||||||
|
|
||||||
#region
|
#region Prototypes.
|
||||||
|
|
||||||
|
//Processing instructions:
|
||||||
_collection.Add("@@Deprecate:");
|
_collection.Add("@@Deprecate:");
|
||||||
_collection.Add("@@Protect:<bool>{isSilent}='false'");
|
_collection.Add("@@Protect:<bool>{isSilent}='false'");
|
||||||
_collection.Add("@@Tags: <string:infinite>[pageTags]");
|
_collection.Add("@@Tags: <string:infinite>[pageTags]");
|
||||||
@@ -42,7 +42,7 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 处理各种页面
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state"></param>
|
/// <param name="state"></param>
|
||||||
/// <param name="function"></param>
|
/// <param name="function"></param>
|
||||||
@@ -63,6 +63,8 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "title":
|
case "title":
|
||||||
{
|
{
|
||||||
state.PageTitle = function.Parameters.Get<string>("pageTitle");
|
state.PageTitle = function.Parameters.Get<string>("pageTitle");
|
||||||
@@ -72,6 +74,8 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "hidefooterlastmodified":
|
case "hidefooterlastmodified":
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterLastModified);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterLastModified);
|
||||||
@@ -81,6 +85,8 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "hidefootercomments":
|
case "hidefootercomments":
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterComments);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.HideFooterComments);
|
||||||
@@ -89,6 +95,8 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "nocache":
|
case "nocache":
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.NoCache);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.NoCache);
|
||||||
@@ -97,20 +105,22 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "deprecate":
|
case "deprecate":
|
||||||
{
|
{
|
||||||
if (state.NestDepth == 0)
|
if (state.NestDepth == 0)
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Deprecate);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Deprecate);
|
||||||
state.Headers.Add(
|
state.Headers.Add("<div class=\"alert alert-danger\">此页面已被弃用,最终将被删除.</div>");
|
||||||
"<div class=\"alert alert-danger\">此页面已被弃用,最终将被删除.</div>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HandlerResult(string.Empty)
|
return new HandlerResult(string.Empty)
|
||||||
{
|
{
|
||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "protect":
|
case "protect":
|
||||||
{
|
{
|
||||||
if (state.NestDepth == 0)
|
if (state.NestDepth == 0)
|
||||||
@@ -119,67 +129,65 @@ namespace ZelWiki.Engine.Implementation
|
|||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Protect);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Protect);
|
||||||
if (isSilent == false)
|
if (isSilent == false)
|
||||||
{
|
{
|
||||||
state.Headers.Add(
|
state.Headers.Add("<div class=\"alert alert-info\">此页面已受到保护,非版主无法更改.</div>");
|
||||||
"<div class=\"alert alert-info\">此页面已受到保护,非版主无法更改.</div>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HandlerResult(string.Empty)
|
return new HandlerResult(string.Empty)
|
||||||
{
|
{
|
||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "template":
|
case "template":
|
||||||
{
|
{
|
||||||
if (state.NestDepth == 0)
|
if (state.NestDepth == 0)
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Template);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Template);
|
||||||
state.Headers.Add(
|
state.Headers.Add("<div class=\"alert alert-secondary\">此页面是一个模板,不会出现在索引或术语表中.</div>");
|
||||||
"<div class=\"alert alert-secondary\">此页面是一个模板,不会出现在索引或术语表中.</div>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HandlerResult(string.Empty)
|
return new HandlerResult(string.Empty)
|
||||||
{
|
{
|
||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "review":
|
case "review":
|
||||||
{
|
{
|
||||||
if (state.NestDepth == 0)
|
if (state.NestDepth == 0)
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Review);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Review);
|
||||||
state.Headers.Add(
|
state.Headers.Add("<div class=\"alert alert-warning\">此页面已被标记为待审核,其内容可能不准确.</div>");
|
||||||
"<div class=\"alert alert-warning\">此页面已被标记为待审核,其内容可能不准确.</div>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HandlerResult(string.Empty)
|
return new HandlerResult(string.Empty)
|
||||||
{
|
{
|
||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "include":
|
case "include":
|
||||||
{
|
{
|
||||||
if (state.NestDepth == 0)
|
if (state.NestDepth == 0)
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Include);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Include);
|
||||||
state.Headers.Add(
|
state.Headers.Add("<div class=\"alert alert-secondary\">此页为包含页,不会出现在索引或术语表中.</div>");
|
||||||
"<div class=\"alert alert-secondary\">此页为包含页,不会出现在索引或术语表中.</div>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HandlerResult(string.Empty)
|
return new HandlerResult(string.Empty)
|
||||||
{
|
{
|
||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
case "draft":
|
case "draft":
|
||||||
{
|
{
|
||||||
if (state.NestDepth == 0)
|
if (state.NestDepth == 0)
|
||||||
{
|
{
|
||||||
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Draft);
|
state.ProcessingInstructions.Add(ZelWiki.Library.Constants.WikiInstruction.Draft);
|
||||||
state.Headers.Add(
|
state.Headers.Add("<div class=\"alert alert-warning\">本页为草稿,可能包含不正确的信息包括但不仅限于实验性样式.</div>");
|
||||||
"<div class=\"alert alert-warning\">本页为草稿,可能包含不正确的信息包括但不仅限于实验性样式.</div>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HandlerResult(string.Empty)
|
return new HandlerResult(string.Empty)
|
||||||
{
|
{
|
||||||
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
Instructions = [Constants.HandlerResultInstruction.TruncateTrailingLine]
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
<PublishProvider>FileSystem</PublishProvider>
|
<PublishProvider>FileSystem</PublishProvider>
|
||||||
<PublishUrl>C:\DropZone\TightWiki.Production\TightWiki</PublishUrl>
|
|
||||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||||
<_TargetId>Folder</_TargetId>
|
<_TargetId>Folder</_TargetId>
|
||||||
<SiteUrlToLaunchAfterPublish />
|
<SiteUrlToLaunchAfterPublish />
|
||||||
|
|||||||
Reference in New Issue
Block a user