This commit is contained in:
Zel
2025-02-23 18:47:21 +08:00
parent eaaffeeccb
commit e46a7ca31c
104 changed files with 2630 additions and 2516 deletions

View File

@@ -16,7 +16,7 @@
public T? Value<T>(string name)
{
var value = Collection.Where(o => o.Name == name).FirstOrDefault();
var value = Collection.FirstOrDefault(o => o.Name == name);
if (value == null)
{
return default;
@@ -26,7 +26,7 @@
public T Value<T>(string name, T defaultValue)
{
var value = Collection.Where(o => o.Name == name).FirstOrDefault();
var value = Collection.FirstOrDefault(o => o.Name == name);
if (value == null)
{
return defaultValue;

View File

@@ -19,12 +19,7 @@ namespace ZelWiki.Models.DataModels
public T? As<T>(T defaultValue)
{
if (Value == null)
{
return defaultValue;
}
return Converters.ConvertTo<T>(Value);
return Value == null ? defaultValue : Converters.ConvertTo<T>(Value);
}
public string DataType { get; set; } = string.Empty;

View File

@@ -7,23 +7,23 @@ namespace ZelWiki.Models.DataModels
public int Id { get; set; } = 0;
/// <summary>
/// The revision of this page that is being viewed. May not be the latest revision.
/// 正在查看的此页面的修订版。可能不是最新版本
/// </summary>
public int Revision { get; set; }
/// <summary>
/// The most current revision of this page.
/// 此页面的最新修订版
/// </summary>
public int MostCurrentRevision { get; set; }
public bool IsHistoricalVersion => Revision != MostCurrentRevision;
/// <summary>
/// Lets us know whether this page exists and is loaded.
/// 此页面是否存在并已加载
/// </summary>
public bool Exists => Id > 0;
/// <summary>
/// Count of revisions higher than Revision.
/// 修订次数高于修订次数
/// </summary>
public int HigherRevisionCount { get; set; }
public int DeletedRevisionCount { get; set; }
@@ -36,8 +36,8 @@ namespace ZelWiki.Models.DataModels
{
get
{
int idealLength = 64;
int maxLength = 100;
var idealLength = 64;
var maxLength = 100;
if (Description.Length > idealLength)
{

View File

@@ -1,20 +1,20 @@
namespace ZelWiki.Models.DataModels
{
/// <summary>
/// Used to cache pre-processed wiki results.
/// 用于缓存预处理的结果
/// </summary>
public class PageCache
{
public PageCache(string body)
{
Body = body;
}
/// <summary>
/// Custom page title set by a call to @@Title("...")
/// 通过调用@@Title("...")设置自定义页面title
/// </summary>
public string? PageTitle { get; set; }
public string Body { get; set; }
public PageCache(string body)
{
Body = body;
}
}
}

View File

@@ -4,7 +4,7 @@ namespace ZelWiki.Models.DataModels
{
public int PageId { get; set; }
/// <summary>
/// TightWiki.Library.Constants.WikiInstruction
///
/// </summary>
public string Instruction { get; set; } = string.Empty;
}

View File

@@ -5,7 +5,7 @@
public List<ProcessingInstruction> Collection { get; set; } = new();
/// <summary>
/// Returns true if the collection contains the given processing instruction.
/// 如果集合包含给定的处理指令则返回true
/// </summary>
/// <param name="wikiInstruction">WikiInstruction.Protect</param>
/// <returns></returns>